From 0cbb55c9c9ec3cf4e8af64dd73be39a60ac4654a Mon Sep 17 00:00:00 2001 From: "sfraser%netscape.com" Date: Fri, 20 Oct 2000 23:17:38 +0000 Subject: [PATCH] Moved the build number functions around, and integrated cls's build number changes. FILES NOT PART OF BUILD. --- build/mac/build_scripts/Moz.pm | 87 +++++------------------- build/mac/build_scripts/MozBuildUtils.pm | 87 ++++++++++++++++++------ 2 files changed, 81 insertions(+), 93 deletions(-) diff --git a/build/mac/build_scripts/Moz.pm b/build/mac/build_scripts/Moz.pm index 21337c25016e..f6786c40b2af 100644 --- a/build/mac/build_scripts/Moz.pm +++ b/build/mac/build_scripts/Moz.pm @@ -1,6 +1,7 @@ =head1 NAME -B - routines for automating CodeWarrior builds, and some extra-curricular activities related to building Mozilla +B - routines for automating CodeWarrior builds, and some extra-curricular +activities related to building Mozilla =head1 SYNOPSIS @@ -21,7 +22,10 @@ B - routines for automating CodeWarrior builds, and some extra-curricular a =head1 DESCRIPTION -B comprises the routines needed to slap CodeWarrior around, force it to build a sequence of projects, report the results, and a few other things. +B comprises the routines needed to slap CodeWarrior around, force it +to build a sequence of projects, report the results, and a few other things. +This module should only contain functions that are generic to any build, +not just the Mozilla build. =cut @@ -56,9 +60,6 @@ use CodeWarriorLib; DontStopForErrors InstallFromManifest InstallResources - SetBuildNumber - SetAgentString - SetTimeBomb Delay ActivateApplication IsProcessRunning); @@ -421,73 +422,11 @@ sub InstallResources($;$;$) } } - -sub SetBuildNumber($$$) -{ - my($build_num_file, $build_gen_script, $files_to_touch) = @_; - - open (OUTPUT, ">$build_num_file") || die "could not open buildnumber"; - open (BDATE, "perl :mozilla:config:bdate.pl|"); - - while () { - print OUTPUT $_; - } - - close (BDATE); - close (OUTPUT); - - my($file); - foreach $file (@$files_to_touch) - { - print "Writing build number to $file\n"; - system ("perl $build_gen_script $file $build_num_file"); - } - } - -sub SetAgentString -{ - - open (BDATE, ":mozilla:config:build_number") || die "could not open buildnumber"; - - while () { - $build_number = $_; - } - - close (BDATE); - - open (ORIGFILE, ":mozilla:cmd:macfe:restext:custom.r") || die "no original file"; - open (OUTPUT, ">:mozilla:cmd:macfe:restext:agent.r") || die "no output file"; - - chop($build_number); - - while () { - - $tempstring = $_; - if ($tempstring =~ "\#define VERSION_MAJOR_STR") { - $tempstring = "\#define VERSION_MAJOR_STR \"5.0a1-" . $build_number . " Development\"\n"; - } - print OUTPUT $tempstring; - } - - close (ORIGFILE); - close (OUTPUT); - - unlink (":mozilla:cmd:macfe:restext:custom.r"); - rename (":mozilla:cmd:macfe:restext:agent.r", ":mozilla:cmd:macfe:restext:custom.r"); -} - -sub SetTimeBomb($$) - -{ - my ($warn_days, $bomb_days) = @_; - - system("perl :mozilla:config:mac-set-timebomb.pl $warn_days $bomb_days"); - -} - -sub Delay($) - +#//-------------------------------------------------------------------------------------------------- +#// Delay +#//-------------------------------------------------------------------------------------------------- +sub Delay($) { my ($delay_seconds) = @_; @@ -501,6 +440,9 @@ sub Delay($) } +#//-------------------------------------------------------------------------------------------------- +#// GetFileModDate +#//-------------------------------------------------------------------------------------------------- sub GetFileModDate($) { my($filePath)=@_; @@ -510,6 +452,9 @@ sub GetFileModDate($) } +#//-------------------------------------------------------------------------------------------------- +#// LaunchCodeWarrior +#//-------------------------------------------------------------------------------------------------- sub LaunchCodeWarrior() { my($cur_dir) = cwd(); diff --git a/build/mac/build_scripts/MozBuildUtils.pm b/build/mac/build_scripts/MozBuildUtils.pm index 7c8c597d5b78..64ddb56ca957 100644 --- a/build/mac/build_scripts/MozBuildUtils.pm +++ b/build/mac/build_scripts/MozBuildUtils.pm @@ -4,12 +4,14 @@ package MozBuildUtils; require 5.004; require Exporter; -# Package that attempts to read a file from the Preferences folder, -# and get build settings out of it +# Package that contains build util functions specific to the Mozilla build +# process. use strict; use Exporter; +use Cwd; + use Mac::Events; use Mac::StandardFile; @@ -25,7 +27,9 @@ use vars qw(@ISA @EXPORT); AskAndPersistFile DelayFor EmptyTree - SetupBuildLog); + SetupBuildLog + SetBuildNumber + SetTimeBomb); #-------------------------------------------------------------------------------------------------- @@ -253,27 +257,66 @@ sub EmptyTree($) #----------------------------------------------- sub SetupBuildLog($) { - my($timestamped_log) = @_; + my($timestamped_log) = @_; + + if ($timestamped_log) + { + #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 + } +} + +#----------------------------------------------- +# SetBuildNumber +#----------------------------------------------- +sub SetBuildNumber($$) +{ + my($build_num_file, $files_to_touch) = @_; + + # Make sure we add the config dir to search, to pick up mozBDate.pm + # Need to do this dynamically, because this module can be used before + # mozilla/config has been checked out. + + my ($inc_path) = $0; # $0 is the path to the parent script + $inc_path =~ s/:build:mac:build_scripts:.+$/:config/; + push(@INC, $inc_path); + + require mozBDate; + + mozBDate::UpdateBuildNumber($build_num_file, $main::MOZILLA_OFFICIAL); + + my($file); + foreach $file (@$files_to_touch) + { + print "Writing build number to $file from ${file}.in\n"; + mozBDate::SubstituteBuildNumber($file, $build_num_file, "${file}.in"); + } +} + +#----------------------------------------------- +# SetBuildNumber +#----------------------------------------------- +sub SetTimeBomb($$) +{ + my ($warn_days, $bomb_days) = @_; - if ($timestamped_log) - { - #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 - } + system("perl :mozilla:config:mac-set-timebomb.pl $warn_days $bomb_days"); } + 1; +