#65293# changed -from behaviour

This commit is contained in:
Vladimir Glazounov 2001-08-31 14:27:12 +00:00
parent df1f2aa455
commit 33ef22a50e

View file

@ -5,9 +5,9 @@ eval 'exec perl -wS $0 ${1+"$@"}'
# #
# $RCSfile: build.pl,v $ # $RCSfile: build.pl,v $
# #
# $Revision: 1.34 $ # $Revision: 1.35 $
# #
# last change: $Author: vg $ $Date: 2001-08-27 09:30:11 $ # last change: $Author: vg $ $Date: 2001-08-31 15:27:12 $
# #
# The Contents of this file are made available subject to the terms of # The Contents of this file are made available subject to the terms of
# either of the following licenses # either of the following licenses
@ -73,7 +73,7 @@ use Cwd;
( $script_name = $0 ) =~ s/^.*\b(\w+)\.pl$/$1/; ( $script_name = $0 ) =~ s/^.*\b(\w+)\.pl$/$1/;
$id_str = ' $Revision: 1.34 $ '; $id_str = ' $Revision: 1.35 $ ';
$id_str =~ /Revision:\s+(\S+)\s+\$/ $id_str =~ /Revision:\s+(\S+)\s+\$/
? ($script_rev = $1) : ($script_rev = "-"); ? ($script_rev = $1) : ($script_rev = "-");
@ -95,7 +95,7 @@ $deliver = 0;
%PlatformHash = (); %PlatformHash = ();
%DeadDependencies = (); %DeadDependencies = ();
%AliveDependencies = (); %AliveDependencies = ();
%ParentDepsHash = (); %ParentDepsHash = (); # hash of dependencies of the current project
@UnresolvedParents = (); @UnresolvedParents = ();
@dmake_args = (); @dmake_args = ();
%DeadParents = (); %DeadParents = ();
@ -132,51 +132,45 @@ $ENV{mk_tmp} = "";
# Get dependencies hash of the current and all parent projects # Get dependencies hash of the current and all parent projects
# #
sub GetParentDeps { sub GetParentDeps {
my ($ParentsString, @DepsArray, $Prj, $Parent, @TotenEltern); my ($ParentsString, @DepsArray, $Prj, $parent);
$ParentsString = GetParentsString("."); my $prj_dir = shift;
@DepsArray = GetDependenciesArray($ParentsString); my $deps_hash = shift;
$ParentsString = &GetParentsString($prj_dir);
@DepsArray = &GetDependenciesArray($ParentsString);
@UnresolvedParents = @DepsArray; @UnresolvedParents = @DepsArray;
$ParentDepsHash{$CurrentPrj} = [@DepsArray]; $$deps_hash{$CurrentPrj} = [@DepsArray];
ResolveParentsLoop:
while ($Prj = pop(@UnresolvedParents)) { while ($Prj = pop(@UnresolvedParents)) {
my (@DepsArray); my (@DepsArray);
if (!($ParentsString = GetParentsString($StandDir.$Prj))) { if (!($ParentsString = &GetParentsString($StandDir.$Prj))) {
$DeadParents{$Prj} = 1; $DeadParents{$Prj} = 1;
$ParentDepsHash{$Prj} = []; $$deps_hash{$Prj} = [];
next ResolveParentsLoop; next;
}; };
@DepsArray = GetDependenciesArray($ParentsString, $Prj); @DepsArray = &GetDependenciesArray($ParentsString, $Prj);
$ParentDepsHash{$Prj} = [@DepsArray]; $$deps_hash{$Prj} = [@DepsArray];
foreach $Parent (@DepsArray) { foreach $Parent (@DepsArray) {
if (!defined($ParentDepsHash{$Parent})) { if (!defined($$deps_hash{$Parent})) {
push (@UnresolvedParents, $Parent); push (@UnresolvedParents, $Parent);
}; };
}; };
}; };
print "\n"; foreach $parent (keys %DeadParents) {
@TotenEltern = keys %DeadParents; delete $ParentDepsHash{$parent};
foreach $Parent (@TotenEltern) { &RemoveFromDependencies($parent, $deps_hash);
RemoveFromDependencies($Parent, %ParentDepsHash);
}; };
}; };
# #
# Build everything that should be built # Build everything that should be built
# #
sub BuildAll { sub BuildAll {
if ($BuildAllParents) { if ($BuildAllParents) {
my ($Prj, $PrjDir, $DeadPrj, @TotenEltern); my ($Prj, $PrjDir, $DeadPrj);
GetParentDeps(); &GetParentDeps('.' ,\%ParentDepsHash);
@TotenEltern = keys %DeadParents;
foreach $DeadPrj (@TotenEltern) {
delete $ParentDepsHash{$DeadPrj};
RemoveFromDependencies($DeadPrj, \%ParentDepsHash);
};
if ($build_from) { if ($build_from) {
&remove_extra_prjs(\%ParentDepsHash); &remove_extra_prjs(\%ParentDepsHash);
}; };
while ($Prj = PickPrjToBuild(\%ParentDepsHash)) { while ($Prj = &PickPrjToBuild(\%ParentDepsHash)) {
print "\n=============\n"; print "\n=============\n";
print "Building project $Prj\n"; print "Building project $Prj\n";
print "=============\n"; print "=============\n";
@ -195,7 +189,6 @@ sub BuildAll {
}; };
}; };
# #
# Start build given project # Start build given project
# #
@ -223,7 +216,7 @@ sub MakeDir {
exit(1); exit(1);
}; };
} else { } else {
RemoveFromDependencies($DirToBuild, \%LocalDepsHash); &RemoveFromDependencies($DirToBuild, \%LocalDepsHash);
}; };
}; };
@ -239,7 +232,7 @@ sub GetParentsString {
}; };
while (<PrjBuildFile>) { while (<PrjBuildFile>) {
s/\r\n//; s/\r\n//;
if ($_ =~ /([\:]+)([\t | \s]+)/) { if ($_ =~ /\:+\s+/) {
close PrjBuildFile; close PrjBuildFile;
return $'; return $';
}; };
@ -416,7 +409,6 @@ sub get_stand_dir {
while (chdir '..'); while (chdir '..');
}; };
# #
# Build the entire project according to queue of dependencies # Build the entire project according to queue of dependencies
# #
@ -428,27 +420,20 @@ sub BuildDependent {
}; };
}; };
# #
# Removes projects which it is not necessary to build # Removes projects which it is not necessary to build
# #
sub remove_extra_prjs { sub remove_extra_prjs {
my ($Prj, $DepsHash, @build_from_deps); my ($prj, $deps_hash);
$DepsHash = shift; $deps_hash = shift;
if (!(defined ($$DepsHash{$build_from}))) { my %from_deps_hash = (); # hash of dependencies of the -from project
print "No direct dependency to or no project $build_from found\n"; &GetParentDeps( $StandDir.$build_from,\%from_deps_hash);
exit (1); foreach $prj (keys %from_deps_hash) {
delete $$deps_hash{$prj};
&RemoveFromDependencies($prj, $deps_hash);
}; };
delete $$DepsHash{$build_from};
while ($Prj = FindIndepPrj($DepsHash)) {
RemoveFromDependencies($Prj, $DepsHash);
delete $$DepsHash{$Prj};
};
$$DepsHash{$build_from} = ();
$is_from_built = 1;
}; };
# #
# Picks project which can be build now from hash and deletes it from hash # Picks project which can be build now from hash and deletes it from hash
# #