From 6bde6a1e75c0159cd3b79a7a8a75f1bf51308f7c Mon Sep 17 00:00:00 2001 From: "sfraser%netscape.com" Date: Wed, 6 Dec 2000 22:09:50 +0000 Subject: [PATCH] Adding options to not use the progress file, and optimize project opening in codewarrior. Bug 61401, r=scc, sr=jj git-svn-id: svn://10.0.0.236/trunk@83328 18797224-902f-48f8-a5cc-f745e15eee43 --- .../build/mac/build_scripts/Moz/BuildCore.pm | 135 +++++++++++++++--- .../build/mac/build_scripts/Moz/BuildFlags.pm | 46 +++--- .../build/mac/build_scripts/Moz/BuildUtils.pm | 5 +- 3 files changed, 151 insertions(+), 35 deletions(-) diff --git a/mozilla/build/mac/build_scripts/Moz/BuildCore.pm b/mozilla/build/mac/build_scripts/Moz/BuildCore.pm index 1b43ee1bd3a..6026d440fdb 100644 --- a/mozilla/build/mac/build_scripts/Moz/BuildCore.pm +++ b/mozilla/build/mac/build_scripts/Moz/BuildCore.pm @@ -10,6 +10,7 @@ use vars qw( @ISA @EXPORT ); # perl includes use Cwd; use File::Basename; +use LWP::Simple; # homegrown use Moz::Moz; @@ -22,7 +23,9 @@ use Moz::CodeWarriorLib; @ISA = qw(Exporter); -@EXPORT = qw(RunBuild); +@EXPORT = qw( + RunBuild + ); #//-------------------------------------------------------------------------------------------------- @@ -219,14 +222,90 @@ sub getScriptFolder() } +#//-------------------------------------------------------------------------------------------------- +#// getScriptFolder +#//-------------------------------------------------------------------------------------------------- +sub get_url_contents($) +{ + my($url) = @_; + + my($url_contents) = LWP::Simple::get($url); + $url_contents =~ s/\r\n/\n/g; # normalize linebreaks + $url_contents =~ s/\r/\n/g; # normalize linebreaks + return $url_contents; +} + +#//-------------------------------------------------------------------------------------------------- +#// get_files_from_content +#//-------------------------------------------------------------------------------------------------- +sub uniq +{ + my $lastval; + grep(($_ ne $lastval, $lastval = $_)[$[], @_); +} + + +#//-------------------------------------------------------------------------------------------------- +#// get_files_from_content +#//-------------------------------------------------------------------------------------------------- +sub get_files_from_content($) +{ + my($content) = @_; + + my(@jscalls) = grep (/return js_file_menu[^{]*/, split(/\n/, $content)); + my $i; + + for ($i = 0; $i < @jscalls ; $i++) + { + $jscalls[$i] =~ s/.*\(|\).*//g; + my(@callparams) = split(/,/, $jscalls[$i]); + my ($repos, $dir, $file, $rev) = grep(s/['\s]//g, @callparams); + $jscalls[$i] = "$dir/$file"; + } + + &uniq(sort(@jscalls)); +} + + +#//-------------------------------------------------------------------------------------------------- +#// FastUpdate +#// +#// Use Bonsai url data to update only those dirs which have new files +#// +#//-------------------------------------------------------------------------------------------------- +sub FastUpdate($) +{ + my($num_hours) = @_; + + my($the_module) = "SeaMonkeyAll"; + my($the_branch) = "HEAD"; + my($search_type) = "hours"; + my($min_date) = ""; + my($max_date) = ""; + my($url) = "http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=${the_module}&branch=${the_branch}&branchtype=match&dir=&file=&filetype=match&who=&whotype=match&sortby=Date&hours=${num_hours}&date=${search_type}&mindate=${min_date}&maxdate=${max_date}&cvsroot=%2Fcvsroot"; + + my(@files) = &get_files_from_content(&get_url_contents($url)); + + my(@cvs_co_list); + + my($co_file); + foreach $co_file (@files) + { + my(@cvs_co) = ["", "", ""]; + @cvs_co[0] = $co_file; + push(@cvs_co_list, \@cvs_co); + } + + CheckoutModules(\@cvs_co_list); +} + + #//-------------------------------------------------------------------------------------------------- #// Checkout #//-------------------------------------------------------------------------------------------------- -sub Checkout($) +sub CheckoutModules($) { - my($checkout_list) = @_; - - unless ( $main::build{pull} ) { return; } + my($modules) = @_; # list of modules to check out my($start_time) = TimeStart(); @@ -235,6 +314,29 @@ sub Checkout($) my($session) = Moz::MacCVS->new( $cvsfile ); unless (defined($session)) { die "Error: Checkout aborted. Cannot create session file: $session" } + # activate MacCVS + ActivateApplication('Mcvs'); + + my($this_co); + foreach $this_co (@$modules) + { + my($module, $revision, $date) = ($this_co->[0], $this_co->[1], $this_co->[2]); + CheckOutModule($session, $module, $revision, $date); + # print "Checking out $module with ref $revision, date $date\n"; + } + + TimeEnd($start_time, "Checkout"); +} + +#//-------------------------------------------------------------------------------------------------- +#// Checkout +#//-------------------------------------------------------------------------------------------------- +sub Checkout($) +{ + my($checkout_list) = @_; + + unless ( $main::build{pull} ) { return; } + StartBuildModule("pull"); my(@cvs_co_list); @@ -290,17 +392,8 @@ sub Checkout($) close(CHECKOUT_FILE); - # activate MacCVS - ActivateApplication('Mcvs'); + CheckoutModules(\@cvs_co_list); - my($this_co); - foreach $this_co (@cvs_co_list) - { - my($module, $revision, $date) = ($this_co->[0], $this_co->[1], $this_co->[2]); - CheckOutModule($session, $module, $revision, $date); - } - - TimeEnd($start_time, "Checkout"); EndBuildModule("pull"); } @@ -333,6 +426,9 @@ sub RunBuild($$$$) $main::build{"pull"} = 1; } + # transfer this flag + $CodeWarriorLib::CLOSE_PROJECTS_FIRST = $main::CLOSE_PROJECTS_FIRST; + # setup the build log SetupBuildLog($main::filepaths{"buildlogfilepath"}, $main::USE_TIMESTAMPED_LOGS); StopForErrors(); @@ -343,7 +439,14 @@ sub RunBuild($$$$) # run a pre-build check to see that the tools etc are in order DoPrebuildCheck(); - Checkout($input_files->{"checkoutdata"}); + + if ($main::FAST_UPDATE) + { + my($hours) = 8; # update files checked in during last 8 hours + FastUpdate($hours); + } else { + Checkout($input_files->{"checkoutdata"}); + } unless ($do_build) { return; } diff --git a/mozilla/build/mac/build_scripts/Moz/BuildFlags.pm b/mozilla/build/mac/build_scripts/Moz/BuildFlags.pm index ce0d282dc54..e3954231054 100644 --- a/mozilla/build/mac/build_scripts/Moz/BuildFlags.pm +++ b/mozilla/build/mac/build_scripts/Moz/BuildFlags.pm @@ -148,7 +148,7 @@ sub flagsArrayToHash($$) #----------------------------------------------- sub printHash($) { - my($hash_ref) = @_; + my($hash_ref) = @_; print "Printing hash:\n"; @@ -216,8 +216,8 @@ sub SetOptionDefines($) my($optiondefines) = @_; # These should remain unchanged - $optiondefines->{"mathml"}{"MOZ_MATHML"} = 1; - $optiondefines->{"svg"}{"MOZ_SVG"} = 1; + $optiondefines->{"mathml"}{"MOZ_MATHML"} = 1; + $optiondefines->{"svg"}{"MOZ_SVG"} = 1; } @@ -260,23 +260,16 @@ sub setBuildProgressStart($$) { my($build_array, $name) = @_; - my($setting) = 0; my($index); foreach $index (@$build_array) { - $index->[1] = 0; # $setting; - + $index->[1] = 0; if ($index->[0] eq $name) { - # $setting = 1; last; } } - if ($setting == 1) { - print "Building from module after $name, as specified by build progress\n"; - } else { - printf "Failed to find buildfrom setting '$name'\n"; - } + print "Building from module after $name, as specified by build progress\n"; } #//-------------------------------------------------------------------------------------------------- @@ -300,9 +293,12 @@ sub WriteBuildProgress($) my($progress_file) = _getBuildProgressFile(); - open(PROGRESS_FILE, ">>$progress_file") || die "Failed to open $progress_file\n"; - print(PROGRESS_FILE "$module_built\n"); - close(PROGRESS_FILE); + if ($progress_file ne "") + { + open(PROGRESS_FILE, ">>$progress_file") || die "Failed to open $progress_file\n"; + print(PROGRESS_FILE "$module_built\n"); + close(PROGRESS_FILE); + } } @@ -312,7 +308,19 @@ sub WriteBuildProgress($) sub ClearBuildProgress() { my($progress_file) = _getBuildProgressFile(); - unlink $progress_file; + if ($progress_file ne "") { + unlink $progress_file; + } +} + +#//-------------------------------------------------------------------------------------------------- +#// WipeBuildProgress +#//-------------------------------------------------------------------------------------------------- +sub WipeBuildProgress() +{ + print "Ignoring build progress\n"; + ClearBuildProgress(); + $progress_file = ""; } #//-------------------------------------------------------------------------------------------------- @@ -386,7 +394,11 @@ sub SetupBuildParams($$$$$$) ReadMozUserPrefs($prefs_file, \@build_flags, \@options_flags, \@filepath_flags); # If build progress exists, this clears flags in the array up to a certain point - ReadBuildProgress(\@build_flags); + if ($main::USE_BUILD_PROGRESS) { + ReadBuildProgress(\@build_flags); + } else { + WipeBuildProgress(); + } # printBuildArray(\@build_flags); # printBuildArray(\@options_flags); diff --git a/mozilla/build/mac/build_scripts/Moz/BuildUtils.pm b/mozilla/build/mac/build_scripts/Moz/BuildUtils.pm index 98c9868f74c..663cb84c608 100644 --- a/mozilla/build/mac/build_scripts/Moz/BuildUtils.pm +++ b/mozilla/build/mac/build_scripts/Moz/BuildUtils.pm @@ -88,10 +88,11 @@ sub SetupDefaultBuildOptions($$) # configuration variables that are preferences for the build, # style and do not affect what is built. #------------------------------------------------------------- - $main::Moz::CodeWarriorLib::CLOSE_PROJECTS_FIRST = 1; + $main::CLOSE_PROJECTS_FIRST = 0; # 1 = close then make (for development), # 0 = make then close (for tinderbox). $main::USE_TIMESTAMPED_LOGS = 0; + $main::USE_BUILD_PROGRESS = 1; # track build progress for restartable builds #------------------------------------------------------------- # END OF CONFIG SWITCHES #------------------------------------------------------------- @@ -185,7 +186,7 @@ sub AskAndPersistFile($) } else { - print STDERR "Could not open storage file\n"; + print STDERR "Could not open storage file $sessionStorage for saving $cvsfile\n"; } } }