Moved the build number functions around, and integrated cls's build number changes. FILES NOT PART OF BUILD.

This commit is contained in:
sfraser%netscape.com 2000-10-20 23:17:38 +00:00
parent e8638320b3
commit 0cbb55c9c9
2 changed files with 81 additions and 93 deletions

View File

@ -1,6 +1,7 @@
=head1 NAME
B<Moz> - routines for automating CodeWarrior builds, and some extra-curricular activities related to building Mozilla
B<Moz> - routines for automating CodeWarrior builds, and some extra-curricular
activities related to building Mozilla
=head1 SYNOPSIS
@ -21,7 +22,10 @@ B<Moz> - routines for automating CodeWarrior builds, and some extra-curricular a
=head1 DESCRIPTION
B<Moz> 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<Moz> 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 (<BDATE>) {
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 (<BDATE>) {
$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 (<ORIGFILE>) {
$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();

View File

@ -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;