зеркало из https://github.com/mozilla/pjs.git
Build script enhancements -- fix the dialogs that pop up to choose a session file, and to locate the IDE. Also do some application activation to lessen pull and build times.
This commit is contained in:
Родитель
84e8595c19
Коммит
ee6c96d07b
|
@ -25,11 +25,12 @@ Replaces the AppleScript library I<CodeWarriorLib>.
|
|||
=cut
|
||||
|
||||
use strict;
|
||||
use Mac::AppleEvents::Simple;
|
||||
use Mac::Types;
|
||||
use Mac::AppleEvents;
|
||||
use Mac::AppleEvents::Simple;
|
||||
use Mac::Processes;
|
||||
use Mac::MoreFiles;
|
||||
use Mac::Types;
|
||||
use Mac::StandardFile;
|
||||
use File::Basename;
|
||||
|
||||
use vars qw($VERSION);
|
||||
|
@ -176,38 +177,54 @@ sub activate () {
|
|||
close(F);
|
||||
}
|
||||
|
||||
if (!$appath || ! -x $appath) {
|
||||
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;
|
||||
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";
|
||||
}
|
||||
chomp($cwd);
|
||||
chdir($cwd);
|
||||
}
|
||||
|
||||
# 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,10 +30,13 @@ B<Moz> comprises the routines needed to slap CodeWarrior around, force it to bui
|
|||
|
||||
package Moz;
|
||||
require Exporter;
|
||||
|
||||
use Mac::Types;
|
||||
use Mac::Events;
|
||||
use Mac::Processes;
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(BuildProject BuildProjectClean OpenErrorLog MakeAlias StopForErrors DontStopForErrors InstallFromManifest SetBuildNumber SetAgentString SetTimeBomb Delay);
|
||||
@EXPORT = qw(BuildProject BuildProjectClean OpenErrorLog MakeAlias StopForErrors DontStopForErrors InstallFromManifest SetBuildNumber SetAgentString SetTimeBomb Delay ActivateApplication);
|
||||
@EXPORT_OK = qw(CloseErrorLog UseCodeWarriorLib QUIET);
|
||||
|
||||
use Cwd;
|
||||
|
@ -204,7 +207,7 @@ sub log_recent_errors($)
|
|||
|
||||
while( <RECENT_ERRORS> )
|
||||
{
|
||||
if ( /^Error/ || /^CouldnÕt find project file/ )
|
||||
if ( /^Error/ || /^CouldnÕt find project file/ || /^Link Error/ )
|
||||
{
|
||||
# if (!$found_errors)
|
||||
# print $_;
|
||||
|
@ -438,6 +441,38 @@ sub Delay($)
|
|||
}
|
||||
|
||||
|
||||
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
|
||||
|
|
|
@ -10,6 +10,7 @@ use vars qw( @ISA @EXPORT );
|
|||
# perl includes
|
||||
use Mac::StandardFile;
|
||||
use Mac::Processes;
|
||||
use Mac::Events;
|
||||
use Cwd;
|
||||
use File::Path;
|
||||
|
||||
|
@ -60,12 +61,10 @@ sub _pickWithMemoryFile($)
|
|||
}
|
||||
unless (defined ($cvsfile))
|
||||
{
|
||||
print "Choose a CVS session file in file dialog box:\n"; # no way to display a prompt?
|
||||
# make sure that MacPerl is a front process
|
||||
while (GetFrontProcess () != GetCurrentProcess())
|
||||
{
|
||||
SetFrontProcess( GetCurrentProcess() );
|
||||
}
|
||||
# make sure that MacPerl is a front process
|
||||
ActivateApplication('McPL');
|
||||
MacPerl::Answer("Could not find your MacCVS session file. Please choose one", "OK");
|
||||
|
||||
# prompt user for the file name, and store it
|
||||
my $macFile = StandardGetFile( 0, "McvD");
|
||||
if ( $macFile->sfGood() )
|
||||
|
@ -108,11 +107,19 @@ sub _getDistDirectory()
|
|||
|
||||
sub Checkout()
|
||||
{
|
||||
# give application activation a chance to happen
|
||||
WaitNextEvent();
|
||||
WaitNextEvent();
|
||||
WaitNextEvent();
|
||||
|
||||
_assertRightDirectory();
|
||||
my($cvsfile) = _pickWithMemoryFile("::nglayout.cvsloc");
|
||||
my($session) = MacCVS->new( $cvsfile );
|
||||
unless (defined($session)) { die "Checkout aborted. Cannot create session file: $session" }
|
||||
|
||||
# activate MacCVS
|
||||
ActivateApplication('Mcvs');
|
||||
|
||||
#//
|
||||
#// Checkout commands
|
||||
#//
|
||||
|
@ -136,6 +143,9 @@ sub BuildDist()
|
|||
unless ( $main::build{dist} ) { return;}
|
||||
_assertRightDirectory();
|
||||
|
||||
# activate MacPerl
|
||||
ActivateApplication('McPL');
|
||||
|
||||
# we really do not need all these paths, but many client projects include them
|
||||
mkpath([ ":mozilla:dist:", ":mozilla:dist:client:", ":mozilla:dist:client_debug:", ":mozilla:dist:client_stubs:" ]);
|
||||
mkpath([ ":mozilla:dist:viewer:", ":mozilla:dist:viewer_debug:" ]);
|
||||
|
@ -738,6 +748,9 @@ sub BuildXPAppProjects()
|
|||
|
||||
sub BuildProjects()
|
||||
{
|
||||
# activate CodeWarrior
|
||||
ActivateApplication('CWIE');
|
||||
|
||||
BuildStubs();
|
||||
BuildCommonProjects();
|
||||
BuildLayoutProjects();
|
||||
|
|
Загрузка…
Ссылка в новой задаче