7 |
|
# |
8 |
|
# Interface |
9 |
|
# --------- |
10 |
< |
# new(ConfigArea) : A new Build object |
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); |
21 |
|
sub new { |
22 |
|
my $class=shift; |
23 |
|
my $self={}; |
23 |
– |
$self->{area}=shift; |
24 |
|
bless $self, $class; |
25 |
+ |
$self->{area}=shift; |
26 |
+ |
$self->{area}->copyenv(\%ENV); |
27 |
+ |
$ENV{LOCALTOP}=$self->{area}->location(); |
28 |
+ |
|
29 |
+ |
# -- set RELEASTOP |
30 |
+ |
my $rarea=$self->{area}->linkarea(); |
31 |
+ |
if ( ! defined $rarea ) { |
32 |
+ |
$ENV{RELEASETOP}=$ENV{LOCALTOP}; |
33 |
+ |
} |
34 |
+ |
else { |
35 |
+ |
$ENV{RELEASETOP}=$rarea->location(); |
36 |
+ |
} |
37 |
+ |
|
38 |
+ |
$self->verbose("LOCALTOP=".$ENV{LOCALTOP}); |
39 |
+ |
$self->verbose("RELEASETOP=".$ENV{RELEASETOP}); |
40 |
|
return $self; |
41 |
|
} |
42 |
|
|
46 |
|
|
47 |
|
# -- set up a report |
48 |
|
my $report=BuildSystem::BuildReport->new(); |
34 |
– |
$report->pass(0); # set to fail |
49 |
|
|
50 |
|
# -- interface with old system |
51 |
|
my $fulldir=$self->{area}->location()."/".$dir; |
52 |
|
if ( ! -d $fulldir ) { |
53 |
|
$report->error("$fulldir does not exist"); |
54 |
+ |
$report->status(1); # set to fail |
55 |
|
} |
56 |
|
else { |
57 |
|
chdir $fulldir; |
58 |
< |
my $bs=BuildSystem::BuildSetup->new($self->{area}); |
59 |
< |
$rv=$bs->BuildSetup($dir,@_); |
60 |
< |
$report->pass($rv); |
58 |
> |
# -- initialise BuildSystem if we dont already have it |
59 |
> |
if ( ! defined $self->{bs} ) { |
60 |
> |
$self->{bs}=BuildSystem::BuildSetup->new($self->{area}); |
61 |
> |
$self->{bs}->verbosity(1); |
62 |
> |
} |
63 |
> |
$self->verbose("Calling build module with $dir, @_"); |
64 |
> |
my $rv=$self->{bs}->BuildDir($dir,@_); |
65 |
> |
$report->status($rv); |
66 |
|
} |
67 |
|
return $report; |
68 |
|
} |