зеркало из https://github.com/mozilla/gecko-dev.git
#41854: obsoleting old build scripts and related files. r=sfraser
This commit is contained in:
Родитель
6f0df2ea45
Коммит
9f1e059c82
|
@ -1,223 +0,0 @@
|
|||
#!perl
|
||||
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
use Cwd;
|
||||
|
||||
# Make sure we add the config dir to search
|
||||
BEGIN
|
||||
{
|
||||
my ($inc_path) = cwd();
|
||||
$inc_path =~ s/:build:mac$/:config:/;
|
||||
push(@INC, $inc_path);
|
||||
}
|
||||
|
||||
#
|
||||
# build script (optimized)
|
||||
#
|
||||
use Mac::Processes;
|
||||
use NGLayoutBuildList;
|
||||
use Moz;
|
||||
|
||||
#-----------------------------------------------
|
||||
# configuration variables that globally affect what is built
|
||||
#-----------------------------------------------
|
||||
$DEBUG = 0;
|
||||
$CARBON = 0; # turn on to build with TARGET_CARBON
|
||||
$PROFILE = 0;
|
||||
$GC_LEAK_DETECTOR = 0; # turn on to use GC leak detection
|
||||
$INCLUDE_CLASSIC_SKIN = 1;
|
||||
$MOZILLA_OFFICIAL = 1;
|
||||
|
||||
$pull{all} = 0;
|
||||
$pull{moz} = 0;
|
||||
$pull{runtime} = 0;
|
||||
|
||||
$build{all} = 1; # turn off to do individual builds, or to do "most"
|
||||
$build{most} = 0; # turn off to do individual builds
|
||||
$build{dist} = 0;
|
||||
$build{dist_runtime} = 0; # implied by $build{dist}
|
||||
$build{xpidl} = 0;
|
||||
$build{idl} = 0;
|
||||
$build{stubs} = 0;
|
||||
$build{runtime} = 0;
|
||||
$build{common} = 0;
|
||||
$build{imglib} = 0;
|
||||
$build{necko} = 0;
|
||||
$build{security} = 0;
|
||||
$build{browserutils} = 0;
|
||||
$build{intl} = 0;
|
||||
$build{nglayout} = 0;
|
||||
$build{editor} = 0;
|
||||
$build{viewer} = 0;
|
||||
$build{xpapp} = 0;
|
||||
$build{extensions} = 1;
|
||||
$build{plugins} = 0;
|
||||
$build{mailnews} = 0;
|
||||
$build{apprunner} = 0;
|
||||
$build{resources} = 1;
|
||||
|
||||
$build{xptlink} = 0;
|
||||
|
||||
$options{transformiix} = 0;
|
||||
$options{mathml} = 0;
|
||||
$options{svg} = 0;
|
||||
$options{mng} = 1;
|
||||
$options{ldap} = 0;
|
||||
$options{xmlextras} = 0;
|
||||
$options{psm} = 0;
|
||||
|
||||
# -------------------------- Chrome and jar-related options -----------------------------------------
|
||||
|
||||
$options{jar_manifests} = 1; # use jar.mn files for resources, not MANIFESTs. This must be ON,
|
||||
# unless you want to use the obsolete (and probably bitrotted)
|
||||
# MANIFEST files to install resources.
|
||||
|
||||
|
||||
# These two options determine whether you get jar files, or loose files in chrome.
|
||||
# Either one or both option must be turned on.
|
||||
|
||||
$options{chrome_jars} = 1; # build jar files
|
||||
$options{chrome_files} = 0; # install regular files in chrome
|
||||
|
||||
$options{use_jars} = 1; # This option determines whether chrome comes out of jars
|
||||
# or regular files at runtime (by affecting installed-chrome.txt).
|
||||
# If 1, $options{chrome_jars} must be 1.
|
||||
|
||||
# ------------------------ End chrome and jar-related options ----------------------------------------
|
||||
|
||||
# Don't change these (where should they go?)
|
||||
$optiondefines{mathml}{MOZ_MATHML} = 1;
|
||||
$optiondefines{svg}{MOZ_SVG} = 1;
|
||||
|
||||
#-----------------------------------------------
|
||||
# configuration variables that affect the manner
|
||||
# of building, but possibly affecting
|
||||
# the outcome.
|
||||
#-----------------------------------------------
|
||||
$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 dist files (if you have $build{dist} turned on),
|
||||
# but leave the directory structure intact.
|
||||
$CLOBBER_DIST_ALL = 1; # 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
|
||||
$CLOBBER_IDL_PROJECTS = 0; # turn on to clobber all IDL projects.
|
||||
|
||||
#-----------------------------------------------
|
||||
# configuration variables that are preferences for the build style,
|
||||
# and do not affect what is built.
|
||||
#-----------------------------------------------
|
||||
$CodeWarriorLib::CLOSE_PROJECTS_FIRST
|
||||
= 0;
|
||||
# 1 = close then make (for development),
|
||||
# 0 = make then close (for tinderbox).
|
||||
$USE_TIMESTAMPED_LOGS = 0;
|
||||
#-----------------------------------------------
|
||||
# END OF CONFIG SWITCHES
|
||||
#-----------------------------------------------
|
||||
|
||||
if ($pull{all})
|
||||
{
|
||||
foreach $k (keys(%pull))
|
||||
{
|
||||
$pull{$k} = 1;
|
||||
}
|
||||
}
|
||||
if ($build{all})
|
||||
{
|
||||
foreach $k (keys(%build))
|
||||
{
|
||||
$build{$k} = 1;
|
||||
}
|
||||
}
|
||||
if ($build{most})
|
||||
{
|
||||
### Just uncomment/comment to get the ones you want (if "most" is selected).
|
||||
# $build{dist} = 0;
|
||||
# $build{dist_runtime} = 0; # Implied by $build{dist}
|
||||
# $build{xpidl} = 0;
|
||||
# $build{idl} = 0;
|
||||
# $build{stubs} = 0;
|
||||
# $build{runtime} = 1;
|
||||
# $build{common} = 1;
|
||||
# $build{imglib} = 1;
|
||||
# $build{necko} = 1;
|
||||
# $build{security} = 1;
|
||||
# $build{browserutils} = 1;
|
||||
# $build{intl} = 1;
|
||||
# $build{nglayout} = 1;
|
||||
# $build{editor} = 1;
|
||||
# $build{viewer} = 1;
|
||||
# $build{xpapp} = 1;
|
||||
# $build{extensions} = 1;
|
||||
# $build{plugins} = 1;
|
||||
# $build{mailnews} = 1;
|
||||
# $build{apprunner} = 1;
|
||||
# $build{resources} = 0;
|
||||
}
|
||||
|
||||
# do the work
|
||||
# you should not have to edit anything below
|
||||
|
||||
chdir("::::");
|
||||
$MOZ_SRC = cwd();
|
||||
|
||||
if ($USE_TIMESTAMPED_LOGS)
|
||||
{
|
||||
#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 requires that name
|
||||
#OpenErrorLog("Mozilla.BuildLog"); # Tinderbox requires that name
|
||||
}
|
||||
|
||||
Moz::StopForErrors();
|
||||
#Moz::DontStopForErrors();
|
||||
|
||||
Checkout();
|
||||
|
||||
ConfigureBuildSystem();
|
||||
|
||||
my(@gen_files) = (
|
||||
":mozilla:config:nsBuildID.h",
|
||||
":mozilla:xpfe:global:build.dtd"
|
||||
);
|
||||
SetBuildNumber(":mozilla:config:build_number", ":mozilla:config:aboutime.pl", \@gen_files);
|
||||
|
||||
chdir($MOZ_SRC);
|
||||
BuildDist();
|
||||
|
||||
chdir($MOZ_SRC);
|
||||
BuildProjects();
|
||||
|
||||
print "Build complete\n";
|
|
@ -1,219 +0,0 @@
|
|||
#!perl
|
||||
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
use Cwd;
|
||||
|
||||
# Make sure we add the config dir to search
|
||||
BEGIN
|
||||
{
|
||||
my ($inc_path) = cwd();
|
||||
$inc_path =~ s/:build:mac$/:config:/;
|
||||
push(@INC, $inc_path);
|
||||
}
|
||||
|
||||
#
|
||||
# build script (debug)
|
||||
#
|
||||
use Mac::Processes;
|
||||
use NGLayoutBuildList;
|
||||
use Moz;
|
||||
|
||||
$DEBUG = 1;
|
||||
$CARBON = 0; # Turn on to build with TARGET_CARBON
|
||||
$PROFILE = 0;
|
||||
$GC_LEAK_DETECTOR = 0; # turn on to use GC leak detection
|
||||
$INCLUDE_CLASSIC_SKIN = 1;
|
||||
|
||||
$pull{all} = 0;
|
||||
$pull{moz} = 0;
|
||||
$pull{runtime} = 0;
|
||||
|
||||
$build{all} = 1; # Turn off to do individual builds, or to do "most"
|
||||
$build{most} = 0; # Turn off to do individual builds
|
||||
$build{dist} = 0;
|
||||
$build{dist_runtime} = 0; # Implied by $build{dist}
|
||||
$build{xpidl} = 0;
|
||||
$build{idl} = 0;
|
||||
$build{stubs} = 0;
|
||||
$build{runtime} = 0;
|
||||
$build{common} = 0;
|
||||
$build{imglib} = 0;
|
||||
$build{necko} = 0;
|
||||
$build{security} = 0;
|
||||
$build{browserutils} = 0;
|
||||
$build{intl} = 0;
|
||||
$build{nglayout} = 0;
|
||||
$build{editor} = 0;
|
||||
$build{viewer} = 0;
|
||||
$build{xpapp} = 0;
|
||||
$build{extensions} = 1;
|
||||
$build{plugins} = 0;
|
||||
$build{mailnews} = 0;
|
||||
$build{apprunner} = 0;
|
||||
$build{resources} = 1;
|
||||
|
||||
$build{xptlink} = 0;
|
||||
|
||||
$options{transformiix} = 0;
|
||||
$options{mathml} = 0;
|
||||
$options{svg} = 0;
|
||||
$options{mng} = 1;
|
||||
$options{ldap} = 0;
|
||||
$options{xmlextras} = 0;
|
||||
$options{psm} = 0;
|
||||
|
||||
# -------------------------- Chrome and jar-related options -----------------------------------------
|
||||
|
||||
$options{jar_manifests} = 1; # use jar.mn files for resources, not MANIFESTs. This must be ON,
|
||||
# unless you want to use the obsolete (and probably bitrotted)
|
||||
# MANIFEST files to install resources.
|
||||
|
||||
|
||||
# These two options determine whether you get jar files, or loose files in chrome.
|
||||
# Either one or both option must be turned on.
|
||||
|
||||
$options{chrome_jars} = 1; # build jar files
|
||||
$options{chrome_files} = 0; # install regular files in chrome
|
||||
|
||||
$options{use_jars} = 1; # This option determines whether chrome comes out of jars
|
||||
# or regular files at runtime (by affecting installed-chrome.txt).
|
||||
# If 1, $options{chrome_jars} must be 1.
|
||||
|
||||
# ------------------------ End chrome and jar-related options ----------------------------------------
|
||||
|
||||
# Don't change these (where should they go?)
|
||||
$optiondefines{mathml}{MOZ_MATHML} = 1;
|
||||
$optiondefines{svg}{MOZ_SVG} = 1;
|
||||
|
||||
#-----------------------------------------------
|
||||
# configuration variables that affect the manner
|
||||
# of building, but possibly affecting
|
||||
# the outcome.
|
||||
#-----------------------------------------------
|
||||
$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 dist files (if you have $build{dist} turned on),
|
||||
# but leave the directory structure intact.
|
||||
$CLOBBER_DIST_ALL = 1; # 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
|
||||
$CLOBBER_IDL_PROJECTS = 0; # turn on to clobber all IDL projects.
|
||||
|
||||
#-----------------------------------------------
|
||||
# configuration variables that are preferences for the build style,
|
||||
# and do not affect what is built.
|
||||
#-----------------------------------------------
|
||||
$CodeWarriorLib::CLOSE_PROJECTS_FIRST
|
||||
= 1;
|
||||
# 1 = close then make (for development),
|
||||
# 0 = make then close (for tinderbox).
|
||||
$USE_TIMESTAMPED_LOGS = 1;
|
||||
#-----------------------------------------------
|
||||
# END OF CONFIG SWITCHES
|
||||
#-----------------------------------------------
|
||||
|
||||
if ($pull{all})
|
||||
{
|
||||
foreach $k (keys(%pull))
|
||||
{
|
||||
$pull{$k} = 1;
|
||||
}
|
||||
}
|
||||
if ($build{all})
|
||||
{
|
||||
foreach $k (keys(%build))
|
||||
{
|
||||
$build{$k} = 1;
|
||||
}
|
||||
}
|
||||
if ($build{most})
|
||||
{
|
||||
### Just uncomment/comment to get the ones you want (if "most" is selected).
|
||||
# $build{dist} = 1;
|
||||
# $build{dist_runtime}= 1;
|
||||
$build{xpidl} = 1; # build idl compiler
|
||||
$build{idl} = 1;
|
||||
$build{stubs} = 1;
|
||||
$build{runtime} = 1;
|
||||
$build{common} = 1;
|
||||
$build{imglib} = 1;
|
||||
$build{necko} = 1;
|
||||
$build{security} = 1;
|
||||
$build{browserutils} = 1;
|
||||
$build{intl} = 1;
|
||||
$build{nglayout} = 1;
|
||||
$build{editor} = 1;
|
||||
$build{viewer} = 1;
|
||||
$build{xpapp} = 1;
|
||||
$build{extensions} = 1;
|
||||
$build{plugins} = 1;
|
||||
$build{mailnews} = 1;
|
||||
$build{apprunner} = 1;
|
||||
$build{resources} = 1;
|
||||
}
|
||||
|
||||
# do the work
|
||||
# you should not have to edit anything below
|
||||
|
||||
chdir("::::");
|
||||
$MOZ_SRC = cwd();
|
||||
|
||||
if ($USE_TIMESTAMPED_LOGS)
|
||||
{
|
||||
#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
|
||||
}
|
||||
|
||||
Moz::StopForErrors();
|
||||
#Moz::DontStopForErrors();
|
||||
|
||||
Checkout();
|
||||
|
||||
ConfigureBuildSystem();
|
||||
|
||||
my(@gen_files) = (
|
||||
":mozilla:config:nsBuildID.h",
|
||||
":mozilla:xpfe:global:build.dtd"
|
||||
);
|
||||
SetBuildNumber(":mozilla:config:build_number", ":mozilla:config:aboutime.pl", \@gen_files);
|
||||
|
||||
chdir($MOZ_SRC);
|
||||
BuildDist();
|
||||
|
||||
chdir($MOZ_SRC);
|
||||
BuildProjects();
|
||||
|
||||
print "Build complete\n";
|
|
@ -1,476 +0,0 @@
|
|||
#!perl
|
||||
package CodeWarriorLib;
|
||||
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
CodeWarriorLib - supply interface to CodeWarrior
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
#!perl
|
||||
use CodeWarriorLib;
|
||||
CodeWarriorLib::activate();
|
||||
$had_errors = CodeWarriorLib::build_project(
|
||||
$project_path, $target_name, $recent_errors_file, $clean_build
|
||||
);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Replaces the AppleScript library I<CodeWarriorLib>.
|
||||
|
||||
=over 4
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use Cwd;
|
||||
use Mac::Types;
|
||||
use Mac::Events;
|
||||
use Mac::AppleEvents;
|
||||
use Mac::AppleEvents::Simple;
|
||||
use Mac::Processes;
|
||||
use Mac::MoreFiles;
|
||||
use Mac::StandardFile;
|
||||
use File::Basename;
|
||||
|
||||
use vars qw($VERSION);
|
||||
$VERSION = '1.02';
|
||||
|
||||
my($app) = 'CWIE';
|
||||
my($scriptDir) = cwd();
|
||||
|
||||
# 0 == don't switch CWIE to front app in do_event(), 1 == do switch
|
||||
# note: activate() still switches when called
|
||||
$Mac::AppleEvents::Simple::SWITCH = 0;
|
||||
|
||||
# supply your own path to the source here
|
||||
#_test('PowerPudgeIV:mozilla:mozilla:');
|
||||
|
||||
|
||||
=pod
|
||||
|
||||
=item _get_project($full_path)
|
||||
|
||||
A private routine returning a reference to the open project with the given name,
|
||||
or else the empty string (when that project is not open)
|
||||
|
||||
full_path is a string identifying the project to be built and is of the form,
|
||||
e.g., "HD:ProjectFolder:MyProject.mcp". It must be supplied.
|
||||
|
||||
=cut
|
||||
|
||||
sub _get_project ($) {
|
||||
my(
|
||||
$full_path, $candidate_projects
|
||||
) = @_;
|
||||
$candidate_projects = _doc_named(basename($full_path, '*'));
|
||||
if ($candidate_projects) {
|
||||
my($cps) = _get_dobj($candidate_projects);
|
||||
my($num) = AECountItems($cps);
|
||||
if ($num) { # is a list
|
||||
foreach (1 .. AECountItems($cps)) {
|
||||
my($cp) = AEGetNthDesc($cps, $_);
|
||||
if (lc $full_path eq lc _full_path($cp)) {
|
||||
return($cp);
|
||||
}
|
||||
}
|
||||
} else { # is only one, not a list
|
||||
if (lc $full_path eq lc _full_path($cps)) {
|
||||
return($cps);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
=pod
|
||||
|
||||
=item build_project
|
||||
|
||||
Build a selected target of a project, saving any errors to a file, if supplied.
|
||||
|
||||
full_path is a string identifying the project to be built and is of the form,
|
||||
e.g., "HD:ProjectFolder:MyProject.mcp". It must be supplied.
|
||||
|
||||
If target_name is the empty string, the current target of the selected project
|
||||
will be built, else, target_name should be a string matching a target name in
|
||||
the selected project.
|
||||
|
||||
If error_path is the empty string, errors will not be saved to a file,
|
||||
else, error_path should be the full path of a file to save error messages into.
|
||||
|
||||
=cut
|
||||
|
||||
$CodeWarriorLib::CLOSE_PROJECTS_FIRST = 0; # If true we close then make. If false, make then close.
|
||||
my $last_project_built = "";
|
||||
my $last_project_was_closed = 0;
|
||||
|
||||
sub build_project ($;$$$) {
|
||||
my(
|
||||
$full_path, $target_name, $error_path,
|
||||
$remove_object, $p, $project_was_closed, $had_errors
|
||||
) = @_;
|
||||
_close_errors_window();
|
||||
|
||||
if ($CodeWarriorLib::CLOSE_PROJECTS_FIRST && ($last_project_built ne $full_path))
|
||||
{
|
||||
# If we're in "close first" mode, we don't close if the current project
|
||||
# is the same as the previous one.
|
||||
if ($last_project_was_closed) {
|
||||
$p = _get_project($last_project_built);
|
||||
_close($p);
|
||||
}
|
||||
$last_project_built = $full_path;
|
||||
$last_project_was_closed = 0; # now refers to the new project
|
||||
}
|
||||
$project_was_closed = 0;
|
||||
while (1) {
|
||||
$p = _get_project($full_path);
|
||||
if (!$p) {
|
||||
if ($project_was_closed) {
|
||||
print "### Error - request for project document failed after opening\n";
|
||||
die "### possibly CW Pro 4 bug: be sure to close your Find window\n";
|
||||
}
|
||||
$project_was_closed = 1;
|
||||
$last_project_was_closed = 1;
|
||||
_open_file($full_path);
|
||||
} else {
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
$had_errors = 0;
|
||||
if ($target_name eq '') {
|
||||
if ($remove_object) {_remove_object($p)}
|
||||
_build($p);
|
||||
} else {
|
||||
if ($remove_object) {_remove_object($p, $target_name)}
|
||||
_build($p, $target_name);
|
||||
}
|
||||
|
||||
if ($error_path ne '') {
|
||||
_save_errors_window($error_path);
|
||||
}
|
||||
$had_errors = _close_errors_window();
|
||||
|
||||
if (!$CodeWarriorLib::CLOSE_PROJECTS_FIRST)
|
||||
{
|
||||
if ($project_was_closed) {
|
||||
$p = _get_project($full_path);
|
||||
_close($p);
|
||||
}
|
||||
}
|
||||
|
||||
return($had_errors);
|
||||
}
|
||||
|
||||
=pod
|
||||
|
||||
=item activate()
|
||||
|
||||
Launches CodeWarrior and brings it to the front.
|
||||
|
||||
Once found, path will be saved in ':idepath.txt' 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.
|
||||
|
||||
First looks for an open CodeWarrior app. Second, tries to open previously
|
||||
saved location in ':idepath.txt'. Third, tries to find it and allow user
|
||||
to choose it with Navigation Services (if present). Fourth, uses good old
|
||||
GUSI routines built-in to MacPerl for a Choose Directory dialog box.
|
||||
|
||||
=cut
|
||||
|
||||
sub activate () {
|
||||
local(*F);
|
||||
my($filepath, $appath, $psi) = (':idepath.txt');
|
||||
|
||||
foreach $psi (values(%Process)) {
|
||||
if ($psi->processSignature() eq $app) {
|
||||
$appath = $psi->processAppSpec();
|
||||
_save_appath($filepath, $appath);
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$appath || !-x $appath) {
|
||||
$appath = _read_appath($filepath);
|
||||
}
|
||||
|
||||
if (!$appath || ! -x $appath)
|
||||
{
|
||||
# make sure that MacPerl is a front process
|
||||
#ActivateApplication('McPL');
|
||||
MacPerl::Answer("Please locate the CodeWarrior application.", "OK");
|
||||
|
||||
# prompt user for the file name, and store it
|
||||
my $macFile = StandardGetFile( 0, "APPL");
|
||||
if ( $macFile->sfGood() )
|
||||
{
|
||||
$appath = $macFile->sfFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
die "Operation canceled\n";
|
||||
}
|
||||
|
||||
# if (eval {require Mac::Navigation}) {
|
||||
# my($options, $nav);
|
||||
# Mac::Navigation->import();
|
||||
# $options = NavGetDefaultDialogOptions();
|
||||
# $options->message('Where is CodeWarrior IDE?');
|
||||
# $options->windowTitle('Find CodeWarrior IDE');
|
||||
# $nav = NavChooseObject($Application{$app}, $options);
|
||||
# die "CodeWarrior IDE not found.\n" if (!$nav || !$nav->file(1));
|
||||
# $appath = $nav->file(1);
|
||||
# } else {
|
||||
# local(*D);
|
||||
# my $cwd = `pwd`;
|
||||
# $appath = _get_folder(
|
||||
# 'Where is the CW IDE folder?',
|
||||
# dirname($Application{$app})
|
||||
# );
|
||||
# die "CodeWarrior IDE not found.\n" if !$appath;
|
||||
# opendir(D, $appath) or die $!;
|
||||
# chdir($appath);
|
||||
# foreach my $file (sort readdir (D)) {
|
||||
# my(@app) = MacPerl::GetFileInfo($file);
|
||||
# if ($app[0] && $app[1] &&
|
||||
# $app[1] eq 'APPL' && $app[0] eq $app
|
||||
# ) {
|
||||
# $appath .= $file;
|
||||
# last;
|
||||
# }
|
||||
# }
|
||||
# chomp($cwd);
|
||||
# chdir($cwd);
|
||||
# }
|
||||
_save_appath($filepath, $appath);
|
||||
}
|
||||
|
||||
my($lp) = LaunchParam->new(
|
||||
launchAppSpec => $appath,
|
||||
launchControlFlags => launchContinue() + launchNoFileFlags()
|
||||
);
|
||||
unless (LaunchApplication($lp)) {
|
||||
unlink($filepath);
|
||||
die $^E;
|
||||
}
|
||||
|
||||
#call WNE to allow launch/switch to happen
|
||||
WaitNextEvent();
|
||||
WaitNextEvent();
|
||||
WaitNextEvent();
|
||||
}
|
||||
|
||||
=pod
|
||||
|
||||
=item quit()
|
||||
|
||||
Quits CodeWarrior.
|
||||
|
||||
=cut
|
||||
|
||||
sub quit() {
|
||||
|
||||
$last_project_built = "";
|
||||
$last_project_was_closed = 0;
|
||||
|
||||
my($evt) = do_event(qw/aevt quit/, $app);
|
||||
}
|
||||
|
||||
|
||||
sub _build ($;$) {
|
||||
my($evt);
|
||||
if ($_[1]) {
|
||||
my($prm) =
|
||||
q"'----':obj {form:name, want:type(TRGT), seld:TEXT(@), from:" .
|
||||
AEPrint($_[0]) . '}';
|
||||
$evt = do_event(qw/CWIE MAKE/, $app, $prm, $_[1]);
|
||||
} else {
|
||||
my($prm) = q"'----':" . AEPrint($_[0]);
|
||||
$evt = do_event(qw/CWIE MAKE/, $app, $prm);
|
||||
}
|
||||
}
|
||||
|
||||
sub _remove_object ($;$) {
|
||||
my($evt);
|
||||
if ($_[1]) {
|
||||
my($prm) =
|
||||
q"'----':obj {form:name, want:type(TRGT), seld:TEXT(@), from:" .
|
||||
AEPrint($_[0]) . '}';
|
||||
$evt = do_event(qw/CWIE RMOB/, $app, $prm, $_[1]);
|
||||
} else {
|
||||
my($prm) = q"'----':" . AEPrint($_[0]);
|
||||
$evt = do_event(qw/CWIE RMOB/, $app, $prm);
|
||||
}
|
||||
}
|
||||
|
||||
sub _open_file ($) {
|
||||
my($prm) =
|
||||
q"'----':obj {form:name, want:type(alis), " .
|
||||
q"seld:TEXT(@), from:'null'()}";
|
||||
|
||||
do_event(qw/aevt odoc/, $app, $prm, $_[0]);
|
||||
}
|
||||
|
||||
sub _doc_named ($) {
|
||||
my($prm) =
|
||||
q"'----':obj {form:test, want:type(docu), from:'null'(), " .
|
||||
q"seld:cmpd{relo:'= ', 'obj1':obj {form:prop, want:type" .
|
||||
q"(prop), seld:type(pnam), from:'exmn'()}, 'obj2':TEXT(@)}}";
|
||||
|
||||
my($evt) = do_event(qw/core getd/, $app, $prm, $_[0]);
|
||||
return($evt->{REPLY} eq 'aevt\ansr{}' ? undef : $evt);
|
||||
}
|
||||
|
||||
sub _full_path ($) {
|
||||
my($obj) = $_[0];
|
||||
my($prm) =
|
||||
q"'----':obj {form:prop, want:type(prop), seld:type(FILE), " .
|
||||
q"from:" . AEPrint($_[0]) . q"}, rtyp:type(TEXT)";
|
||||
my($evt) = do_event(qw/core getd/, $app, $prm);
|
||||
|
||||
return MacPerl::MakePath(
|
||||
MacUnpack('fss ', (
|
||||
AEGetParamDesc($evt->{REP}, keyDirectObject()))->data()->get()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
sub _save_errors_window ($) {
|
||||
my($prm) =
|
||||
q"'----':obj {form:name, want:type(alis), seld:TEXT(@), from:'null'()}";
|
||||
do_event(qw/MMPR SvMs/, $app, $prm, $_[0]);
|
||||
}
|
||||
|
||||
|
||||
sub _close_errors_window () {
|
||||
my($prm) =
|
||||
q"'----':obj {form:name, want:type(cwin), " .
|
||||
q"seld:TEXT(@), from:'null'()}";
|
||||
|
||||
my($evt) = do_event(qw/core clos/, $app, $prm, 'Errors & Warnings');
|
||||
return($evt->{REPLY} eq 'aevt\ansr{}' ? 1 : 0);
|
||||
}
|
||||
|
||||
sub _close () {
|
||||
my($prm) = q"'----':" . AEPrint($_[0]);
|
||||
do_event(qw/core clos/, $app, $prm);
|
||||
}
|
||||
|
||||
sub _get_dobj ($) {
|
||||
return(AEGetParamDesc($_[0]->{REP}, keyDirectObject()));
|
||||
}
|
||||
|
||||
sub _get_folder ($$) {
|
||||
require 'GUSI.ph';
|
||||
my($prompt, $default) = @_;
|
||||
MacPerl::Choose(
|
||||
GUSI::AF_FILE(), 0, $prompt, '',
|
||||
GUSI::CHOOSE_DIR() + ($default ? &GUSI::CHOOSE_DEFAULT : 0),
|
||||
$default
|
||||
);
|
||||
}
|
||||
|
||||
sub _save_appath ($$) {
|
||||
|
||||
my($cwd) = cwd(); # remember the current working dir
|
||||
chdir($scriptDir); # change dir to the script dir
|
||||
|
||||
open(F, '>' . $_[0]) or die $!;
|
||||
print F $_[1];
|
||||
close(F);
|
||||
|
||||
chdir($cwd); # restore the cwd
|
||||
}
|
||||
|
||||
sub _read_appath ($) {
|
||||
|
||||
my($filepath) = @_;
|
||||
|
||||
my($cwd) = cwd(); # remember the current working dir
|
||||
chdir($scriptDir); # change dir to the script dir
|
||||
|
||||
if (! -e $filepath) {
|
||||
return "";
|
||||
}
|
||||
open(F, $filepath);
|
||||
my($appath) = <F>;
|
||||
close(F);
|
||||
|
||||
chdir($cwd); # restore the cwd
|
||||
return($appath);
|
||||
}
|
||||
|
||||
|
||||
sub _test ($) {
|
||||
activate();
|
||||
my($path) = $_[0];
|
||||
build_project(
|
||||
"${path}modules:xml:macbuild:XML.mcp", '',
|
||||
"${path}build:mac:Mozilla.BuildLog.part"
|
||||
);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
=pod
|
||||
|
||||
=back
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
=over 4
|
||||
|
||||
=item v1.02, September 23, 1998
|
||||
|
||||
Made fixes in finding and saving location of CodeWarrior IDE.
|
||||
|
||||
=item v1.01, June 1, 1998
|
||||
|
||||
Made fixes to C<chdir()> in C<activate()>, made C<activate()> more robust
|
||||
in finding CodeWarrior IDE, added global variable to NOT switch to IDE
|
||||
for each sent event, a few other fixes.
|
||||
|
||||
=item v1.00, May 30, 1998
|
||||
|
||||
First shot
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Chris Nandor F<E<lt>pudge@pobox.comE<gt>>, and the author of the
|
||||
original I<CodeWarriorLib>, Scott Collins F<E<lt>scc@netscape.comE<gt>>.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
BuildProject L<Moz>.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
The contents of this file are subject to the Netscape Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/NPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The Original Code is Mozilla Communicator client code, released
|
||||
March 31, 1998.
|
||||
|
||||
The Initial Developer of the Original Code is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
||||
=cut
|
Двоичные данные
build/mac/GenToc
Двоичные данные
build/mac/GenToc
Двоичный файл не отображается.
|
@ -1,264 +0,0 @@
|
|||
(*
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*)
|
||||
|
||||
(*
|
||||
GenToc - Generates a .toc file from the current contents of a project.
|
||||
|
||||
by Patrick C. Beard <beard@netscape.com>
|
||||
*)
|
||||
|
||||
on swapDelimiters(newDelimiters)
|
||||
set oldDelimiters to get AppleScript's text item delimiters
|
||||
set AppleScript's text item delimiters to newDelimiters
|
||||
return oldDelimiters
|
||||
end swapDelimiters
|
||||
|
||||
on setDelimiters(newDelimiters)
|
||||
set AppleScript's text item delimiters to newDelimiters
|
||||
end setDelimiters
|
||||
|
||||
on setExtension(fileName, newExtension)
|
||||
set oldDelimiters to swapDelimiters(".")
|
||||
set newFileName to (text item 1 of fileName) & newExtension
|
||||
setDelimiters(oldDelimiters)
|
||||
return newFileName
|
||||
end setExtension
|
||||
|
||||
on folderFromPath(filePath)
|
||||
set folderPath to ((filePath's text items 1 thru ((count of filePath's text items) - 1)) as string) & ":"
|
||||
return folderPath
|
||||
end folderFromPath
|
||||
|
||||
on fileFromPath(filePath)
|
||||
return last text item of filePath
|
||||
end fileFromPath
|
||||
|
||||
on openProject(aProjectFile)
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
open aProjectFile
|
||||
end tell
|
||||
end openProject
|
||||
|
||||
on selectProject(aProjectFile)
|
||||
set projectName to fileFromPath(aProjectFile as text)
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
if (name of window 1 is not projectName) then
|
||||
select window projectName
|
||||
end if
|
||||
end tell
|
||||
end selectProject
|
||||
|
||||
on getTargets()
|
||||
set targetList to {}
|
||||
set nameList to {}
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
set currentProject to project document 1
|
||||
repeat with targetIndex from 1 to (count of targets of currentProject)
|
||||
set currentTarget to (target targetIndex of currentProject)
|
||||
set targetList to targetList & {currentTarget}
|
||||
set nameList to nameList & {name of currentTarget}
|
||||
end repeat
|
||||
return {target:targetList, names:nameList}
|
||||
end tell
|
||||
end getTargets
|
||||
|
||||
(* uses "sort" scripting addition to sort a list of strings. *)
|
||||
on sortList(aList)
|
||||
if (aList {}) then
|
||||
return sort aList
|
||||
else
|
||||
return {}
|
||||
end if
|
||||
end sortList
|
||||
|
||||
(* uses "info for" scripting addition, to return the file type of a path. *)
|
||||
on getFileType(aFilePath)
|
||||
return file type of (info for alias aFilePath)
|
||||
end getFileType
|
||||
|
||||
(* returns all "TEXT" files of the named target. *)
|
||||
on getTargetFiles(targetKey)
|
||||
set targetFiles to {}
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
set currentProject to project document 1
|
||||
set currentTarget to (target targetKey of currentProject)
|
||||
try
|
||||
-- workaround for CW IDE 3.X bug, loop until error encountered.
|
||||
set fileIndex to 1
|
||||
repeat until false
|
||||
set targetFile to (target file fileIndex of currentTarget)
|
||||
-- only consider text files, since other platforms won't be managing binaries.
|
||||
-- also, only consider if target file is directly linked.
|
||||
if (linked of targetFile) then
|
||||
set targetFilePath to (Access Paths of targetFile)
|
||||
tell me
|
||||
if (getFileType(targetFilePath) = "TEXT") then
|
||||
set targetFiles to targetFiles & {targetFilePath}
|
||||
end if
|
||||
end tell
|
||||
end if
|
||||
set fileIndex to (fileIndex + 1)
|
||||
end repeat
|
||||
on error msg
|
||||
-- display dialog msg & " file count = " & fileIndex
|
||||
end try
|
||||
end tell
|
||||
return sortList(targetFiles)
|
||||
end getTargetFiles
|
||||
|
||||
on addTargetFile(targetFile, targetName)
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
add (project document 1) new target file with data {targetFile} to targets {targetName}
|
||||
end tell
|
||||
end addTargetFile
|
||||
|
||||
on setCurrentTarget(currentTargetName)
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
Set Current Target currentTargetName
|
||||
end tell
|
||||
end setCurrentTarget
|
||||
|
||||
on removeTargetFile(targetFile)
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
Remove Files {targetFile}
|
||||
end tell
|
||||
end removeTargetFile
|
||||
|
||||
on quote(aString)
|
||||
return "'" & aString & "'"
|
||||
end quote
|
||||
|
||||
on listContains(aList, anItem)
|
||||
repeat with listItem in aList
|
||||
if (listItem contains anItem) then
|
||||
return true
|
||||
end if
|
||||
end repeat
|
||||
return false
|
||||
end listContains
|
||||
|
||||
on showList(listToShow)
|
||||
choose from list listToShow with prompt "List:" with empty selection allowed
|
||||
end showList
|
||||
|
||||
on replace(aString, oldChar, newChar)
|
||||
set newString to ""
|
||||
repeat with aChar in (every character of aString)
|
||||
if (contents of aChar = oldChar) then
|
||||
set newString to newString & newChar
|
||||
else
|
||||
set newString to newString & aChar
|
||||
end if
|
||||
end repeat
|
||||
return newString
|
||||
end replace
|
||||
|
||||
on substring(aString, anOffset)
|
||||
set aSubString to ""
|
||||
repeat with charIndex from anOffset to (count aString)
|
||||
set aSubString to aSubString & (character charIndex of aString)
|
||||
end repeat
|
||||
return aSubString
|
||||
end substring
|
||||
|
||||
on setFileInfo(aFile, aCreator, aType)
|
||||
tell application "Finder"
|
||||
set creator type of aFile to aCreator
|
||||
set file type of aFile to aType
|
||||
end tell
|
||||
end setFileInfo
|
||||
|
||||
on closeFile(fileRef)
|
||||
try
|
||||
-- make sure it's not currently open.
|
||||
close access fileRef
|
||||
on error
|
||||
-- ignore error closing.
|
||||
end try
|
||||
end closeFile
|
||||
|
||||
on mroFile(aFile)
|
||||
try
|
||||
-- make sure it's modifiable.
|
||||
mro aFile
|
||||
on error
|
||||
-- ignore error MROing.
|
||||
end try
|
||||
end mroFile
|
||||
|
||||
on run
|
||||
-- so we can easily strip off file names from paths.
|
||||
set oldDelimiters to swapDelimiters(":")
|
||||
|
||||
set theProjectFile to (choose file with prompt "Choose a CW Project file." of type {"MMPr"})
|
||||
set theManifestFile to (new file with prompt "Create MANIFEST where?" default name setExtension(fileFromPath(theProjectFile as text), ".toc"))
|
||||
|
||||
set manifestRef to false
|
||||
|
||||
try
|
||||
-- make sure the file is closed & is modifiable.
|
||||
closeFile(theManifestFile)
|
||||
mroFile(theManifestFile)
|
||||
|
||||
-- open the new MANIFEST file.
|
||||
set manifestRef to (open for access theManifestFile with write permission)
|
||||
set eof manifestRef to 0
|
||||
|
||||
-- give it CodeWarrior look and feel.
|
||||
setFileInfo(theManifestFile, "CWIE", "TEXT")
|
||||
|
||||
openProject(theProjectFile)
|
||||
selectProject(theProjectFile)
|
||||
|
||||
set targetsList to getTargets()
|
||||
set targetNames to names of targetsList
|
||||
set targetCount to count items of targetNames
|
||||
|
||||
set mozillaTreePathOffset to (offset of "mozilla" in (theManifestFile as text))
|
||||
|
||||
-- dump all targets into the new MANIFEST file.
|
||||
repeat with targetName in targetNames
|
||||
write ("# target: " & targetName & return) to manifestRef
|
||||
setCurrentTarget(targetName)
|
||||
set targetFiles to getTargetFiles(contents of targetName)
|
||||
repeat with targetFile in targetFiles
|
||||
-- only store the path name relative to the source tree itself.
|
||||
set targetFilePath to substring(contents of targetFile, mozillaTreePathOffset)
|
||||
write (replace(targetFilePath, ":", "/") & return) to manifestRef
|
||||
end repeat
|
||||
end repeat
|
||||
on error msg
|
||||
display dialog msg
|
||||
end try
|
||||
if (manifestRef is not false) then
|
||||
closeFile(manifestRef)
|
||||
end if
|
||||
|
||||
-- shut the project down, and display the result.
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
activate
|
||||
Close Project
|
||||
open theManifestFile
|
||||
end tell
|
||||
|
||||
setDelimiters(oldDelimiters)
|
||||
end run
|
|
@ -1,222 +0,0 @@
|
|||
#!perl -w
|
||||
package MANIFESTO;
|
||||
|
||||
require 5.004;
|
||||
require Exporter;
|
||||
|
||||
#use strict;
|
||||
|
||||
use vars qw($VERSION @ISA @EXPORT $MANIFESTOLib);
|
||||
use Mac::StandardFile;
|
||||
use Moz;
|
||||
use Cwd;
|
||||
use Exporter;
|
||||
use File::Basename;
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(ReconcileProject);
|
||||
$VERSION = "1.00";
|
||||
|
||||
=head1 NAME
|
||||
|
||||
MANIFESTO - drives the Mac Project Reconciliation tool.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
You want to use this script. It will make your life easier.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
The contents of this file are subject to the Netscape Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/NPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The Original Code is Mozilla Communicator client code, released
|
||||
March 31, 1998.
|
||||
|
||||
The Initial Developer of the Original Code is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
||||
=cut
|
||||
|
||||
#
|
||||
# globals
|
||||
# $MANIFESTOLib - location of MANIFESTO applescript library
|
||||
#
|
||||
|
||||
#
|
||||
# utility routines
|
||||
#
|
||||
|
||||
sub current_directory()
|
||||
{
|
||||
my $current_directory = cwd();
|
||||
chop($current_directory) if ( $current_directory =~ m/:$/ );
|
||||
return $current_directory;
|
||||
}
|
||||
|
||||
# Uses the "compile script" extension to compile a script.
|
||||
sub compile_script($;$) {
|
||||
my($scriptPath, $outputPath) = @_;
|
||||
|
||||
#// generate a script to compile a script file.
|
||||
my $script = <<END_OF_APPLESCRIPT;
|
||||
store script (compile script (alias "$scriptPath")) in (file "$outputPath") replacing yes
|
||||
END_OF_APPLESCRIPT
|
||||
|
||||
#// run the script.
|
||||
MacPerl::DoAppleScript($script);
|
||||
}
|
||||
|
||||
# _useMANIFESTOLib()
|
||||
# returns 1 on success
|
||||
# Search the include path for the file called MANIFESTOLib
|
||||
sub _useMANIFESTOLib()
|
||||
{
|
||||
unless ( defined($MANIFESTOLib) )
|
||||
{
|
||||
my($scriptName) = "MANIFESTOLib.script";
|
||||
my($libName) = "MANIFESTOLib";
|
||||
# try the directory we were run from
|
||||
my($scriptPath) = dirname($0) . ":" . $scriptName;
|
||||
my($libPath) = dirname($0) . ":" . $libName;
|
||||
# make sure that the compiled script is up to date with the textual script.
|
||||
unless (-e $libPath && getModificationDate($libPath) >= getModificationDate($scriptPath)) {
|
||||
print "# Recompiling MANIFESTOLib.script.\n";
|
||||
compile_script($scriptPath, $libPath);
|
||||
}
|
||||
if ( -e $libPath) {
|
||||
$MANIFESTOLib = $libPath;
|
||||
} else {
|
||||
# now search the include directories
|
||||
foreach (@INC)
|
||||
{
|
||||
unless ( m/^Dev:Pseudo/ ) # This is some bizarre MacPerl special-case directory
|
||||
{
|
||||
$libPath = $_ . $libName;
|
||||
if (-e $libPath)
|
||||
{
|
||||
$MANIFESTOLib = $libPath;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (! (-e $MANIFESTOLib)) {
|
||||
print STDERR "MANIFESTOLib lib could not be found! $MANIFESTOLib";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
sub getModificationDate($) {
|
||||
my($filePath)=@_;
|
||||
my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
|
||||
$atime,$mtime,$ctime,$blksize,$blocks) = stat($filePath);
|
||||
return $mtime;
|
||||
}
|
||||
|
||||
sub setExtension($;$;$) {
|
||||
my($filePath, $oldExtension, $newExtension)=@_;
|
||||
my($name, $dir, $type) = fileparse($filePath, $oldExtension);
|
||||
return "$dir$name$newExtension";
|
||||
}
|
||||
|
||||
#
|
||||
# ReconcileProject(projectPath, manifestoPath)
|
||||
#
|
||||
# Uses MANIFESTOLib AppleScript to reconcile the contents (toc?) of a
|
||||
# CodeWarrior project with an external MANIFEST file.
|
||||
#
|
||||
|
||||
sub ReconcileProject($;$) {
|
||||
#// turn this feature on by removing the following line.
|
||||
return 1;
|
||||
|
||||
my($projectPath, $manifestoPath) = @_;
|
||||
my($sourceTree) = current_directory();
|
||||
my($logPath) = setExtension($manifestoPath, ".toc", ".log");
|
||||
|
||||
print STDERR "# Reconciling Project: $projectPath with $manifestoPath\n";
|
||||
|
||||
#// compare the modification dates of the .toc and .log files. If .log is newer, do nothing.
|
||||
if (-e $logPath && getModificationDate($logPath) >= getModificationDate($manifestoPath)) {
|
||||
print "# Project is up to date.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
_useMANIFESTOLib() || die "Could not load MANIFESTOLib\n";
|
||||
|
||||
my $script = <<END_OF_APPLESCRIPT;
|
||||
tell (load script file "$MANIFESTOLib") to ReconcileProject("$sourceTree:", "$sourceTree$projectPath", "$sourceTree$manifestoPath")
|
||||
END_OF_APPLESCRIPT
|
||||
|
||||
#// run the script, and store the results in a file called "$manifestoPath.log"
|
||||
my $asresult = substr(MacPerl::DoAppleScript($script), 1, -1); #// chops off leading, trailing quotes.
|
||||
|
||||
#// print out to STDOUT to show progress.
|
||||
print $asresult;
|
||||
|
||||
#// store the results in "$manifestoPath.log", which will act as a cache for later checks.
|
||||
open(OUTPUT, ">$logPath") || die "can't open log file $logPath.";
|
||||
print OUTPUT $asresult;
|
||||
close(OUTPUT);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
1;
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
MANIFESTO - Scripts to process source .toc files.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use MANIFESTO;
|
||||
ReconcileProject(<path to Mac project file>, <path to table of contents file>) || die "cannot reconcile project";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This is a PERL interface for talking to MANIFESTOLib AppleScripts.
|
||||
|
||||
=item ReconcileProject
|
||||
ReconcileProject(<path to Mac project file>, <path to table of contents file>);
|
||||
|
||||
Reconciles the contents of a project with an external .toc file.
|
||||
|
||||
=cut
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
=over
|
||||
|
||||
=item MacCVS Home Page
|
||||
|
||||
http://www.maccvs.org/
|
||||
|
||||
=back
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Patrick Beard beard@netscape.com
|
||||
|
||||
based on work by
|
||||
|
||||
Aleks Totic atotic@netscape.com
|
||||
|
||||
=cut
|
||||
|
||||
__END__
|
Двоичные данные
build/mac/MANIFESTOLib
Двоичные данные
build/mac/MANIFESTOLib
Двоичный файл не отображается.
|
@ -1,376 +0,0 @@
|
|||
(*
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*)
|
||||
|
||||
(*
|
||||
MANIFESTOLib - Reconciles a CW Project file with an external table of contents file.
|
||||
|
||||
Uses merge sort, one pass per target.
|
||||
|
||||
by Patrick C. Beard <beard@netscape.com>
|
||||
*)
|
||||
|
||||
(* Global Configuration Properties *)
|
||||
|
||||
property pShowReport : true
|
||||
-- property pSourceTree : "Homeward:Work:Raptor:src:"
|
||||
property pSourceTree : "Morbeus:Projects:Raptor:src:"
|
||||
|
||||
on swapDelimiters(newDelimiters)
|
||||
set oldDelimiters to get AppleScript's text item delimiters
|
||||
set AppleScript's text item delimiters to newDelimiters
|
||||
return oldDelimiters
|
||||
end swapDelimiters
|
||||
|
||||
on setDelimiters(newDelimiters)
|
||||
set AppleScript's text item delimiters to newDelimiters
|
||||
end setDelimiters
|
||||
|
||||
-- replaces oldChar with newChar in a string.
|
||||
on replace(aString, oldChar, newChar)
|
||||
set newString to ""
|
||||
repeat with aChar in (every character of aString)
|
||||
if (contents of aChar = oldChar) then
|
||||
set newString to newString & newChar
|
||||
else
|
||||
set newString to newString & aChar
|
||||
end if
|
||||
end repeat
|
||||
return newString
|
||||
end replace
|
||||
|
||||
(* uses "sort" scripting addition to sort a list of strings. *)
|
||||
on sortList(aList)
|
||||
if (aList {}) then
|
||||
return sort aList
|
||||
else
|
||||
return {}
|
||||
end if
|
||||
end sortList
|
||||
|
||||
-- reads .toc file into a list.
|
||||
on readManifestFile(sourceTree, manifestFile)
|
||||
set oldDelimiters to swapDelimiters(return)
|
||||
set fileRef to false
|
||||
set fileLines to {}
|
||||
try
|
||||
set fileRef to (open for access manifestFile without write permission)
|
||||
-- read entire file into memory, use text items to delimit lines.
|
||||
set fileContents to (read fileRef)
|
||||
repeat with lineRef in (every text item of fileContents)
|
||||
-- ignore lines that start with "#" or are empty.
|
||||
set fileLine to (contents of lineRef)
|
||||
if (fileLine "") and not (fileLine starts with "#") then
|
||||
set fileLines to fileLines & (sourceTree & replace(fileLine, "/", ":"))
|
||||
end if
|
||||
end repeat
|
||||
on error
|
||||
-- ignore errors.
|
||||
end try
|
||||
if (fileRef is not false) then close access fileRef
|
||||
setDelimiters(oldDelimiters)
|
||||
return sortList(fileLines)
|
||||
end readManifestFile
|
||||
|
||||
(* both of the following depend on ":" as the delimiter character. *)
|
||||
|
||||
on folderFromPath(filePath)
|
||||
return ((filePath's text items 1 thru ((count of filePath's text items) - 1)) as string) & ":"
|
||||
end folderFromPath
|
||||
|
||||
on fileFromPath(filePath)
|
||||
return last text item of filePath
|
||||
end fileFromPath
|
||||
|
||||
(* CW Pro IDE Interface Handlers. *)
|
||||
|
||||
on openProject(aProjectFile)
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
-- activate
|
||||
open aProjectFile
|
||||
end tell
|
||||
end openProject
|
||||
|
||||
(* forces the named project file to be the front window. *)
|
||||
on selectProject(aProjectFile)
|
||||
set projectName to fileFromPath(aProjectFile as text)
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
if (name of window 1 is not projectName) then
|
||||
select window projectName
|
||||
end if
|
||||
end tell
|
||||
end selectProject
|
||||
|
||||
on closeProject(aProjectFile)
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
Close Project
|
||||
end tell
|
||||
end closeProject
|
||||
|
||||
on getTargets()
|
||||
set targetList to {}
|
||||
set nameList to {}
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
set currentProject to project document 1
|
||||
repeat with targetIndex from 1 to (count of targets of currentProject)
|
||||
set currentTarget to (target targetIndex of currentProject)
|
||||
set targetList to targetList & {currentTarget}
|
||||
set nameList to nameList & {name of currentTarget}
|
||||
end repeat
|
||||
return {target:targetList, names:nameList}
|
||||
end tell
|
||||
end getTargets
|
||||
|
||||
(* uses "info for" scripting addition, to return the file type of a path. *)
|
||||
on getFileType(aFilePath)
|
||||
return file type of (info for alias aFilePath)
|
||||
end getFileType
|
||||
|
||||
(* returns all "TEXT" files of the named target. *)
|
||||
on getTargetFiles(targetKey)
|
||||
set targetFiles to {}
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
set currentProject to project document 1
|
||||
set currentTarget to (target targetKey of currentProject)
|
||||
try
|
||||
-- workaround for CW IDE 3.X bug, loop until error encountered.
|
||||
set fileIndex to 1
|
||||
repeat until false
|
||||
set targetFile to (target file fileIndex of currentTarget)
|
||||
-- only consider text files, since other platforms won't be managing binaries.
|
||||
-- also, only consider if target file is directly linked.
|
||||
if (linked of targetFile) then
|
||||
set targetFilePath to (Access Paths of targetFile)
|
||||
tell me
|
||||
if (getFileType(targetFilePath) = "TEXT") then
|
||||
set targetFiles to targetFiles & {targetFilePath}
|
||||
end if
|
||||
end tell
|
||||
end if
|
||||
set fileIndex to (fileIndex + 1)
|
||||
end repeat
|
||||
on error msg
|
||||
-- display dialog msg & " file count = " & fileIndex
|
||||
end try
|
||||
end tell
|
||||
return sortList(targetFiles)
|
||||
end getTargetFiles
|
||||
|
||||
on addTargetFile(targetFile, targetList)
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
add (project document 1) new target file with data {targetFile} to targets targetList
|
||||
end tell
|
||||
end addTargetFile
|
||||
|
||||
global gCurrentTarget
|
||||
|
||||
on setCurrentTarget(currentTargetName)
|
||||
if (gCurrentTarget currentTargetName) then
|
||||
set gCurrentTarget to currentTargetName
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
Set Current Target currentTargetName
|
||||
end tell
|
||||
end if
|
||||
end setCurrentTarget
|
||||
|
||||
on removeTargetFile(targetFile)
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
Remove Files {targetFile}
|
||||
end tell
|
||||
end removeTargetFile
|
||||
|
||||
on quote(aString)
|
||||
return "'" & aString & "'"
|
||||
end quote
|
||||
|
||||
on listContains(aList, anItem)
|
||||
repeat with listItem in aList
|
||||
if (contents of listItem = anItem) then
|
||||
return true
|
||||
end if
|
||||
end repeat
|
||||
return false
|
||||
end listContains
|
||||
|
||||
on showList(aList)
|
||||
choose from list aList with prompt "List:" with empty selection allowed
|
||||
end showList
|
||||
|
||||
global gProjectModified
|
||||
|
||||
on ModifyReadOnly(aProjectFile)
|
||||
if (not gProjectModified) then
|
||||
set gProjectModified to true
|
||||
-- so CodeWarrior will notice, must close the file before MROing it.
|
||||
closeProject(aProjectFile)
|
||||
mro aProjectFile
|
||||
openProject(aProjectFile)
|
||||
selectProject(aProjectFile)
|
||||
end if
|
||||
end ModifyReadOnly
|
||||
|
||||
on makeStream(itemList)
|
||||
return {streamList:itemList, streamCount:count itemList, streamIndex:0}
|
||||
end makeStream
|
||||
|
||||
(* true is used as the end of stream value. *)
|
||||
property pEOS : true
|
||||
|
||||
on advanceStream(stream)
|
||||
set itemCount to (streamCount of stream)
|
||||
set itemIndex to (streamIndex of stream)
|
||||
if (itemIndex < itemCount) then
|
||||
set itemIndex to (itemIndex + 1)
|
||||
set (streamIndex of stream) to itemIndex
|
||||
return (item itemIndex of streamList of stream)
|
||||
else
|
||||
return pEOS
|
||||
end if
|
||||
end advanceStream
|
||||
|
||||
-- returns true if str2 is INFINITELY great, or str1 is less than str2.
|
||||
on precedes(str1, str2)
|
||||
return (str2 = pEOS) or ((str1 pEOS) and (str1 < str2))
|
||||
end precedes
|
||||
|
||||
on get_current_application()
|
||||
return last text item of ((path to current application) as text)
|
||||
end get_current_application
|
||||
|
||||
on get_frontmost_application()
|
||||
return last text item of ((path to frontmost application) as text)
|
||||
end get_frontmost_application
|
||||
|
||||
on activate_application(applicationName)
|
||||
tell application "Finder"
|
||||
set applicationProcess to (application process applicationName)
|
||||
set frontmost of applicationProcess to true
|
||||
end tell
|
||||
end activate_application
|
||||
|
||||
on ReconcileProject(sourceTree, projectPath, manifestoPath)
|
||||
-- so we can easily strip off file names from paths.
|
||||
set oldDelimiters to swapDelimiters(":")
|
||||
|
||||
-- initialize globals.
|
||||
set gCurrentTarget to ""
|
||||
set gProjectModified to false
|
||||
|
||||
-- convert paths to aliases.
|
||||
set projectFile to alias projectPath
|
||||
set manifestFile to alias manifestoPath
|
||||
|
||||
-- read the MANIFESTO file into a list of paths.
|
||||
set manifestContents to readManifestFile(sourceTree, manifestFile)
|
||||
-- return manifestContents
|
||||
|
||||
-- now, start processing the file items, ensuring that the project contains all items.
|
||||
openProject(projectFile)
|
||||
selectProject(projectFile)
|
||||
set targetsList to getTargets()
|
||||
set targetNames to names of targetsList
|
||||
|
||||
if (pShowReport) then
|
||||
set theReport to ""
|
||||
set addedFiles to ""
|
||||
set removedFiles to ""
|
||||
end if
|
||||
|
||||
-- push current application to front for speed.
|
||||
-- set frontmostApplication to get_frontmost_application()
|
||||
-- set currentApplication to get_current_application()
|
||||
-- activate_application(currentApplication)
|
||||
|
||||
-- reconcile all targets with the MANIFEST file.
|
||||
-- this loop should be recoded in PERL for speed.
|
||||
-- IDEA: with sorted lists, can scan both lists, like a merge sort, and make one pass per target.
|
||||
repeat with targetNameRef in targetNames
|
||||
-- switch targets because getTargetFiles now checks to see if file is linked in current target.
|
||||
set targetName to (contents of targetNameRef)
|
||||
set targetFiles to getTargetFiles(targetName)
|
||||
-- hopefully, this list test is fast.
|
||||
if (targetFiles manifestContents) then
|
||||
-- return {count targetFiles, count manifestContents, targetFiles, manifestContents}
|
||||
-- make sure the project file is modifiable.
|
||||
ModifyReadOnly(projectFile)
|
||||
setCurrentTarget(targetName)
|
||||
set targetStream to makeStream(targetFiles)
|
||||
set targetItem to advanceStream(targetStream)
|
||||
set manifestStream to makeStream(manifestContents)
|
||||
set manifestItem to advanceStream(manifestStream)
|
||||
repeat until (manifestItem is pEOS) and (targetItem is pEOS)
|
||||
-- display dialog "m: " & manifestItem & ", t: " & targetFileItem
|
||||
if (manifestItem = targetItem) then
|
||||
-- items match, advance both.
|
||||
set manifestItem to advanceStream(manifestStream)
|
||||
set targetItem to advanceStream(targetStream)
|
||||
else
|
||||
-- return {manifestItem, targetItem}
|
||||
if (precedes(manifestItem, targetItem)) then
|
||||
-- we have an item in manifest, not in project, so we have to add it to the targets.
|
||||
-- display dialog "adding " & manifestItem
|
||||
addTargetFile(manifestItem, targetNames)
|
||||
if pShowReport then
|
||||
set addedFiles to addedFiles & ("# " & (last text item of manifestItem) & return)
|
||||
end if
|
||||
set manifestItem to advanceStream(manifestStream)
|
||||
else
|
||||
-- we have an item not in manifest, but in project, so it must be removed from this target.
|
||||
-- display dialog "removing " & targetItem
|
||||
removeTargetFile(targetItem)
|
||||
if pShowReport then
|
||||
set removedFiles to removedFiles & ("# " & targetName & " - " & (last text item of targetItem) & return)
|
||||
end if
|
||||
set targetItem to advanceStream(targetStream)
|
||||
end if
|
||||
end if
|
||||
end repeat
|
||||
end if
|
||||
end repeat
|
||||
|
||||
-- activate_application(frontmostApplication)
|
||||
|
||||
-- commit the project changes, and optionally display a report.
|
||||
tell application "CodeWarrior IDE 3.3"
|
||||
-- leave project open for compilation phase?
|
||||
Close Project
|
||||
if pShowReport then
|
||||
if addedFiles is not "" then set theReport to ("# Added files: " & return & addedFiles)
|
||||
if removedFiles is not "" then set theReport to theReport & ("# Removed files: " & return & removedFiles)
|
||||
if (theReport is "") then set theReport to (" # Project is up to date." & return)
|
||||
-- display dialog theReport buttons {"OK"} default button "OK"
|
||||
end if
|
||||
end tell
|
||||
|
||||
-- restore AppleScript's delimiters.
|
||||
setDelimiters(oldDelimiters)
|
||||
|
||||
-- return 0 to indicate no error.
|
||||
return theReport
|
||||
end ReconcileProject
|
||||
|
||||
on run
|
||||
-- when run interactively,
|
||||
-- ask user which project/MANIFEST files to use.
|
||||
set projectPath to (choose file with prompt "Choose a CW Project file." of type {"MMPr"}) as text
|
||||
set manifestPath to (choose file with prompt "Choose a TOC file to process." of type {"TEXT"}) as text
|
||||
ReconcileProject(pSourceTree, projectPath, manifestPath)
|
||||
end run
|
|
@ -1,204 +0,0 @@
|
|||
#!perl -w
|
||||
package MacCVS;
|
||||
|
||||
# package Mac::Apps::MacCVS; this should really be the name of the package
|
||||
# but due to our directory hierarchy in mozilla, I am not doing it
|
||||
|
||||
require 5.004;
|
||||
require Exporter;
|
||||
|
||||
use strict;
|
||||
|
||||
use vars qw($VERSION @ISA @EXPORT $MacCVSLib);
|
||||
use Mac::StandardFile;
|
||||
use Moz;
|
||||
use Cwd;
|
||||
use Exporter;
|
||||
use File::Basename;
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw( new print checkout);
|
||||
$VERSION = "1.00";
|
||||
|
||||
# Architecture:
|
||||
# cvs session object:
|
||||
# name - session name
|
||||
# session_file - session file
|
||||
#
|
||||
# globals
|
||||
# $MacCVSLib - location of MacCVS applescript library
|
||||
#
|
||||
#
|
||||
|
||||
#
|
||||
# utility routines
|
||||
#
|
||||
|
||||
# just like Mac::DoAppleScript, 1 is success, 0 is failure
|
||||
sub _myDoAppleScript($)
|
||||
{
|
||||
my($script) = @_;
|
||||
my $asresult = MacPerl::DoAppleScript($script);
|
||||
if ($asresult eq "0")
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
print STDERR "AppleScript error: $asresult\n";
|
||||
print STDERR "AppleScript was: \n $script \n";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
# _useMacCVSLib
|
||||
# returns 1 on success
|
||||
# Search the include path for the file called MacCVSLib
|
||||
sub _useMacCVSLib()
|
||||
{
|
||||
unless ( defined($MacCVSLib) )
|
||||
{
|
||||
my($libname) = "MacCVSLib";
|
||||
# try the directory we were run from
|
||||
my($c) = dirname($0) . ":" . $libname;
|
||||
if ( -e $c)
|
||||
{
|
||||
$MacCVSLib = $c;
|
||||
}
|
||||
else
|
||||
{
|
||||
# now search the include directories
|
||||
foreach (@INC)
|
||||
{
|
||||
unless ( m/^Dev:Pseudo/ ) # This is some bizarre MacPerl special-case directory
|
||||
{
|
||||
$c = $_ . $libname;
|
||||
if (-e $c)
|
||||
{
|
||||
$MacCVSLib = $c;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (! (-e $MacCVSLib))
|
||||
{
|
||||
print STDERR "MacCVS lib could not be found! $MacCVSLib";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Session object methods
|
||||
#
|
||||
|
||||
sub new {
|
||||
my ( $proto, $session_file) = @_;
|
||||
my $class = ref($proto) || $proto;
|
||||
my $self = {};
|
||||
|
||||
if ( defined($session_file) && ( -e $session_file) )
|
||||
{
|
||||
$self->{"name"} = basename( $session_file );
|
||||
$self->{"session_file"} = $session_file;
|
||||
bless $self, $class;
|
||||
return $self;
|
||||
}
|
||||
else
|
||||
{
|
||||
print STDERR "MacCVS->new cvs file < $session_file > does not exist\n";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
# makes sure that the session is open
|
||||
# assertSessionOpen()
|
||||
# returns 1 on failure
|
||||
sub assertSessionOpen() {
|
||||
my ($self) = shift;
|
||||
_useMacCVSLib() || die "Could not load MacCVSLib\n";
|
||||
my $script = <<END_OF_APPLESCRIPT;
|
||||
tell (load script file "$MacCVSLib") to OpenSession("$self->{session_file}")
|
||||
END_OF_APPLESCRIPT
|
||||
return _myDoAppleScript($script);
|
||||
}
|
||||
|
||||
# prints the cvs object, used mostly for debugging
|
||||
sub print {
|
||||
my($self) = shift;
|
||||
print "MacCVS:: name: ", $self->{name}, " session file: ", $self->{session_file}, "\n";
|
||||
}
|
||||
|
||||
# checkout( self, module, revision, date)
|
||||
# MacCVS checkout command
|
||||
# returns 1 on failure
|
||||
sub checkout
|
||||
{
|
||||
my($self, $module, $revision, $date ) = @_;
|
||||
unless( defined ($module) ) { $module = ""; } # get rid of the pesky undefined warnings
|
||||
unless( defined ($revision) ) { $revision = ""; }
|
||||
unless( defined ($date) ) { $date = ""; }
|
||||
|
||||
$self->assertSessionOpen() || return 1;
|
||||
|
||||
my($revstring) = ($revision ne "") ? $revision : "(none)";
|
||||
my($datestring) = ($date ne "") ? $date : "(none)";
|
||||
|
||||
print "Checking out $module with revision $revstring, date $datestring\n";
|
||||
|
||||
my $script = <<END_OF_APPLESCRIPT;
|
||||
tell (load script file "$MacCVSLib") to Checkout given sessionName:"$self->{name}", module:"$module", revision:"$revision", date:"$date"
|
||||
END_OF_APPLESCRIPT
|
||||
return _myDoAppleScript($script);
|
||||
}
|
||||
|
||||
1;
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
MacCVS - Interface to MacCVS
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use MacCVS;
|
||||
$session = MacCVS->new( <session_file_path>) || die "cannot create session";
|
||||
$session->checkout([module] [revision] [date]) || die "Could not check out";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This is a MacCVS interface for talking to MacCVS Pro client.
|
||||
MacCVSSession is the class used to manipulate the session
|
||||
|
||||
=item new
|
||||
MacCVS->new( <cvs session file path>);
|
||||
|
||||
Creates a new session. Returns undef on failure.
|
||||
|
||||
=item checkout( <module> [revision] [date] )
|
||||
|
||||
cvs checkout command. Revision and date are optional
|
||||
returns 0 on failure
|
||||
|
||||
=cut
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
=over
|
||||
|
||||
=item MacCVS Home Page
|
||||
|
||||
http://www.maccvs.org/
|
||||
|
||||
=back
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Aleks Totic atotic@netscape.com
|
||||
|
||||
=cut
|
||||
|
||||
__END__
|
Двоичные данные
build/mac/MacCVSLib
Двоичные данные
build/mac/MacCVSLib
Двоичный файл не отображается.
|
@ -1,146 +0,0 @@
|
|||
#!perl -w
|
||||
# make-jars [-d <destPath>] < <manifest.jr>
|
||||
|
||||
package MozJar;
|
||||
|
||||
require 5.004;
|
||||
|
||||
use strict;
|
||||
use Cwd;
|
||||
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
|
||||
use Moz;
|
||||
|
||||
use vars qw( @ISA @EXPORT );
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(ProcessJarManifest);
|
||||
|
||||
sub _addToJar($$$$$)
|
||||
{
|
||||
my($thing, $srcPath, $jarManDir, $zip, $compress) = @_;
|
||||
#print "_addToJar($thing, $srcPath, $jarManDir, $zip, $compress)\n";
|
||||
|
||||
my $existingMember = $zip->memberNamed($thing);
|
||||
if ($existingMember) {
|
||||
my $modtime = $existingMember->lastModTime();
|
||||
print "already have $thing at $modtime\n"; # XXX need to check mod time here!
|
||||
return 0;
|
||||
}
|
||||
|
||||
my $filepath = "$jarManDir:$srcPath";
|
||||
$filepath =~ s|/|:|g;
|
||||
|
||||
if (!-e $filepath) {
|
||||
$srcPath =~ /([\w\d.:\-\\\/]+)[:\\\/]([\w\d.\-]+)/;
|
||||
$filepath = "$jarManDir:$2";
|
||||
if (!-e $filepath) {
|
||||
die "$filepath does not exist\n";
|
||||
}
|
||||
}
|
||||
|
||||
my $member = Archive::Zip::Member->newFromFile($filepath);
|
||||
die "Failed to create zip file member $filepath\n" unless $member;
|
||||
|
||||
$member->fileName($thing);
|
||||
|
||||
print "Adding $filepath as $thing\n";
|
||||
|
||||
if ($compress) {
|
||||
$member->desiredCompressionMethod(Archive::Zip::COMPRESSION_DEFLATED);
|
||||
} else {
|
||||
$member->desiredCompressionMethod(Archive::Zip::COMPRESSION_STORED);
|
||||
}
|
||||
|
||||
$zip->addMember($member);
|
||||
}
|
||||
|
||||
sub JarIt($$)
|
||||
{
|
||||
my ($jarfile, $zip) = @_;
|
||||
#print "+++ jarring $jarfile\n";
|
||||
#flush();
|
||||
#system "zip -u $jarfile $args\n";
|
||||
my $jarTempFile = $jarfile . ".temp";
|
||||
$zip->writeToFileNamed($jarTempFile) == AZ_OK
|
||||
|| die "zip writeToFileNamed $jarTempFile failed";
|
||||
|
||||
# set the file type/creator to something reasonable
|
||||
MacPerl::SetFileInfo("ZIP ", "ZIP ", $jarTempFile);
|
||||
rename($jarTempFile, $jarfile);
|
||||
print "+++ finished jarring $jarfile\n";
|
||||
}
|
||||
|
||||
sub ProcessJarManifest($$)
|
||||
{
|
||||
my ($jarManPath, $destPath) = @_;
|
||||
|
||||
$jarManPath = Moz::full_path_to($jarManPath);
|
||||
$destPath = Moz::full_path_to($destPath);
|
||||
#print "ProcessJarManifest($jarManPath, $destPath)\n";
|
||||
|
||||
print "+++ jarring $jarManPath\n";
|
||||
|
||||
my $jarManDir = "";
|
||||
my $jarManFile = "";
|
||||
if ($jarManPath =~ /([\w\d.:\-\\\/]+)[:\\\/]([\w\d.\-]+)/) {
|
||||
$jarManDir = $1;
|
||||
$jarManFile = $2;
|
||||
}
|
||||
else {
|
||||
die "bad jar.mn specification";
|
||||
}
|
||||
|
||||
open(FILE, "<$jarManPath") || die "could not open $jarManPath: $!";
|
||||
while (<FILE>) {
|
||||
chomp;
|
||||
start:
|
||||
if (/^([\w\d.\-\\\/]+)\:\s*$/) {
|
||||
my $jarfile = "$destPath/$1";
|
||||
$jarfile =~ s|/|:|g;
|
||||
#my $args = "";
|
||||
|
||||
my $zip = Archive::Zip->new();
|
||||
#print "new jar $jarfile\n";
|
||||
if (-e $jarfile) {
|
||||
#print "=====> $jarfile exists\n";
|
||||
my $ok = $zip->read($jarfile);
|
||||
if ($ok != AZ_OK) {
|
||||
die "zip read $jarfile failed: $ok";
|
||||
}
|
||||
}
|
||||
|
||||
while (<FILE>) {
|
||||
if (/^\s+([\w\d.\-\\\/]+)\s*(\([\w\d.\-\\\/]+\))?$\s*/) {
|
||||
my $dest = $1;
|
||||
my $srcPath = $2;
|
||||
if ( $srcPath ) {
|
||||
$srcPath = substr($srcPath,1,-1);
|
||||
}
|
||||
else {
|
||||
$srcPath = ":" . $dest;
|
||||
}
|
||||
$srcPath =~ s|/|:|g;
|
||||
|
||||
_addToJar($dest, $srcPath, $jarManDir, $zip, 1);
|
||||
} elsif (/^\s*$/) {
|
||||
# end with blank line
|
||||
last;
|
||||
} else {
|
||||
JarIt($jarfile, $zip);
|
||||
goto start;
|
||||
}
|
||||
}
|
||||
JarIt($jarfile, $zip);
|
||||
|
||||
} elsif (/^\s*\#.*$/) {
|
||||
# skip comments
|
||||
} elsif (/^\s*$/) {
|
||||
# skip blank lines
|
||||
} else {
|
||||
close;
|
||||
die "bad jar rule head at: $_";
|
||||
}
|
||||
}
|
||||
close(FILE);
|
||||
}
|
||||
|
563
build/mac/Moz.pm
563
build/mac/Moz.pm
|
@ -1,563 +0,0 @@
|
|||
=head1 NAME
|
||||
|
||||
B<Moz> - routines for automating CodeWarrior builds, and some extra-curricular activities related to building Mozilla
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use Moz;
|
||||
|
||||
OpenErrorLog(":::BuildLog");
|
||||
StopForErrors();
|
||||
|
||||
$Moz::QUIET = 1;
|
||||
InstallFromManifest(":projects:MANIFEST", $dist_dir);
|
||||
|
||||
BuildProjectClean(":projects:SomeProject.mcp", "SomeTarget");
|
||||
MakeAlias(":projects:SomeProject.shlb", $dist_dir);
|
||||
|
||||
DontStopForErrors();
|
||||
|
||||
BuildProject(":projects:SomeOtherProject.mcp", "SomeTarget");
|
||||
|
||||
=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.
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
|
||||
|
||||
package Moz;
|
||||
require Exporter;
|
||||
|
||||
use Mac::Types;
|
||||
use Mac::Events;
|
||||
use Mac::Processes;
|
||||
use File::Copy;
|
||||
use mozBDate;
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(LaunchCodeWarrior BuildProject BuildProjectClean GetFileModDate OpenErrorLog MakeAlias StopForErrors DontStopForErrors InstallFromManifest InstallResources SetBuildNumber SetAgentString SetTimeBomb Delay ActivateApplication);
|
||||
@EXPORT_OK = qw(CloseErrorLog UseCodeWarriorLib QUIET);
|
||||
|
||||
use Cwd;
|
||||
use File::Path;
|
||||
use ExtUtils::Manifest 'maniread';
|
||||
|
||||
use CodeWarriorLib;
|
||||
|
||||
sub current_directory()
|
||||
{
|
||||
my $current_directory = cwd();
|
||||
chop($current_directory) if ( $current_directory =~ m/:$/ );
|
||||
return $current_directory;
|
||||
}
|
||||
|
||||
sub full_path_to($)
|
||||
{
|
||||
my ($path) = @_;
|
||||
if ( $path =~ m/^[^:]+$/ )
|
||||
{
|
||||
$path = ":" . $path;
|
||||
}
|
||||
|
||||
if ( $path =~ m/^:/ )
|
||||
{
|
||||
$path = current_directory() . $path;
|
||||
}
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
=head2 Setup
|
||||
|
||||
Pretty much, everything is taken care of for you.
|
||||
However, B<Moz> does use a little compiled AppleScript library (the file CodeWarriorLib) for some of its communcication with CodeWarrior.
|
||||
If this library isn't in the same directory as "Moz.pm", then you need to tell B<Moz> where to find it.
|
||||
Call C<UseCodeWarriorLib($path_to_CodeWarriorLib)>.
|
||||
This routine is not exported by default, nor are you likely to need it.
|
||||
|
||||
=cut
|
||||
|
||||
sub UseCodeWarriorLib($)
|
||||
{
|
||||
# ($CodeWarriorLib) = @_;
|
||||
# $CodeWarriorLib = full_path_to($CodeWarriorLib);
|
||||
}
|
||||
|
||||
sub activate_CodeWarrior()
|
||||
{
|
||||
#MacPerl::DoAppleScript(<<END_OF_APPLESCRIPT);
|
||||
# tell (load script file "$CodeWarriorLib") to ActivateCodeWarrior()
|
||||
#END_OF_APPLESCRIPT
|
||||
}
|
||||
|
||||
|
||||
$logging = 0;
|
||||
$recent_errors_file = "";
|
||||
$stop_on_1st_error = 1;
|
||||
$QUIET = 0;
|
||||
|
||||
|
||||
|
||||
=head2 Logging all the errors and warnings - C<OpenErrorLog($log_file)>, C<CloseErrorLog()>
|
||||
|
||||
The warnings and errors generated in the course of building projects can be logged to a file.
|
||||
Tinderbox uses this facility to show why a remote build failed.
|
||||
|
||||
Logging is off by default.
|
||||
Start logging at any point in your build process with C<OpenErrorLog($log_file)>.
|
||||
Stop with C<CloseErrorLog()>.
|
||||
You never need to close the log explicitly, unless you want to just log a couple of projects in the middle of a big list.
|
||||
C<CloseErrorLog()> is not exported by default.
|
||||
|
||||
=cut
|
||||
|
||||
sub CloseErrorLog()
|
||||
{
|
||||
if ( $logging )
|
||||
{
|
||||
close(ERROR_LOG);
|
||||
$logging = 0;
|
||||
StopForErrors() if $stop_on_1st_error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub OpenErrorLog($)
|
||||
{
|
||||
my ($log_file) = @_;
|
||||
|
||||
CloseErrorLog();
|
||||
if ( $log_file )
|
||||
{
|
||||
$log_file = full_path_to($log_file);
|
||||
|
||||
open(ERROR_LOG, ">$log_file") || die "Can't open logfile, check the file path.\n";
|
||||
MacPerl::SetFileInfo("CWIE", "TEXT", $log_file);
|
||||
|
||||
$log_file =~ m/.+:(.+)/;
|
||||
$recent_errors_file = full_path_to("$1.part");
|
||||
$logging = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
=head2 Stopping before it's too late - C<StopForErrors()>, C<DontStopForErrors()>
|
||||
|
||||
When building a long list of projects, you decide whether to continue building subsequent projects when one fails.
|
||||
By default, your build script will C<die> after the first project that generates an error while building.
|
||||
Change this behavior with C<DontStopForErrors()>.
|
||||
Re-enable it with C<StopForErrors()>.
|
||||
|
||||
=cut
|
||||
|
||||
sub StopForErrors()
|
||||
{
|
||||
$stop_on_1st_error = 1;
|
||||
|
||||
# Can't stop for errors unless we notice them.
|
||||
# Can't notice them unless we are logging.
|
||||
# If the user didn't explicitly request logging, log to a temporary file.
|
||||
|
||||
if ( ! $recent_errors_file )
|
||||
{
|
||||
OpenErrorLog("${TMPDIR}BuildResults");
|
||||
}
|
||||
}
|
||||
|
||||
sub DontStopForErrors()
|
||||
{
|
||||
$stop_on_1st_error = 0;
|
||||
}
|
||||
|
||||
sub log_message($)
|
||||
{
|
||||
if ( $logging )
|
||||
{
|
||||
my ($message) = @_;
|
||||
print ERROR_LOG $message;
|
||||
}
|
||||
}
|
||||
|
||||
sub log_message_with_time($)
|
||||
{
|
||||
if ( $logging )
|
||||
{
|
||||
my ($message) = @_;
|
||||
my $time_stamp = localtime();
|
||||
log_message("$message ($time_stamp)\n");
|
||||
}
|
||||
}
|
||||
|
||||
sub log_recent_errors($)
|
||||
{
|
||||
my ($project_name) = @_;
|
||||
my $found_errors = 0;
|
||||
|
||||
if ( $logging )
|
||||
{
|
||||
open(RECENT_ERRORS, "<$recent_errors_file");
|
||||
|
||||
while( <RECENT_ERRORS> )
|
||||
{
|
||||
if ( /^Error/ || /^CouldnÕt find project file/ || /^Link Error/ )
|
||||
{
|
||||
# if (!$found_errors)
|
||||
# print $_;
|
||||
$found_errors = 1;
|
||||
}
|
||||
print ERROR_LOG $_;
|
||||
}
|
||||
|
||||
close(RECENT_ERRORS);
|
||||
unlink("$recent_errors_file");
|
||||
}
|
||||
|
||||
if ( $stop_on_1st_error && $found_errors )
|
||||
{
|
||||
print ERROR_LOG "### Build failed.\n";
|
||||
die "### Errors encountered building \"$project_name\".\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub build_project($$$)
|
||||
{
|
||||
my ($project_path, $target_name, $clean_build) = @_;
|
||||
$project_path = full_path_to($project_path);
|
||||
|
||||
# $project_path =~ m/.+:(.+)/;
|
||||
# my $project_name = $1;
|
||||
|
||||
log_message_with_time("### Building \"$project_path\"");
|
||||
|
||||
# Check that the given project exists
|
||||
if (! -e $project_path)
|
||||
{
|
||||
print ERROR_LOG "### Build failed.\n";
|
||||
die "### Can't find project file \"$project_path\".\n";
|
||||
}
|
||||
|
||||
print "Building \"$project_path\[$target_name\]\"\n";
|
||||
|
||||
$had_errors = CodeWarriorLib::build_project(
|
||||
$project_path, $target_name, $recent_errors_file, $clean_build
|
||||
);
|
||||
WaitNextEvent();
|
||||
|
||||
# $had_errors =
|
||||
#MacPerl::DoAppleScript(<<END_OF_APPLESCRIPT);
|
||||
# tell (load script file "$CodeWarriorLib") to BuildProject("$project_path", "$project_name", "$target_name", "$recent_errors_file", $clean_build)
|
||||
#END_OF_APPLESCRIPT
|
||||
|
||||
# Append any errors to the globally accumulated log file
|
||||
# if ( $had_errors ) # Removed this test, because we want warnings, too. -- jrm
|
||||
{
|
||||
log_recent_errors($project_path);
|
||||
}
|
||||
}
|
||||
|
||||
=head2 Getting CodeWarrior to build projects - C<BuildProject($project, $opt_target)>, C<BuildProjectClean($project, $opt_target)>
|
||||
|
||||
C<BuildProject()> and C<BuildProjectClean()> are identical, except that the latter first removes object code.
|
||||
In both, CodeWarrior opens the project if it wasn't already open; builds the given (or else current) target; and finally closes
|
||||
the project, if it wasn't already open.
|
||||
|
||||
=cut
|
||||
|
||||
sub BuildProject($;$)
|
||||
{
|
||||
my ($project_path, $target_name) = @_;
|
||||
build_project($project_path, $target_name, 0);
|
||||
}
|
||||
|
||||
sub BuildProjectClean($;$)
|
||||
{
|
||||
my ($project_path, $target_name) = @_;
|
||||
build_project($project_path, $target_name, 1);
|
||||
}
|
||||
|
||||
|
||||
=head2 Miscellaneous
|
||||
|
||||
C<MakeAlias($old_file, $new_file)> functions like C<symlink()>, except with better argument defaulting and more explicit error messages.
|
||||
|
||||
=cut
|
||||
|
||||
sub MakeAlias($$)
|
||||
{
|
||||
my ($old_file, $new_file) = @_;
|
||||
|
||||
# if the directory to hold $new_file doesn't exist, create it
|
||||
if ( ($new_file =~ m/(.+:)/) && !-d $1 )
|
||||
{
|
||||
mkpath($1);
|
||||
}
|
||||
|
||||
# if a leaf name wasn't specified for $new_file, use the leaf from $old_file
|
||||
if ( ($new_file =~ m/:$/) && ($old_file =~ m/.+:(.+)/) )
|
||||
{
|
||||
$new_file .= $1;
|
||||
}
|
||||
|
||||
my $message = "Can't create a Finder alias (at \"$new_file\")\n for \"$old_file\"; because ";
|
||||
|
||||
die "$message \"$old_file\" doesn't exist.\n" unless -e $old_file;
|
||||
die "$message I won't replace an existing (non-alias) file with an alias.\n" if ( -e $new_file && ! -l $new_file );
|
||||
|
||||
# now: $old_file exists; $new_file doesn't (or else, is an alias already)
|
||||
|
||||
if ( -l $new_file )
|
||||
{
|
||||
# ...then see if it already points to $old_file
|
||||
my $current_target = full_path_to(readlink($new_file));
|
||||
my $new_target = full_path_to($old_file);
|
||||
|
||||
return if ( $current_target eq $new_target );
|
||||
# if the desired alias already exists and points to the right thing, then we're done
|
||||
|
||||
unlink $new_file;
|
||||
}
|
||||
|
||||
symlink($old_file, $new_file) || die "$message symlink returned an unexpected error.\n";
|
||||
}
|
||||
|
||||
|
||||
=pod
|
||||
|
||||
C<InstallFromManifest()>
|
||||
|
||||
=cut
|
||||
|
||||
sub InstallFromManifest($;$$)
|
||||
{
|
||||
my ($manifest_file, $dest_dir, $flat) = @_;
|
||||
|
||||
$flat = 0 unless defined($flat); # if $flat, all rel. paths in MANIFEST get aliased to the root of $dest_dir
|
||||
|
||||
$dest_dir ||= ":";
|
||||
|
||||
$manifest_file =~ m/(.+):/;
|
||||
my $source_dir = $1;
|
||||
|
||||
chop($dest_dir) if $dest_dir =~ m/:$/;
|
||||
|
||||
#Mac::Events->import();
|
||||
WaitNextEvent();
|
||||
if ($flat)
|
||||
{
|
||||
print "Doing manifest on \"$manifest_file\" FLAT\n" unless $QUIET;
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Doing manifest on \"$manifest_file\"\n" unless $QUIET;
|
||||
}
|
||||
|
||||
my $read = maniread(full_path_to($manifest_file));
|
||||
foreach $file (keys %$read)
|
||||
{
|
||||
next unless $file;
|
||||
|
||||
$subdir = ":";
|
||||
if (!$flat && ($file =~ /:.+:/ ))
|
||||
{
|
||||
$subdir = $&;
|
||||
}
|
||||
|
||||
$file = ":$file" unless $file =~ m/^:/;
|
||||
MakeAlias("$source_dir$file", "$dest_dir$subdir");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
=pod
|
||||
|
||||
C<InstallResources()>
|
||||
|
||||
=cut
|
||||
|
||||
# parameters are path to MANIFEST file, destination dir, true (to make copies) or false (to make aliases)
|
||||
sub InstallResources($;$;$)
|
||||
{
|
||||
my ($manifest_file, $dest_dir, $copy_files) = @_;
|
||||
|
||||
$dest_dir ||= ":";
|
||||
mkpath($dest_dir) if !-d $dest_dir;
|
||||
|
||||
$manifest_file =~ m/(.+):/;
|
||||
my $source_dir = $1;
|
||||
|
||||
chop($dest_dir) if $dest_dir =~ m/:$/;
|
||||
|
||||
WaitNextEvent();
|
||||
print "Installing resources from \"$manifest_file\"\n" unless $QUIET;
|
||||
|
||||
my $read = maniread(full_path_to($manifest_file));
|
||||
foreach $file (keys %$read)
|
||||
{
|
||||
next unless $file;
|
||||
|
||||
if ($copy_files)
|
||||
{
|
||||
copy("$source_dir:$file", "$dest_dir:$file");
|
||||
}
|
||||
else
|
||||
{
|
||||
MakeAlias("$source_dir:$file", "$dest_dir:$file");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub SetBuildNumber($$$)
|
||||
{
|
||||
my($build_num_file, $build_gen_script, $files_to_touch) = @_;
|
||||
mozBDate::UpdateBuildNumber($build_num_file, $::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");
|
||||
}
|
||||
}
|
||||
|
||||
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($)
|
||||
|
||||
{
|
||||
my ($delay_seconds) = @_;
|
||||
|
||||
$now = time;
|
||||
|
||||
$exit_time = $now + $delay_seconds;
|
||||
|
||||
while ($exit_time > $now) {
|
||||
$now = time;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
sub GetFileModDate($)
|
||||
{
|
||||
my($filePath)=@_;
|
||||
my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
|
||||
$atime,$mtime,$ctime,$blksize,$blocks) = stat($filePath);
|
||||
return $mtime;
|
||||
}
|
||||
|
||||
|
||||
sub LaunchCodeWarrior()
|
||||
{
|
||||
# this both launches and writes idepath.txt
|
||||
CodeWarriorLib::activate();
|
||||
}
|
||||
|
||||
sub ActivateApplication($)
|
||||
{
|
||||
my ($appSignature) = @_;
|
||||
my ($psi, $found);
|
||||
my ($appPSN);
|
||||
|
||||
$found = 0;
|
||||
|
||||
foreach $psi (values(%Process))
|
||||
{
|
||||
if ($psi->processSignature() eq $appSignature)
|
||||
{
|
||||
$appPSN = $psi->processNumber();
|
||||
$found = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
if ($found == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SetFrontProcess($appPSN);
|
||||
|
||||
while (GetFrontProcess() != $appPSN)
|
||||
{
|
||||
WaitNextEvent();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Scott Collins <scc@netscape.com>, Simon Fraser <sfraser@netscape.com>, Chris Yeh <cyeh@netscape.com>
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
BuildMozillaDebug.pl (et al), BuildList.pm, CodeWarriorLib (an AppleScript library)
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
The contents of this file are subject to the Netscape Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/NPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The Original Code is Mozilla Communicator client code, released
|
||||
March 31, 1998.
|
||||
|
||||
The Initial Developer of the Original Code is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
||||
=cut
|
|
@ -1,172 +0,0 @@
|
|||
|
||||
package MozBuildFlags;
|
||||
|
||||
require 5.004;
|
||||
require Exporter;
|
||||
|
||||
# Package that attempts to read a file from the Preferences folder,
|
||||
# and get build settings out of it
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
|
||||
use MozPrefs;
|
||||
|
||||
use vars qw(@ISA @EXPORT);
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(SetupBuildParams);
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# These 3 arrays are the 'master lists' to control what gets built.
|
||||
# We use arrays here, instead of just intializing the hashes directly,
|
||||
# so that we can start the build at a given stage using a stored key.
|
||||
#
|
||||
# Ordering in these arrays is important; it has to reflect the order in
|
||||
# which the build occurs.
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
my(@pull_flags) =
|
||||
(
|
||||
["moz", 1], # pull everything needed for mozilla
|
||||
["runtime", 0] # used to just build runtime libs, up to NSPR
|
||||
);
|
||||
|
||||
my(@build_flags) =
|
||||
(
|
||||
["all", 1],
|
||||
["dist", 0],
|
||||
["dist_runtime", 0],
|
||||
["xpidl", 0],
|
||||
["idl", 0],
|
||||
["stubs", 0],
|
||||
["runtime", 0],
|
||||
["common", 0],
|
||||
["imglib", 0],
|
||||
["necko", 0],
|
||||
["security", 0],
|
||||
["browserutils", 0],
|
||||
["intl", 0],
|
||||
["nglayout", 0],
|
||||
["editor", 0],
|
||||
["viewer", 0],
|
||||
["xpapp", 0],
|
||||
["extensions", 0],
|
||||
["plugins", 0],
|
||||
["mailnews", 0],
|
||||
["apprunner", 0],
|
||||
["resources", 0],
|
||||
["jars", 0]
|
||||
);
|
||||
|
||||
my(@options_flags) =
|
||||
(
|
||||
["transformiix", 0],
|
||||
["mathml", 0],
|
||||
["svg", 0],
|
||||
["mng", 1],
|
||||
["ldap", 0],
|
||||
["xmlextras", 0],
|
||||
["mailextras", 1], # mail importers
|
||||
["xptlink", 0] # xpt linker codewarrior plugin
|
||||
);
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# End of build flags
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# flagsArrayToHash
|
||||
#
|
||||
# Utility routine to migrate flag from a 2D array to a hash, where
|
||||
# item[n][0] is the hash entry name, and item[n][1] is the hash entry value.
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub flagsArrayToHash($$)
|
||||
{
|
||||
my($src_array, $dest_hash) = @_;
|
||||
|
||||
my($item);
|
||||
foreach $item (@$src_array)
|
||||
{
|
||||
$dest_hash->{$item->[0]} = $item->[1];
|
||||
}
|
||||
}
|
||||
|
||||
#-----------------------------------------------
|
||||
# printHash
|
||||
#
|
||||
# Utility routine to print a hash
|
||||
#-----------------------------------------------
|
||||
sub printHash($)
|
||||
{
|
||||
my($hash_ref) = @_;
|
||||
|
||||
my($key, $value);
|
||||
|
||||
while (($key, $value) = each %$hash_ref)
|
||||
{
|
||||
print "$key $value\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# SetPullFlags
|
||||
#-------------------------------------------------------------------------------
|
||||
sub SetPullFlags($)
|
||||
{
|
||||
my($pull) = @_;
|
||||
|
||||
flagsArrayToHash(\@pull_flags, $pull);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# SetBuildFlags
|
||||
#-------------------------------------------------------------------------------
|
||||
sub SetBuildFlags($)
|
||||
{
|
||||
my($build) = @_;
|
||||
|
||||
flagsArrayToHash(\@build_flags, $build);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# SetBuildOptions
|
||||
#-------------------------------------------------------------------------------
|
||||
sub SetBuildOptions($)
|
||||
{
|
||||
my($options) = @_;
|
||||
|
||||
flagsArrayToHash(\@options_flags, $options);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# SetupBuildParams
|
||||
#-------------------------------------------------------------------------------
|
||||
sub SetupBuildParams($$$)
|
||||
{
|
||||
my($pull, $build, $options) = @_;
|
||||
|
||||
SetPullFlags($pull);
|
||||
SetBuildFlags($build);
|
||||
SetBuildOptions($options);
|
||||
|
||||
print "Build before:\n";
|
||||
printHash($build);
|
||||
|
||||
# read the user pref file, that can change values in the array
|
||||
ReadMozUserPrefs("Mozilla build prefs", $pull, $build, $options);
|
||||
|
||||
print "Build after:\n";
|
||||
printHash($build);
|
||||
}
|
||||
|
||||
|
||||
1;
|
|
@ -1,600 +0,0 @@
|
|||
#!perl -w
|
||||
package MozJar;
|
||||
|
||||
#
|
||||
# Module for creating jar files, either using a jar manifest, or
|
||||
# simply jarring up folders on disk.
|
||||
#
|
||||
|
||||
require 5.004;
|
||||
require Exporter;
|
||||
|
||||
use strict;
|
||||
use Archive::Zip;
|
||||
use File::Path;
|
||||
|
||||
use Mac::Files;
|
||||
|
||||
use Moz;
|
||||
|
||||
use vars qw( @ISA @EXPORT );
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(CreateJarFileFromDirectory WriteOutJarFiles SanityCheckJarOptions);
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Add the contents of a directory to the zip file
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
sub _addDirToJar($$$$)
|
||||
{
|
||||
my($dir, $jar_root, $zip, $compress) = @_;
|
||||
|
||||
opendir(DIR, $dir) or die "Cannot open dir $dir\n";
|
||||
my @files = readdir(DIR);
|
||||
closedir DIR;
|
||||
|
||||
my $unix_jar_root = $jar_root;
|
||||
$unix_jar_root =~ s|:|/|g; # colon to slash conversion
|
||||
|
||||
my $file;
|
||||
|
||||
foreach $file (@files)
|
||||
{
|
||||
my $filepath = $dir.":".$file;
|
||||
|
||||
if (-d $filepath)
|
||||
{
|
||||
print "Adding files to jar from $filepath\n";
|
||||
_addDirToJar($filepath, $jar_root, $zip, $compress);
|
||||
}
|
||||
else
|
||||
{
|
||||
my $member = Archive::Zip::Member->newFromFile($filepath);
|
||||
die "Failed to create zip file member $filepath\n" unless $member;
|
||||
|
||||
my $unixName = $filepath;
|
||||
$unixName =~ s|:|/|g; # colon to slash conversion
|
||||
$unixName =~ s|^$unix_jar_root||; # relativise
|
||||
|
||||
$member->fileName($unixName);
|
||||
|
||||
# print "Adding $file as $unixName\n";
|
||||
|
||||
if ($compress) {
|
||||
$member->desiredCompressionMethod(Archive::Zip::COMPRESSION_DEFLATED);
|
||||
} else {
|
||||
$member->desiredCompressionMethod(Archive::Zip::COMPRESSION_STORED);
|
||||
}
|
||||
|
||||
$zip->addMember($member);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Add the contents of a directory to the zip file
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub CreateJarFileFromDirectory($$$)
|
||||
{
|
||||
my($srcdir, $jarpath, $compress) = @_;
|
||||
|
||||
my $zip = Archive::Zip->new();
|
||||
|
||||
_addDirToJar($srcdir, $srcdir, $zip, $compress);
|
||||
|
||||
print "Saving zip file...\n";
|
||||
my $status = $zip->writeToFileNamed($jarpath);
|
||||
if ($status == 0) {
|
||||
print "Zipping completed successfully\n";
|
||||
} else {
|
||||
print "Error saving zip file\n";
|
||||
}
|
||||
|
||||
# set the file type/creator to something reasonable
|
||||
MacPerl::SetFileInfo("ZIP ", "ZIP ", $jarpath);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# SanityCheckJarOptions
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
sub SanityCheckJarOptions()
|
||||
{
|
||||
if (! $main::options{jar_manifests})
|
||||
{
|
||||
print "\$options{jar_manifests} is off, which means you are using obsolete MANIFEST files to install chrome resources.\n";
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$main::options{chrome_jars} && !$main::options{chrome_files})
|
||||
{
|
||||
print "Both \$options{chrome_jars} and \$options{chrome_files} are off. You won't get any chrome.\n";
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$main::options{chrome_jars} && $main::options{use_jars})
|
||||
{
|
||||
print "\$options{chrome_jars} is off but \$options{use_jars} is on. Your build won't run (expects jars, got files).\n";
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$main::options{chrome_files} && !$main::options{use_jars})
|
||||
{
|
||||
print "\$options{chrome_jars} is off but \$options{chrome_files} is on. Your build won't run (expects files, got jars).\n";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# printZipContents
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
sub printZipContents($)
|
||||
{
|
||||
my($zip) = @_;
|
||||
|
||||
my(@members) = $zip->memberNames();
|
||||
|
||||
print "Zip contains:\n";
|
||||
|
||||
my($member);
|
||||
foreach $member (@members)
|
||||
{
|
||||
print " $member\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# safeSaveJarFile
|
||||
#
|
||||
# Archive::Zip has a problem where you cannot save a zip file on top of
|
||||
# an existing zip file that it has open, because it holds references
|
||||
# into that zip. So we have to save to a temp file, then do a swap.
|
||||
#
|
||||
# Note that the zip will become invalid after this operation.
|
||||
# If you want to do further operations on it, you'll have to reread it.
|
||||
#-------------------------------------------------------------------------------
|
||||
sub safeSaveJarFile($$)
|
||||
{
|
||||
my($zip, $full_dest_path) = @_;
|
||||
|
||||
my($temp_file_name) = $full_dest_path."_temp";
|
||||
|
||||
($zip->writeToFileNamed($temp_file_name) == Archive::Zip::AZ_OK) || die "Error writing jar to temp file $temp_file_name\n";
|
||||
|
||||
unlink $full_dest_path;
|
||||
|
||||
(rename $temp_file_name, $full_dest_path) || die "Failed to rename $temp_file_name\n";
|
||||
|
||||
MacPerl::SetFileInfo("ZIP ", "ZIP ", $full_dest_path);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# addToJarFile
|
||||
#
|
||||
# Add a file to a jar file
|
||||
#
|
||||
# Parameters:
|
||||
# 1. Jar ID. Unix path of jar file inside chrome.
|
||||
# 2. Abs path to jar.mn file (i.e. source) (mac breaks)
|
||||
# 3. File source, relative to jar.mn path (mac breaks)
|
||||
# 4. Abs path to the resulting .jar file (mac breaks)
|
||||
# 5. Relative file path within the jar (unix breaks)
|
||||
# 6. Reference to hash of jar files
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub addToJarFile($$$$$$$)
|
||||
{
|
||||
my($jar_id, $jar_man_dir, $file_src, $jar_path, $file_jar_path, $override, $jars) = @_;
|
||||
|
||||
# print "addToJarFile with:\n $jar_man_dir\n $file_src\n $jar_path\n $file_jar_path\n";
|
||||
|
||||
unless ($jar_path =~ m/(.+:)([^:]+)$/) { die "Bad jar path $jar_path\n"; }
|
||||
|
||||
my($target_dir) = $1;
|
||||
my($jar_name) = $2;
|
||||
|
||||
$target_dir =~ s/[^:]+$//;
|
||||
|
||||
# print "¥ $target_dir $jar_name\n";
|
||||
|
||||
# find the source file
|
||||
my($src) = $jar_man_dir.":".$file_src;
|
||||
if ((!-e $src) && ($file_src =~ m/.+:([^:]+)$/)) # src does not exist. Fall back to looking for src in jar.mn dir
|
||||
{
|
||||
$file_src = $1;
|
||||
$src = $jar_man_dir.":".$file_src;
|
||||
|
||||
if (!-e $src) {
|
||||
die "Can't find chrome file $src\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ($main::options{chrome_jars})
|
||||
{
|
||||
my($zip) = $jars->{$jar_id};
|
||||
unless ($zip) { die "Can't find Zip entry for $jar_id\n"; }
|
||||
|
||||
# print "Adding $file_src to jar file $jar_path at $file_jar_path\n";
|
||||
my($member) = Archive::Zip::Member->newFromFile($src);
|
||||
unless ($member) { die "Failed to create zip file member $src\n"; }
|
||||
|
||||
$member->fileName($file_jar_path);
|
||||
|
||||
my($compress) = 1;
|
||||
if ($compress) {
|
||||
$member->desiredCompressionMethod(Archive::Zip::COMPRESSION_DEFLATED);
|
||||
$member->desiredCompressionLevel(Archive::Zip::COMPRESSION_LEVEL_DEFAULT); # defaults to 6
|
||||
} else {
|
||||
$member->desiredCompressionMethod(Archive::Zip::COMPRESSION_STORED);
|
||||
}
|
||||
|
||||
my($old_member) = $zip->memberNamed($file_jar_path);
|
||||
|
||||
if ($override)
|
||||
{
|
||||
if ($old_member)
|
||||
{
|
||||
# print "Overriding $file_jar_path in jar file $jar_id\n";
|
||||
# need to compare mod dates or use the + here
|
||||
$zip->removeMember($old_member);
|
||||
}
|
||||
|
||||
$zip->addMember($member);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($old_member)
|
||||
{
|
||||
#compare dates here
|
||||
my($member_moddate) = $old_member->lastModTime();
|
||||
my($file_moddate) = GetFileModDate($src);
|
||||
|
||||
if ($file_moddate > $member_moddate)
|
||||
{
|
||||
print "Updating older file $file_jar_path in $jar_id\n";
|
||||
$zip->removeMember($old_member);
|
||||
$zip->addMember($member);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "File $file_jar_path in $jar_id is more recent. Not updating.\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$zip->addMember($member);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($main::options{chrome_files}) # we install raw files too
|
||||
{
|
||||
my($rel_path) = $file_jar_path;
|
||||
$rel_path =~ s|/|:|g; # slash to colons
|
||||
|
||||
my($dir_name) = $jar_name;
|
||||
$dir_name =~ s/\.jar$//;
|
||||
|
||||
my($dst) = $target_dir.$dir_name.":".$rel_path;
|
||||
|
||||
# print "Aliassing $src\n to\n$dst\n";
|
||||
if ($override)
|
||||
{
|
||||
unlink $dst;
|
||||
MakeAlias($src, $dst); # don't check errors, otherwise we fail on replacement
|
||||
}
|
||||
else
|
||||
{
|
||||
if (-e $dst)
|
||||
{
|
||||
#compare dates here
|
||||
my($dst_moddate) = GetFileModDate($dst);
|
||||
my($file_moddate) = GetFileModDate($src);
|
||||
|
||||
if ($file_moddate > $dst_moddate)
|
||||
{
|
||||
print "Updating older file $rel_path in $dir_name\n";
|
||||
unlink $dst;
|
||||
MakeAlias($src, $dst);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "File $file_jar_path in $jar_id is more recent. Not updating.\n";
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
MakeAlias($src, $dst);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# setupJarFile
|
||||
#
|
||||
# setup a zip for writing
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub setupJarFile($$$)
|
||||
{
|
||||
my($jar_id, $dest_path, $jar_hash) = @_;
|
||||
|
||||
# print "Creating jar file $jar_id at $jar_path\n";
|
||||
|
||||
my($jar_file) = $jar_id;
|
||||
$jar_file =~ s|/|:|g; # slash to colons
|
||||
my($full_jar_path) = Moz::full_path_to($dest_path.":".$jar_file);
|
||||
|
||||
if ($main::options{chrome_jars})
|
||||
{
|
||||
my($zip) = $jar_hash->{$jar_id};
|
||||
if (!$zip) # if we haven't made it already, do so
|
||||
{
|
||||
my($zip) = Archive::Zip->new();
|
||||
$jar_hash->{$jar_id} = $zip;
|
||||
|
||||
# does the jar file exist already? If so, read it in
|
||||
if (-e $full_jar_path)
|
||||
{
|
||||
print "Reading in jar file $jar_id\n";
|
||||
if ($zip->read($full_jar_path) != Archive::Zip::AZ_OK) { die "Failed to re-read $full_jar_path\n"; }
|
||||
|
||||
# printZipContents($zip);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
# installing files.
|
||||
# nothing to do. MakeAlias creates dirs as needed.
|
||||
|
||||
# add this jar to the list
|
||||
$jar_hash->{$jar_id} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# closeJarFile
|
||||
#
|
||||
# We're done with this jar file _for this jar.mn_. We may add more entries
|
||||
# to it later, so keep it open in the hash.
|
||||
#-------------------------------------------------------------------------------
|
||||
sub closeJarFile($$)
|
||||
{
|
||||
my($jar_path, $jar_hash) = @_;
|
||||
|
||||
# print "Closing jar file $jar_path\n";
|
||||
|
||||
if ($main::options{chrome_jars})
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
# installing files.
|
||||
# nothing to do
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# WriteOutJarFiles
|
||||
#
|
||||
# Now we dump out the jars
|
||||
#-------------------------------------------------------------------------------
|
||||
sub WriteOutJarFiles($$)
|
||||
{
|
||||
my($chrome_dir, $jars) = @_;
|
||||
|
||||
unless ($main::options{chrome_jars}) { return; }
|
||||
|
||||
my($full_chrome_path) = Moz::full_path_to($chrome_dir);
|
||||
|
||||
my($key);
|
||||
foreach $key (keys %$jars)
|
||||
{
|
||||
my($zip) = $jars->{$key};
|
||||
|
||||
my($rel_path) = $key;
|
||||
$rel_path =~ s/\//:/g;
|
||||
|
||||
my($output_path) = $full_chrome_path.":".$rel_path;
|
||||
|
||||
print "Writing zip file $key to $output_path\n";
|
||||
|
||||
# ensure the target dirs exist
|
||||
my($path) = $output_path;
|
||||
$path =~ s/[^:]+$//;
|
||||
mkpath($path);
|
||||
|
||||
# unlink $output_path; # remove any existing jar
|
||||
safeSaveJarFile($zip, $output_path);
|
||||
# $zip is invalid after this operation, so nuke it here
|
||||
$jars->{$key} = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# registerChromePackage
|
||||
#
|
||||
# Enter a chrome package into the installed-chrome.txt file
|
||||
#-------------------------------------------------------------------------------
|
||||
sub registerChromePackage($$$$$$)
|
||||
{
|
||||
my($jar_file, $file_path, $chrome_dir, $jar_hash, $chrome_type, $pkg_name) = @_;
|
||||
|
||||
my($manifest_subdir) = $jar_file;
|
||||
$manifest_subdir =~ s/:/\//g;
|
||||
|
||||
my($chrome_entry);
|
||||
|
||||
if ($main::options{use_jars}) {
|
||||
$chrome_entry = "$chrome_type,install,url,jar:resource:/chrome/$manifest_subdir!/$chrome_type/$pkg_name";
|
||||
} else {
|
||||
$manifest_subdir =~ s/\.jar$//;
|
||||
$chrome_entry = "$chrome_type,install,url,resource:/chrome/$manifest_subdir/$chrome_type/$pkg_name";
|
||||
}
|
||||
|
||||
# print "Entering $chrome_entry in installed-chrome.txt\n";
|
||||
|
||||
# ensure chrome_dir exists
|
||||
mkpath($chrome_dir);
|
||||
|
||||
my($inst_chrome) = ${chrome_dir}.":installed-chrome.txt";
|
||||
|
||||
if (open(CHROMEFILE, "<$inst_chrome")) {
|
||||
while (<CHROMEFILE>) {
|
||||
chomp;
|
||||
if ($_ eq $chrome_entry) {
|
||||
# $chrome_entry already appears in installed-chrome.txt file
|
||||
# just update the mod date
|
||||
my $now = time;
|
||||
utime($now, $now, $inst_chrome) || die "couldn't touch $inst_chrome";
|
||||
print "+++ updating chrome $inst_chrome\n+++\t\t$chrome_entry\n";
|
||||
close(CHROMEFILE) || die "error: can't close $inst_chrome: $!";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
close(CHROMEFILE) || die "error: can't close $inst_chrome: $!";
|
||||
}
|
||||
open(CHROMEFILE, ">>${inst_chrome}") || die "Failed to open $inst_chrome\n";
|
||||
print(CHROMEFILE "${chrome_entry}\n");
|
||||
close(CHROMEFILE) || die "Failed to close $inst_chrome\n";
|
||||
print "+++ adding chrome $inst_chrome\n+++\t\t$chrome_entry\n";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Create or add to a jar file from a jar.mn file.
|
||||
# Both arguments are relative to the mozilla root dir.
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
sub CreateJarFromManifest($$$)
|
||||
{
|
||||
my($jar_man_path, $dest_path, $jars) = @_;
|
||||
|
||||
if ($main::options{chrome_jars}) {
|
||||
print "Jarring from $jar_man_path\n";
|
||||
}
|
||||
if ($main::options{chrome_files}) {
|
||||
print "Installing files from $jar_man_path\n";
|
||||
}
|
||||
|
||||
$jar_man_path = Moz::full_path_to($jar_man_path);
|
||||
$dest_path = Moz::full_path_to($dest_path);
|
||||
|
||||
# if the jars hash is empty, nuke installed-chrome.txt
|
||||
if (! scalar(%$jars))
|
||||
{
|
||||
print "Nuking installed-chrome.txt\n";
|
||||
my($installed_chrome) = $dest_path.":installed-chrome.txt";
|
||||
# unlink $installed_chrome;
|
||||
}
|
||||
|
||||
my $jar_man_dir = "";
|
||||
my $jar_man_file = "";
|
||||
|
||||
if ($jar_man_path =~ /(.+):([^:]+)$/)
|
||||
{
|
||||
$jar_man_dir = $1; # no trailing :
|
||||
$jar_man_file = $2;
|
||||
}
|
||||
|
||||
# Keep a hash of jar files, keyed on relative jar path (e.g. "packages/core.jar")
|
||||
# Entries are open Archive::Zips (if zipping), and installed-chrome entries.
|
||||
|
||||
my($jar_id) = ""; # Current foo/bar.jar from jar.mn file
|
||||
my($jar_file) = ""; # relative path to jar file (from $dest_path), with mac separators
|
||||
my($full_jar_path);
|
||||
|
||||
open(FILE, "<$jar_man_path") || die "could not open \"$jar_man_path\": $!";
|
||||
while (<FILE>)
|
||||
{
|
||||
my($line) = $_;
|
||||
chomp($line);
|
||||
|
||||
# print "$line\n";
|
||||
|
||||
if ($line =~ /^\s*\#.*$/) { # skip comments
|
||||
next;
|
||||
}
|
||||
|
||||
if ($line =~/^([\w\d.\-\_\\\/]+)\:\s*$/) # line start jar file entries
|
||||
{
|
||||
$jar_id = $1;
|
||||
$jar_file = $jar_id;
|
||||
$jar_file =~ s|/|:|g; # slash to colons
|
||||
$full_jar_path = $dest_path.":".$jar_file;
|
||||
|
||||
setupJarFile($jar_id, $dest_path, $jars);
|
||||
|
||||
}
|
||||
elsif ($line =~ /^(\+?)\s+([\w\d.\-\_\\\/]+)\s*(\([\w\d.\-\_\\\/]+\))?$\s*/) # jar file entry
|
||||
{
|
||||
my($override) = ($1 eq "+");
|
||||
my($file_dest) = $2;
|
||||
my($file_src) = $3;
|
||||
|
||||
if ($file_src) {
|
||||
$file_src = substr($file_src, 1, -1); #strip the ()
|
||||
} else {
|
||||
$file_src = $file_dest;
|
||||
}
|
||||
|
||||
$file_src =~ s|/|:|g;
|
||||
|
||||
if ($jar_file ne "") # if jar is open, add to jar
|
||||
{
|
||||
if ($file_dest =~ /([\w\d.\-\_]+)\/([\w\d.\-\_\\\/]+)contents.rdf/)
|
||||
{
|
||||
my $chrome_type = $1;
|
||||
my $pkg_name = $2;
|
||||
registerChromePackage($jar_file, $file_dest, $dest_path, $jars, $chrome_type, $pkg_name);
|
||||
}
|
||||
|
||||
addToJarFile($jar_id, $jar_man_dir, $file_src, $full_jar_path, $file_dest, $override, $jars);
|
||||
}
|
||||
else
|
||||
{
|
||||
die "bad jar.mn format at $line\n";
|
||||
}
|
||||
}
|
||||
elsif ($line =~ /^\s*$/ ) # blank line
|
||||
{
|
||||
if ($jar_file ne "") #if a jar file is open, close it
|
||||
{
|
||||
closeJarFile($full_jar_path, $jars);
|
||||
|
||||
$jar_file = "";
|
||||
$full_jar_path = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
close(FILE);
|
||||
|
||||
if ($jar_file ne "") #if a jar file is open, close it
|
||||
{
|
||||
closeJarFile($full_jar_path, $jars);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
1;
|
|
@ -1,146 +0,0 @@
|
|||
|
||||
package MozPrefs;
|
||||
|
||||
require 5.004;
|
||||
require Exporter;
|
||||
|
||||
# Package that attempts to read a file from the Preferences folder,
|
||||
# and get build settings out of it
|
||||
|
||||
use strict;
|
||||
|
||||
use Exporter;
|
||||
use Mac::Files;
|
||||
|
||||
use vars qw(@ISA @EXPORT);
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(ReadMozUserPrefs);
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# GetPrefsFolder
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub GetPrefsFolder()
|
||||
{
|
||||
my($prefs_folder) = FindFolder(kOnSystemDisk, kPreferencesFolderType, 1);
|
||||
return $prefs_folder;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# WriteDefaultPrefsFile
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub WriteDefaultPrefsFile($)
|
||||
{
|
||||
my($file_path) = @_;
|
||||
|
||||
my($file_contents);
|
||||
$file_contents = <<'EOS';
|
||||
% 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 with modify the default build settings. Examples are:
|
||||
%
|
||||
% pull runtime 1 % just pull runtime
|
||||
% options mng 1 % turn mng on
|
||||
% build jars 0 % don't build jar files
|
||||
%
|
||||
% Note that by default, the scripts have $build{"all"} and $pull{"all"}
|
||||
% turned on, which overrides other settings. To do partial builds, turn
|
||||
% these off thus:
|
||||
% build all 0
|
||||
%
|
||||
EOS
|
||||
|
||||
$file_contents =~ s/%/#/g;
|
||||
|
||||
open(PREFS_FILE, "> $file_path") || die "Could not write default prefs file\n";
|
||||
print PREFS_FILE ($file_contents);
|
||||
close(PREFS_FILE);
|
||||
|
||||
MacPerl::SetFileInfo("McPL", "TEXT", $file_path);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# ReadPrefsFile
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub ReadPrefsFile($$$$)
|
||||
{
|
||||
my($file_path, $pull_hash, $build_hash, $options_hash) = @_;
|
||||
|
||||
if (open(PREFS_FILE, "< $file_path"))
|
||||
{
|
||||
print "Reading build prefs from $file_path\n";
|
||||
|
||||
while (<PREFS_FILE>)
|
||||
{
|
||||
my($line) = $_;
|
||||
|
||||
if ($line =~ /$\#/) { # ignore comments
|
||||
next;
|
||||
}
|
||||
|
||||
if ($line =~ /$\s*(\w+)\s+(\w+)\s+(\w+)\s*/)
|
||||
{
|
||||
my($array_name) = $1;
|
||||
my($option_name) = $2;
|
||||
my($option_value) = $3;
|
||||
|
||||
if ($array_name eq "pull")
|
||||
{
|
||||
$pull_hash->{$option_name} = $option_value;
|
||||
}
|
||||
elsif ($array_name eq "build")
|
||||
{
|
||||
$build_hash->{$option_name} = $option_value;
|
||||
}
|
||||
elsif ($array_name eq "options")
|
||||
{
|
||||
$options_hash->{$option_name} = $option_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Unknown pref option at $line\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
close(PREFS_FILE);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "No prefs file found at $file_path; using defaults\n";
|
||||
WriteDefaultPrefsFile($file_path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# ReadMozUserPrefs
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub ReadMozUserPrefs($$$$)
|
||||
{
|
||||
my($prefs_file_name, $pull_hash, $build_hash, $options_hash) = @_;
|
||||
|
||||
my($prefs_path) = GetPrefsFolder();
|
||||
$prefs_path .= ":$prefs_file_name";
|
||||
|
||||
ReadPrefsFile($prefs_path, $pull_hash, $build_hash, $options_hash);
|
||||
}
|
||||
|
||||
1;
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,62 +0,0 @@
|
|||
#!perl
|
||||
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
#
|
||||
# nglayout pull script
|
||||
#
|
||||
use Cwd;
|
||||
|
||||
# Make sure we add the config dir to search
|
||||
BEGIN
|
||||
{
|
||||
my ($inc_path) = cwd();
|
||||
$inc_path =~ s/:build:mac$/:config:/;
|
||||
push(@INC, $inc_path);
|
||||
}
|
||||
use Mac::Processes;
|
||||
use NGLayoutBuildList;
|
||||
use Moz;
|
||||
|
||||
# configuration variables
|
||||
$pull{all} = 1;
|
||||
$pull{moz} = 0;
|
||||
$pull{runtime} = 0;
|
||||
|
||||
if ($pull{all})
|
||||
{
|
||||
foreach $k (keys(%pull))
|
||||
{
|
||||
$pull{$k} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
# you should not have to edit anything bellow
|
||||
|
||||
chdir("::::");
|
||||
|
||||
Moz::StopForErrors();
|
||||
#Moz::DontStopForErrors();
|
||||
|
||||
OpenErrorLog("NGLayoutPullLog");
|
||||
|
||||
Checkout();
|
|
@ -1,131 +0,0 @@
|
|||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998-2000 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
package mozBDate;
|
||||
|
||||
use strict;
|
||||
use IO::File;
|
||||
|
||||
BEGIN {
|
||||
use Exporter ();
|
||||
use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
|
||||
|
||||
$VERSION = 1.00;
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(&UpdateBuildNumber &SubstituteBuildNumber);
|
||||
%EXPORT_TAGS = ( );
|
||||
@EXPORT_OK = qw();
|
||||
}
|
||||
|
||||
sub write_number($) {
|
||||
my ($file, $num) = @_;
|
||||
unlink($file);
|
||||
open(OUT, ">$file") || die "$file: $!\n";
|
||||
print OUT "$num\n";
|
||||
close(OUT);
|
||||
}
|
||||
|
||||
sub UpdateBuildNumber($$) {
|
||||
|
||||
my ($outfile, $official) = @_;
|
||||
|
||||
# XP way of doing the build date.
|
||||
# 1998091509 = 1998, September, 15th, 9am local time zone
|
||||
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime;
|
||||
|
||||
# localtime returns year minus 1900
|
||||
$year = $year + 1900;
|
||||
my $build_number = sprintf("%04d%02d%02d%02d", $year, 1+$mon, $mday, $hour);
|
||||
|
||||
if ("$outfile" eq "") {
|
||||
print "$build_number\n";
|
||||
return;
|
||||
}
|
||||
|
||||
if ($official) {
|
||||
&write_number($outfile, $build_number);
|
||||
} else {
|
||||
|
||||
my $old_num = -1;
|
||||
|
||||
# Only overwrite file if contents are not already set to 0
|
||||
if ( -e $outfile ) {
|
||||
open(OLD, "<$outfile") || die "$outfile: $!\n";
|
||||
$old_num = <OLD>;
|
||||
chomp($old_num);
|
||||
close(OLD);
|
||||
}
|
||||
|
||||
if ($old_num != 0) {
|
||||
&write_number($outfile, "0000000000");
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub SubstituteBuildNumber($$$) {
|
||||
|
||||
my ($outfile, $build_num, $infile) = @_;
|
||||
my $INFILE = new IO::File;
|
||||
my $OUTFILE = new IO::File;
|
||||
|
||||
open $INFILE, "<$build_num";
|
||||
my $build = <$INFILE>;
|
||||
close $INFILE;
|
||||
chomp $build;
|
||||
|
||||
if ("$infile" ne "") {
|
||||
open $INFILE, "<$infile" || die;
|
||||
} else {
|
||||
open $INFILE, "<$outfile" || die;
|
||||
}
|
||||
open $OUTFILE, ">${outfile}.old" || die;
|
||||
|
||||
while (<$INFILE>) {
|
||||
|
||||
my $id = $_;
|
||||
my $temp;
|
||||
if ($id =~ "Build ID:") {
|
||||
$temp = "Build ID: " . $build;
|
||||
$id =~ s/Build ID:\s\d+/$temp/;
|
||||
print $OUTFILE $id;
|
||||
}
|
||||
elsif ($id =~ "NS_BUILD_ID") {
|
||||
$temp = "NS_BUILD_ID " . $build;
|
||||
$id =~ s/NS_BUILD_ID\s\d+/$temp/;
|
||||
print $OUTFILE $id;
|
||||
}
|
||||
else {
|
||||
print $OUTFILE $_;
|
||||
}
|
||||
}
|
||||
|
||||
close $INFILE;
|
||||
close $OUTFILE;
|
||||
|
||||
unlink $outfile;
|
||||
rename "${outfile}.old", "$outfile";
|
||||
}
|
||||
|
||||
END {};
|
||||
|
||||
1;
|
||||
|
Загрузка…
Ссылка в новой задаче