From 52d8908ce7db321e8ba26d1988ec4a462397ec00 Mon Sep 17 00:00:00 2001 From: "mcmullen%netscape.com" Date: Mon, 10 May 1999 23:01:39 +0000 Subject: [PATCH] Added option to Macintosh build scripts, to delete all the dist aliases or just all the dist library aliases. git-svn-id: svn://10.0.0.236/trunk@31020 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/build/mac/BuildNGLayout.pl | 4 ++ mozilla/build/mac/BuildNGLayoutDebug.pl | 34 +++++++---- mozilla/build/mac/NGLayoutBuildList.pm | 64 +++++++++++++++++---- mozilla/build/mac/PullBuildNGLayout.pl | 4 ++ mozilla/build/mac/PullBuildNGLayoutDebug.pl | 4 ++ mozilla/build/mac/TinderboxNGLayout.pl | 4 ++ mozilla/build/mac/TinderboxNGLayoutOpt.pl | 4 ++ 7 files changed, 96 insertions(+), 22 deletions(-) diff --git a/mozilla/build/mac/BuildNGLayout.pl b/mozilla/build/mac/BuildNGLayout.pl index 02ca12614a2..e0ef30e965f 100644 --- a/mozilla/build/mac/BuildNGLayout.pl +++ b/mozilla/build/mac/BuildNGLayout.pl @@ -31,6 +31,10 @@ $ALIAS_SYM_FILES = $DEBUG; $CLOBBER_LIBS = 1; $MOZ_FULLCIRCLE = 0; +# The following two options will delete all files, but leave the directory structure intact. +$CLOBBER_DIST_ALL = 0; # turn on to clobber all files inside dist (headers, xsym and libs) +$CLOBBER_DIST_LIBS = 0; # turn on to clobber the aliases to libraries and sym files in dist + $pull{all} = 0; $pull{lizard} = 0; $pull{xpcom} = 0; diff --git a/mozilla/build/mac/BuildNGLayoutDebug.pl b/mozilla/build/mac/BuildNGLayoutDebug.pl index 80067f7a9cb..95e95867b9e 100644 --- a/mozilla/build/mac/BuildNGLayoutDebug.pl +++ b/mozilla/build/mac/BuildNGLayoutDebug.pl @@ -30,6 +30,11 @@ $DEBUG = 1; $ALIAS_SYM_FILES = $DEBUG; $CLOBBER_LIBS = 1; # turn on to clobber existing libs and .xSYM files before # building each project + +# The following two options will delete all files, but leave the directory structure intact. +$CLOBBER_DIST_ALL = 0; # turn on to clobber all aliases/files inside dist (headers/xsym/libs) +$CLOBBER_DIST_LIBS = 0; # turn on to clobber only aliases/files for libraries/sym files in dist + $MOZ_FULLCIRCLE = 0; $pull{all} = 0; @@ -71,7 +76,7 @@ if ($build{most}) { ### Just uncomment/comment to get the ones you want (if "most" is selected). $build{dist} = 1; -# $build{stubs} = 1; + $build{stubs} = 1; $build{common} = 1; # Requires intl # $build{intl} = 1; $build{nglayout} = 1; @@ -94,18 +99,25 @@ if ($MOZ_FULLCIRCLE) $buildnum = Moz::SetBuildNumber(); } -#Use time-stamped names so that you don't clobber your previous log file! -my $now = localtime(); -while ($now =~ s@:@.@) {} # replace all colons by periods -my $logdir = ":Build Logs:"; -if (!stat($logdir)) +$USE_TIMESTAMPED_LOGS = 1; +if ($USE_TIMESTAMPED_LOGS) { - print "Creating directory $logdir\n"; - mkdir $logdir, 0777 || die "Couldn't create directory $logdir"; + #Use time-stamped names so that you don't clobber your previous log file! + my $now = localtime(); + while ($now =~ s@:@.@) {} # replace all colons by periods + my $logdir = ":Build Logs:"; + if (!stat($logdir)) + { + print "Creating directory $logdir\n"; + mkdir $logdir, 0777 || die "Couldn't create directory $logdir"; + } + OpenErrorLog("$logdir$now"); +} +else +{ + OpenErrorLog("NGLayoutBuildLog"); # Release build + #OpenErrorLog("Mozilla.BuildLog"); # Tinderbox requires that name } - -OpenErrorLog("$logdir$now"); -#OpenErrorLog("Mozilla.BuildLog"); # Tinderbox requires that name Moz::StopForErrors(); #Moz::DontStopForErrors(); diff --git a/mozilla/build/mac/NGLayoutBuildList.pm b/mozilla/build/mac/NGLayoutBuildList.pm index 9497feedf86..142fecc6cce 100644 --- a/mozilla/build/mac/NGLayoutBuildList.pm +++ b/mozilla/build/mac/NGLayoutBuildList.pm @@ -103,7 +103,7 @@ sub _getDistDirectory() #//-------------------------------------------------------------------------------------------------- -#// Checkout everything +#// Check out everything #//-------------------------------------------------------------------------------------------------- sub Checkout() @@ -134,6 +134,41 @@ sub Checkout() } } +#//-------------------------------------------------------------------------------------------------- +#// Remove all files from a tree, leaving directories intact (except "CVS"). +#//-------------------------------------------------------------------------------------------------- + +sub EmptyTree($) +{ + my ($root) = @_; + #print "EmptyTree($root)\n"; + opendir(DIR, $root); + my $sub; + foreach $sub (readdir(DIR)) + { + my $fullpathname = $root.$sub; # -f, -d only work on full paths + if (-d $fullpathname) #if it's a directory (returns true for the alias of a directory, false for a broken alias) + { + EmptyTree($fullpathname.":"); + if ($sub eq "CVS") + { + #print "rmdir $fullpathname\n"; + rmdir $fullpathname; + } + } + else + { + #print "\tunlink $fullpathname\n"; + my $cnt = unlink $fullpathname; # this is perlspeak for deleting a file. + if ($cnt ne 1) + { + print "Failed to delete $fullpathname"; + die; + } + } + } + closedir(DIR); +} #//-------------------------------------------------------------------------------------------------- #// Build the 'dist' directory @@ -147,22 +182,29 @@ sub BuildDist() # activate MacPerl ActivateApplication('McPL'); + my $distdirectory = ":mozilla:dist"; # the parent directory in dist, including all the headers + my $dist_dir = _getDistDirectory(); # the subdirectory with the libs and executable. + if ($main::CLOBBER_DIST_ALL) + { + print "Clobbering ALL files inside :mozilla:dist:\n"; + EmptyTree($distdirectory); + } + else + { + if ($main::CLOBBER_DIST_LIBS) + { + print "Clobbering library aliases and executables inside ".$dist_dir."\n"; + EmptyTree($dist_dir); + } + } + # we really do not need all these paths, but many client projects include them mkpath([ ":mozilla:dist:", ":mozilla:dist:client:", ":mozilla:dist:client_debug:", ":mozilla:dist:client_stubs:" ]); mkpath([ ":mozilla:dist:viewer:", ":mozilla:dist:viewer_debug:" ]); - my($distdirectory) = ":mozilla:dist"; - if ($main::MOZ_FULLCIRCLE) { - if ( $main::DEBUG ) - { - mkpath([ "$distdirectory:viewer_debug:TalkBack"]); - } - else - { - mkpath([ "$distdirectory:viewer:TalkBack"]); - } + mkpath([ $dist_dir."TalkBack"]); } #MAC_COMMON diff --git a/mozilla/build/mac/PullBuildNGLayout.pl b/mozilla/build/mac/PullBuildNGLayout.pl index 3d8d3634115..e47e97bdfe3 100644 --- a/mozilla/build/mac/PullBuildNGLayout.pl +++ b/mozilla/build/mac/PullBuildNGLayout.pl @@ -31,6 +31,10 @@ $ALIAS_SYM_FILES = $DEBUG; $CLOBBER_LIBS = 0; $MOZ_FULLCIRCLE = 0; +# The following two options will delete all files, but leave the directory structure intact. +$CLOBBER_DIST_ALL = 0; # turn on to clobber all files inside dist (headers, xsym and libs) +$CLOBBER_DIST_LIBS = 0; # turn on to clobber the aliases to libraries and sym files in dist + $pull{all} = 1; $pull{lizard} = 0; $pull{xpcom} = 0; diff --git a/mozilla/build/mac/PullBuildNGLayoutDebug.pl b/mozilla/build/mac/PullBuildNGLayoutDebug.pl index a61481d777c..8c13de2f3a0 100644 --- a/mozilla/build/mac/PullBuildNGLayoutDebug.pl +++ b/mozilla/build/mac/PullBuildNGLayoutDebug.pl @@ -32,6 +32,10 @@ $CLOBBER_LIBS = 1; # turn on to clobber existing libs and .xSYM files before # building each project $MOZ_FULLCIRCLE = 0; +# The following two options will delete all files, but leave the directory structure intact. +$CLOBBER_DIST_ALL = 0; # turn on to clobber all files inside dist (headers, xsym and libs) +$CLOBBER_DIST_LIBS = 0; # turn on to clobber the aliases to libraries and sym files in dist + $pull{all} = 1; $pull{lizard} = 0; $pull{xpcom} = 0; diff --git a/mozilla/build/mac/TinderboxNGLayout.pl b/mozilla/build/mac/TinderboxNGLayout.pl index ec13b174880..84e9ef9ecaa 100644 --- a/mozilla/build/mac/TinderboxNGLayout.pl +++ b/mozilla/build/mac/TinderboxNGLayout.pl @@ -32,6 +32,10 @@ $ALIAS_SYM_FILES = 0; $CLOBBER_LIBS = 1; $MOZ_FULLCIRCLE = 0; +# The following two options will delete all files, but leave the directory structure intact. +$CLOBBER_DIST_ALL = 0; # turn on to clobber all files inside dist (headers, xsym and libs) +$CLOBBER_DIST_LIBS = 0; # turn on to clobber the aliases to libraries and sym files in dist + $pull{all} = 0; $pull{lizard} = 0; $pull{xpcom} = 0; diff --git a/mozilla/build/mac/TinderboxNGLayoutOpt.pl b/mozilla/build/mac/TinderboxNGLayoutOpt.pl index d2bbe9caec4..6c629a8f5e5 100644 --- a/mozilla/build/mac/TinderboxNGLayoutOpt.pl +++ b/mozilla/build/mac/TinderboxNGLayoutOpt.pl @@ -32,6 +32,10 @@ $ALIAS_SYM_FILES = 0; $CLOBBER_LIBS = 1; $MOZ_FULLCIRCLE = 0; +# The following two options will delete all files, but leave the directory structure intact. +$CLOBBER_DIST_ALL = 0; # turn on to clobber all files inside dist (headers, xsym and libs) +$CLOBBER_DIST_LIBS = 0; # turn on to clobber the aliases to libraries and sym files in dist + $pull{all} = 1; $pull{lizard} = 0; $pull{xpcom} = 0;