1 |
#
|
2 |
# Build.pm
|
3 |
#
|
4 |
# Originally Written by Christopher Williams
|
5 |
#
|
6 |
# Description
|
7 |
#
|
8 |
# Interface
|
9 |
# ---------
|
10 |
# new(ConfigArea) : A new Build object
|
11 |
# build(dir,[@targets]) : Build relevant target for a given directory
|
12 |
# dir relative to top. Returns a BuildReport
|
13 |
|
14 |
package BuildSystem::Build;
|
15 |
use BuildSystem::BuildReport;
|
16 |
use BuildSystem::BuildSetup;
|
17 |
use Utilities::Verbose;
|
18 |
require 5.004;
|
19 |
@ISA=qw(Utilities::Verbose);
|
20 |
|
21 |
sub new
|
22 |
{
|
23 |
my $class=shift;
|
24 |
my $self={};
|
25 |
bless $self, $class;
|
26 |
$self->{area}=shift;
|
27 |
$self->{toolbox}=shift;
|
28 |
# Other initialisations:
|
29 |
$self->_init();
|
30 |
$self->verbose("LOCALTOP=".$ENV{LOCALTOP});
|
31 |
$self->verbose("RELEASETOP=".$ENV{RELEASETOP});
|
32 |
return $self;
|
33 |
}
|
34 |
|
35 |
sub _init
|
36 |
{
|
37 |
my $self=shift;
|
38 |
$self->{buildreport}=BuildSystem::BuildReport->new();
|
39 |
return $self;
|
40 |
}
|
41 |
|
42 |
sub build
|
43 |
{
|
44 |
my $self=shift;
|
45 |
my $dir=shift;
|
46 |
|
47 |
# Get the full directory path:
|
48 |
my $fulldir=$self->{area}->location()."/".$dir;
|
49 |
|
50 |
# Check that the build dir exists:
|
51 |
if ( ! -d $fulldir )
|
52 |
{
|
53 |
$self->{buildreport}->error("$dir does not exist");
|
54 |
$self->{buildreport}->status(1); # set to fail
|
55 |
}
|
56 |
else
|
57 |
{
|
58 |
chdir $fulldir;
|
59 |
# -- initialise BuildSystem if we dont already have it
|
60 |
if ( ! defined $self->{bs} )
|
61 |
{
|
62 |
$self->{bs}=BuildSystem::BuildSetup->new($self->{toolbox});
|
63 |
}
|
64 |
$self->verbose("Calling build module with $dir, @_");
|
65 |
my $rv=$self->{bs}->BuildDir($dir,@_);
|
66 |
$self->{buildreport}->status($rv);
|
67 |
}
|
68 |
return $self->{buildreport};
|
69 |
}
|