mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Changes to allow for pref-file override of default file locations for the CodeWarrior and CVS session location files. NOT PART OF THE BUILD
This commit is contained in:
parent
8cbce5fe63
commit
4b7fbdf56e
@ -50,6 +50,7 @@ use MozillaBuildList;
|
||||
my(%pull);
|
||||
my(%build);
|
||||
my(%options);
|
||||
my(%filepaths);
|
||||
my(%optiondefines);
|
||||
|
||||
#-------------------------------------------------------------
|
||||
|
@ -51,6 +51,7 @@ use MozillaBuildList;
|
||||
my(%pull);
|
||||
my(%build);
|
||||
my(%options);
|
||||
my(%filepaths);
|
||||
my(%optiondefines);
|
||||
|
||||
#-------------------------------------------------------------
|
||||
|
@ -40,6 +40,7 @@ $VERSION = '1.02';
|
||||
|
||||
my($app) = 'CWIE';
|
||||
my($scriptDir) = cwd(); # could use $0 for this
|
||||
my($ide_loc_file) = "";
|
||||
|
||||
# 0 == don't switch CWIE to front app in do_event(), 1 == do switch
|
||||
# note: activate() still switches when called
|
||||
@ -223,7 +224,7 @@ sub _appIsFrontmost($)
|
||||
|
||||
Launches CodeWarrior and brings it to the front.
|
||||
|
||||
Once found, path will be saved in ':idepath.txt' for future reference.
|
||||
Once found, path will be saved in $idepath_file for future reference.
|
||||
Edit or delete this file to change the location of the IDE. If app is
|
||||
moved, C<activate()> will prompt for a new location.
|
||||
|
||||
@ -234,9 +235,11 @@ GUSI routines built-in to MacPerl for a Choose Directory dialog box.
|
||||
|
||||
=cut
|
||||
|
||||
sub activate () {
|
||||
local(*F);
|
||||
my($filepath, $appath, $psi) = (':idepath.txt');
|
||||
sub activate ($) {
|
||||
|
||||
$ide_loc_file = @_[0]; # save in global
|
||||
|
||||
my($filepath, $appath, $psi) = ($ide_loc_file);
|
||||
|
||||
foreach $psi (values(%Process)) {
|
||||
if ($psi->processSignature() eq $app) {
|
||||
@ -336,7 +339,7 @@ sub getCodeWarriorPath($)
|
||||
{
|
||||
my($subfolder)=@_;
|
||||
|
||||
my($app_path) = _read_appath(":idepath.txt");
|
||||
my($app_path) = _read_appath($ide_loc_file);
|
||||
if ($app_path eq "") { die "Error: Failed to get CodeWarrior IDE path\n"; }
|
||||
|
||||
my($codewarrior_root) = $app_path;
|
||||
@ -357,7 +360,7 @@ sub getCodeWarriorIDEName()
|
||||
{
|
||||
my($subfolder)=@_;
|
||||
|
||||
my($app_path) = _read_appath(":idepath.txt");
|
||||
my($app_path) = _read_appath($ide_loc_file);
|
||||
if ($app_path eq "") { die "Error: Failed to get CodeWarrior IDE path\n"; }
|
||||
|
||||
my(@codewarrior_path) = split(/:/, $app_path);
|
||||
@ -480,6 +483,7 @@ sub _save_appath ($$) {
|
||||
my($cwd) = cwd(); # remember the current working dir
|
||||
chdir($scriptDir); # change dir to the script dir
|
||||
|
||||
local(*F);
|
||||
open(F, '>' . $_[0]) or die $!;
|
||||
print F $_[1];
|
||||
close(F);
|
||||
@ -497,6 +501,8 @@ sub _read_appath ($) {
|
||||
if (! -e $filepath) {
|
||||
return "";
|
||||
}
|
||||
|
||||
local(*F);
|
||||
open(F, $filepath);
|
||||
my($appath) = <F>;
|
||||
close(F);
|
||||
@ -507,7 +513,7 @@ sub _read_appath ($) {
|
||||
|
||||
|
||||
sub _test ($) {
|
||||
activate();
|
||||
activate($ide_loc_file);
|
||||
my($path) = $_[0];
|
||||
build_project(
|
||||
"${path}modules:xml:macbuild:XML.mcp", '',
|
||||
|
@ -456,12 +456,13 @@ sub GetFileModDate($)
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// LaunchCodeWarrior
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub LaunchCodeWarrior()
|
||||
sub LaunchCodeWarrior($)
|
||||
{
|
||||
my($idepath_file) = @_; # full path to IDE location file
|
||||
my($cur_dir) = cwd();
|
||||
|
||||
# this both launches and writes idepath.txt
|
||||
CodeWarriorLib::activate();
|
||||
# this both launches and writes the IDE path file
|
||||
CodeWarriorLib::activate($idepath_file);
|
||||
|
||||
chdir($cur_dir);
|
||||
}
|
||||
|
@ -78,6 +78,14 @@ my(@options_flags) =
|
||||
);
|
||||
|
||||
|
||||
# all file paths are relative to the parent of the "mozilla" source directory.
|
||||
my(@filepath_flags) =
|
||||
(
|
||||
["idepath", ":Build IDE Path.txt"], # saved location of CodeWarrior IDE
|
||||
["sessionpath", ":Build session path.txt"] # saved location of MacCVS Pro session file
|
||||
);
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# End of build flags
|
||||
#-------------------------------------------------------------------------------
|
||||
@ -150,6 +158,16 @@ sub SetBuildOptions($)
|
||||
flagsArrayToHash(\@options_flags, $options);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# SetFilepathFlags
|
||||
#-------------------------------------------------------------------------------
|
||||
sub SetFilepathFlags($)
|
||||
{
|
||||
my($filepath) = @_;
|
||||
|
||||
flagsArrayToHash(\@filepath_flags, $filepath);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# SetOptionDefines
|
||||
#-------------------------------------------------------------------------------
|
||||
@ -189,7 +207,13 @@ sub PropagateAllFlags($)
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub _getBuildProgressFile()
|
||||
{
|
||||
my($progress_file) = $script_dir.":¥Build Progress";
|
||||
my($progress_file);
|
||||
|
||||
if ($main::DEBUG) {
|
||||
$progress_file = $script_dir.":¥Debug build Progress";
|
||||
} else {
|
||||
$progress_file = $script_dir.":¥Opt build Progress";
|
||||
}
|
||||
return $progress_file;
|
||||
}
|
||||
|
||||
@ -278,12 +302,12 @@ sub ReadBuildProgress($)
|
||||
#-------------------------------------------------------------------------------
|
||||
# SetupBuildParams
|
||||
#-------------------------------------------------------------------------------
|
||||
sub SetupBuildParams($$$$$)
|
||||
sub SetupBuildParams($$$$$$)
|
||||
{
|
||||
my($pull, $build, $options, $optiondefines, $prefs_file) = @_;
|
||||
my($pull, $build, $options, $optiondefines, $filepaths, $prefs_file) = @_;
|
||||
|
||||
# read the user pref file, that can change values in the array
|
||||
ReadMozUserPrefs($prefs_file, \@pull_flags, \@build_flags, \@options_flags);
|
||||
ReadMozUserPrefs($prefs_file, \@pull_flags, \@build_flags, \@options_flags, \@filepath_flags);
|
||||
|
||||
ReadBuildProgress(\@build_flags);
|
||||
|
||||
@ -293,6 +317,7 @@ sub SetupBuildParams($$$$$)
|
||||
SetBuildFlags($build);
|
||||
SetBuildOptions($options);
|
||||
SetOptionDefines($optiondefines);
|
||||
SetFilepathFlags($filepaths);
|
||||
|
||||
# printHash($build);
|
||||
}
|
||||
|
@ -306,21 +306,22 @@ sub SetupBuildLog($)
|
||||
{
|
||||
my($timestamped_log) = @_;
|
||||
|
||||
my $logdir = ":Build Logs:";
|
||||
if (! -d $logdir)
|
||||
{
|
||||
mkdir $logdir, 0777 || die "Couldn't create directory $logdir";
|
||||
}
|
||||
|
||||
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 (! -d $logdir)
|
||||
{
|
||||
mkdir $logdir, 0777 || die "Couldn't create directory $logdir";
|
||||
}
|
||||
OpenErrorLog("$logdir$now");
|
||||
OpenErrorLog("${logdir}${now}");
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenErrorLog("Mozilla build log");
|
||||
OpenErrorLog("${logdir}Mozilla build log");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,17 +71,24 @@ sub WriteDefaultPrefsFile($)
|
||||
% You can use this file to customize the Mozilla build system.
|
||||
% The following kinds of lines are allowable:
|
||||
% Comment lines, which start with a '%' in the first column
|
||||
% Lines which modify the default build settings. Examples are:
|
||||
% Lines which modify the default build settings. For the list of flags,
|
||||
% see MozBuildFlags.pm. Examples are:
|
||||
%
|
||||
% pull runtime 1 % just pull runtime
|
||||
% options mng 1 % turn mng on
|
||||
% build jars 0 % don't build jar files
|
||||
% pull runtime 1 % just pull runtime
|
||||
% options mng 1 % turn mng on
|
||||
% build jars 0 % don't build jar files
|
||||
%
|
||||
% Line containing the special 'buildfrom' flag, which specifies
|
||||
% where to start the build. Example:
|
||||
%
|
||||
% buildfrom nglayout % where to start the build
|
||||
%
|
||||
% Lines which specify the location of the files used to store paths
|
||||
% to the CodeWarrior IDE, and the MacCVS Pro session file. Examples:
|
||||
%
|
||||
% filepath idepath ::codewarrior.txt
|
||||
% filepath sessionpath :sessionpath.txt
|
||||
%
|
||||
% Lines which modify the build settings like %main::DEBUG.
|
||||
% Any lines which do not match either of the above are assumed
|
||||
% to set variables on $main::. Examples:
|
||||
@ -93,6 +100,8 @@ EOS
|
||||
|
||||
$file_contents =~ s/%/#/g;
|
||||
|
||||
local(*PREFS_FILE);
|
||||
|
||||
open(PREFS_FILE, "> $file_path") || die "Could not write default prefs file\n";
|
||||
print PREFS_FILE ($file_contents);
|
||||
close(PREFS_FILE);
|
||||
@ -111,7 +120,7 @@ sub HandlePrefSet($$$$)
|
||||
my($flags, $name, $value, $desc) = @_;
|
||||
|
||||
if (SetArrayValue($flags, $name, $value)) {
|
||||
print "Prefs set $desc flag $name to $value\n";
|
||||
print "Prefs set $desc flag '$name' to '$value'\n";
|
||||
} else {
|
||||
die "$desc setting '$name' is not a valid option\n";
|
||||
}
|
||||
@ -153,9 +162,11 @@ sub HandleBuildFromPref($$)
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub ReadPrefsFile($$$$)
|
||||
sub ReadPrefsFile($$$$$)
|
||||
{
|
||||
my($file_path, $pull_flags, $build_flags, $options_flags) = @_;
|
||||
my($file_path, $pull_flags, $build_flags, $options_flags, $filepath_flags) = @_;
|
||||
|
||||
local(*PREFS_FILE);
|
||||
|
||||
if (open(PREFS_FILE, "< $file_path"))
|
||||
{
|
||||
@ -169,7 +180,7 @@ sub ReadPrefsFile($$$$)
|
||||
next;
|
||||
}
|
||||
|
||||
if ($line =~ /^\s*(\w+)\s+(\w+)\s+(\w+)\s*/)
|
||||
if ($line =~ /^\s*(\w+)\s+(\w+)\s+([^\s]+)\s*/)
|
||||
{
|
||||
my($array_name) = $1;
|
||||
my($option_name) = $2;
|
||||
@ -187,6 +198,10 @@ sub ReadPrefsFile($$$$)
|
||||
{
|
||||
HandlePrefSet($options_flags, $option_name, $option_value, "Options");
|
||||
}
|
||||
elsif ($array_name eq "filepath" && $option_name && $option_value)
|
||||
{
|
||||
HandlePrefSet($filepath_flags, $option_name, $option_value, "Filepath");
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Unknown pref option at $line\n";
|
||||
@ -232,16 +247,16 @@ sub ReadPrefsFile($$$$)
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub ReadMozUserPrefs($$$$)
|
||||
sub ReadMozUserPrefs($$$$$)
|
||||
{
|
||||
my($prefs_file_name, $pull_flags, $build_flags, $options_flags) = @_;
|
||||
my($prefs_file_name, $pull_flags, $build_flags, $options_flags, $filepath_flags) = @_;
|
||||
|
||||
if ($prefs_file_name eq "") { return; }
|
||||
|
||||
my($prefs_path) = GetPrefsFolder();
|
||||
$prefs_path .= ":$prefs_file_name";
|
||||
|
||||
ReadPrefsFile($prefs_path, $pull_flags, $build_flags, $options_flags);
|
||||
ReadPrefsFile($prefs_path, $pull_flags, $build_flags, $options_flags, $filepath_flags);
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -121,6 +121,12 @@ sub GenBuildSystemInfo()
|
||||
sub DoPrebuildCheck()
|
||||
{
|
||||
SanityCheckJarOptions();
|
||||
|
||||
# launch codewarrior and persist its location. Have to call this before first
|
||||
# call to getCodeWarriorPath().
|
||||
my($ide_path_file) = $main::filepaths{"idepath"};
|
||||
$ide_path_file = full_path_to($ide_path_file);
|
||||
LaunchCodeWarrior($ide_path_file);
|
||||
}
|
||||
|
||||
|
||||
@ -194,9 +200,6 @@ sub UpdateConfigHeader($)
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub ConfigureBuildSystem()
|
||||
{
|
||||
# launch codewarrior and write idepath.txt. This is required for getCodeWarriorPath() to work.
|
||||
LaunchCodeWarrior();
|
||||
|
||||
#// In the future, we may want to do configurations based on the actual build system itself.
|
||||
#// GenBuildSystemInfo();
|
||||
|
||||
@ -1931,7 +1934,7 @@ sub Checkout()
|
||||
unless ( $main::pull{all} ) { return; }
|
||||
|
||||
assertRightDirectory();
|
||||
my($cvsfile) = AskAndPersistFile("::mozilla_session_path.txt");
|
||||
my($cvsfile) = AskAndPersistFile($main::filepaths{"sessionpath"});
|
||||
my($session) = MacCVS->new( $cvsfile );
|
||||
unless (defined($session)) { die "Checkout aborted. Cannot create session file: $session" }
|
||||
|
||||
@ -1989,7 +1992,12 @@ sub RunBuild($$$)
|
||||
}
|
||||
|
||||
# read local prefs, and the build progress file, and set flags to say what to build
|
||||
SetupBuildParams(\%main::pull, \%main::build, \%main::options, \%main::optiondefines, $build_prefs);
|
||||
SetupBuildParams(\%main::pull,
|
||||
\%main::build,
|
||||
\%main::options,
|
||||
\%main::optiondefines,
|
||||
\%main::filepaths,
|
||||
$build_prefs);
|
||||
|
||||
if ($main::LOG_TO_FILE) {
|
||||
RedirectOutputToFile("Mozilla script log");
|
||||
@ -2006,7 +2014,7 @@ sub RunBuild($$$)
|
||||
|
||||
# create generated headers
|
||||
ConfigureBuildSystem();
|
||||
|
||||
|
||||
chdir($main::MOZ_SRC);
|
||||
BuildDist();
|
||||
|
||||
|
@ -36,6 +36,7 @@ use MozillaBuildList;
|
||||
my(%pull);
|
||||
my(%build);
|
||||
my(%options);
|
||||
my(%filepaths);
|
||||
my(%optiondefines);
|
||||
|
||||
|
||||
@ -47,4 +48,4 @@ $MOZ_SRC = cwd();
|
||||
my($do_checkout) = 1;
|
||||
my($do_build) = 0;
|
||||
|
||||
RunBuild($do_checkout, $do_build, "");
|
||||
RunBuild($do_checkout, $do_build, "Pull prefs");
|
||||
|
Loading…
Reference in New Issue
Block a user