Bug 194045, Empty chrome directories are left and packaged when building jar files. Stage jar files in a different location. r=bsmedberg r=cls sr=dveditz a=bsmedberg

This commit is contained in:
mark%moxienet.com 2005-07-28 16:17:15 +00:00
parent 3b4cb4864d
commit b950e70b07
3 changed files with 46 additions and 24 deletions

View File

@ -76,6 +76,16 @@ GRE_DIST = $(DIST)/gre
# XPI-contents staging directory for ambitious and right-thinking extensions. # XPI-contents staging directory for ambitious and right-thinking extensions.
FINAL_TARGET = $(if $(XPI_NAME),$(DIST)/xpi-stage/$(XPI_NAME),$(DIST)/bin) FINAL_TARGET = $(if $(XPI_NAME),$(DIST)/xpi-stage/$(XPI_NAME),$(DIST)/bin)
# MAKE_JARS_TARGET is a staging area for make-jars.pl. When packaging in
# the jar format, make-jars leaves behind a directory structure that's not
# needed in $(FINAL_TARGET). For both, flat, and symlink, the directory
# structure contains the chrome, so leave it in $(FINAL_TARGET).
ifeq (jar,$(MOZ_CHROME_FILE_FORMAT))
MAKE_JARS_TARGET = $(if $(XPI_NAME),$(FINAL_TARGET).stage,$(DIST)/chrome-stage)
else
MAKE_JARS_TARGET = $(FINAL_TARGET)
endif
# #
# The VERSION_NUMBER is suffixed onto the end of the DLLs we ship. # The VERSION_NUMBER is suffixed onto the end of the DLLs we ship.
# Since the longest of these is 5 characters without the suffix, # Since the longest of these is 5 characters without the suffix,

View File

@ -1,6 +1,6 @@
#!/perl #!/perl
# make-jars [-f] [-v] [-l] [-x] [-a] [-e] [-d <chromeDir>] [-s <srcdir>] [-t <topsrcdir>] [-c <localedir>] [-z zipprog] [-o operating-system] < <jar.mn> # make-jars [-f] [-v] [-l] [-x] [-a] [-e] [-d <chromeDir>] [-s <srcdir>] [-t <topsrcdir>] [-c <localedir>] [-j <jarDir>] [-z zipprog] [-o operating-system] < <jar.mn>
my $cygwin_mountprefix = ""; my $cygwin_mountprefix = "";
if ($^O eq "cygwin") { if ($^O eq "cygwin") {
@ -49,7 +49,7 @@ foreach my $arg (@ARGV) {
} }
my $defines = join(' ', @ARGV[ $ddindex .. $#ARGV ]); my $defines = join(' ', @ARGV[ $ddindex .. $#ARGV ]);
getopts("d:s:t:c:f:avlD:o:p:xz:e:"); getopts("d:s:t:c:j:f:avlD:o:p:xz:e:");
my $baseFilesDir = "."; my $baseFilesDir = ".";
if (defined($::opt_s)) { if (defined($::opt_s)) {
@ -76,6 +76,14 @@ if (defined($::opt_d)) {
$chromeDir = $::opt_d; $chromeDir = $::opt_d;
} }
my $jarDir = $chromeDir;
if (defined($::opt_j)) {
$jarDir = $::opt_j;
}
if ($jarDir !~ /^\//) {
$jarDir = getcwd() . '/' . $jarDir;
}
my $verbose = 0; my $verbose = 0;
if (defined($::opt_v)) { if (defined($::opt_v)) {
$verbose = 1; $verbose = 1;
@ -145,6 +153,7 @@ if (defined($::opt_o)) {
if ($verbose) { if ($verbose) {
print "make-jars " print "make-jars "
. "-v -d $chromeDir " . "-v -d $chromeDir "
. "-j $jarDir "
. "-z $zipprog " . "-z $zipprog "
. ($fileformat ? "-f $fileformat " : "") . ($fileformat ? "-f $fileformat " : "")
. ($nofilelocks ? "-l " : "") . ($nofilelocks ? "-l " : "")
@ -207,12 +216,13 @@ sub zipErrorCheck($$)
sub JarIt sub JarIt
{ {
my ($destPath, $jarfile, $args, $overrides) = @_; my ($destPath, $jarPath, $jarfile, $args, $overrides) = @_;
my $oldDir = cwd(); my $oldDir = cwd();
my $jarchive = $jarPath . '/' . $jarfile . '.jar';
chdir("$destPath/$jarfile"); chdir("$destPath/$jarfile");
if ("$fileformat" eq "flat" || "$fileformat" eq "symlink") { if ("$fileformat" eq "flat" || "$fileformat" eq "symlink") {
unlink("../$jarfile.jar") if ( -e "../$jarfile.jar"); unlink($jarchive) if ( -e $jarchive);
chdir($oldDir); chdir($oldDir);
return 0; return 0;
} }
@ -227,7 +237,7 @@ sub JarIt
my $cwd = getcwd; my $cwd = getcwd;
my $err = 0; my $err = 0;
#print "$zipprog $zipmoveopt -uX ../$jarfile.jar $args\n"; #print "$zipprog $zipmoveopt -uX $jarchive $args\n";
# Handle posix cmdline limits # Handle posix cmdline limits
while (length($args) > $maxCmdline) { while (length($args) > $maxCmdline) {
@ -237,15 +247,15 @@ sub JarIt
$subargs = substr($args, 0, $pos); $subargs = substr($args, 0, $pos);
$args = substr($args, $pos); $args = substr($args, $pos);
#print "$zipprog $zipmoveopt -uX ../$jarfile.jar $subargs\n"; #print "$zipprog $zipmoveopt -uX $jarchive $subargs\n";
#print "Length of subargs: " . length($subargs) . "\n"; #print "Length of subargs: " . length($subargs) . "\n";
system("$zipprog $zipmoveopt -uX ../$jarfile.jar $subargs") == 0 or system("$zipprog $zipmoveopt -uX $jarchive $subargs") == 0 or
$err = $? >> 8; $err = $? >> 8;
zipErrorCheck($err,$lockfile); zipErrorCheck($err,$lockfile);
} }
#print "Length of args: " . length($args) . "\n"; #print "Length of args: " . length($args) . "\n";
#print "$zipprog $zipmoveopt -uX ../$jarfile.jar $args\n"; #print "$zipprog $zipmoveopt -uX $jarchive $args\n";
system("$zipprog $zipmoveopt -uX ../$jarfile.jar $args") == 0 or system("$zipprog $zipmoveopt -uX $jarchive $args") == 0 or
$err = $? >> 8; $err = $? >> 8;
zipErrorCheck($err,$lockfile); zipErrorCheck($err,$lockfile);
} }
@ -261,15 +271,15 @@ sub JarIt
$subargs = substr($overrides, 0, $pos); $subargs = substr($overrides, 0, $pos);
$overrides = substr($overrides, $pos); $overrides = substr($overrides, $pos);
#print "$zipprog $zipmoveopt -X ../$jarfile.jar $subargs\n"; #print "$zipprog $zipmoveopt -X $jarchive $subargs\n";
#print "Length of subargs: " . length($subargs) . "\n"; #print "Length of subargs: " . length($subargs) . "\n";
system("$zipprog $zipmoveopt -X ../$jarfile.jar $subargs") == 0 or system("$zipprog $zipmoveopt -X $jarchive $subargs") == 0 or
$err = $? >> 8; $err = $? >> 8;
zipErrorCheck($err,$lockfile); zipErrorCheck($err,$lockfile);
} }
#print "Length of args: " . length($overrides) . "\n"; #print "Length of args: " . length($overrides) . "\n";
#print "$zipprog $zipmoveopt -X ../$jarfile.jar $overrides\n"; #print "$zipprog $zipmoveopt -X $jarchive $overrides\n";
system("$zipprog $zipmoveopt -X ../$jarfile.jar $overrides\n") == 0 or system("$zipprog $zipmoveopt -X $jarchive $overrides\n") == 0 or
$err = $? >> 8; $err = $? >> 8;
zipErrorCheck($err,$lockfile); zipErrorCheck($err,$lockfile);
} }
@ -356,7 +366,7 @@ sub RegIt
} else { } else {
$line = "$chromeType,install,url,jar:resource:/chrome/$jarFileName.jar!/$chromeType/$pkgName/"; $line = "$chromeType,install,url,jar:resource:/chrome/$jarFileName.jar!/$chromeType/$pkgName/";
} }
my $installedChromeFile = "$chromeDir/installed-chrome.txt"; my $installedChromeFile = "$jarDir/installed-chrome.txt";
UniqIt($installedChromeFile, $line); UniqIt($installedChromeFile, $line);
} }
@ -493,7 +503,7 @@ start:
my $cwd = cwd(); my $cwd = cwd();
my @manifestLines; my @manifestLines;
print "+++ making chrome $cwd => $chromeDir/$jarfile.jar\n"; print "+++ making chrome $cwd => $jarDir/$jarfile.jar\n";
while (defined($_ = shift @gLines)) { while (defined($_ = shift @gLines)) {
if (/^\s+([\w\d.\-\_\\\/\+]+)\s*(\(\%?[\w\d.\-\_\\\/]+\))?$\s*/) { if (/^\s+([\w\d.\-\_\\\/\+]+)\s*(\(\%?[\w\d.\-\_\\\/]+\))?$\s*/) {
my $dest = $1; my $dest = $1;
@ -547,17 +557,17 @@ start:
# end with blank line # end with blank line
last; last;
} else { } else {
my $manifest = "$chromeDir/$jarfile.manifest"; my $manifest = "$jarDir/$jarfile.manifest";
my $manifest = "$chromeDir/../chrome.manifest" if $useExtensionManifest; my $manifest = "$jarDir/../chrome.manifest" if $useExtensionManifest;
UniqIt($manifest, @manifestLines); UniqIt($manifest, @manifestLines);
JarIt($chromeDir, $jarfile, $args, $overrides); JarIt($chromeDir, $jarDir, $jarfile, $args, $overrides);
goto start; goto start;
} }
} }
my $manifest = "$chromeDir/$jarfile.manifest"; my $manifest = "$jarDir/$jarfile.manifest";
$manifest = "$chromeDir/../chrome.manifest" if $useExtensionManifest; $manifest = "$jarDir/../chrome.manifest" if $useExtensionManifest;
UniqIt($manifest, @manifestLines); UniqIt($manifest, @manifestLines);
JarIt($chromeDir, $jarfile, $args, $overrides); JarIt($chromeDir, $jarDir, $jarfile, $args, $overrides);
} elsif (/^\s*\#.*$/) { } elsif (/^\s*\#.*$/) {
# skip comments # skip comments

View File

@ -1553,10 +1553,11 @@ ifndef NO_DIST_INSTALL
@$(EXIT_ON_ERROR) \ @$(EXIT_ON_ERROR) \
if test -f $(JAR_MANIFEST); then \ if test -f $(JAR_MANIFEST); then \
if test ! -d $(FINAL_TARGET)/chrome; then $(NSINSTALL) -D $(FINAL_TARGET)/chrome; fi; \ if test ! -d $(FINAL_TARGET)/chrome; then $(NSINSTALL) -D $(FINAL_TARGET)/chrome; fi; \
if test ! -d $(MAKE_JARS_TARGET)/chrome; then $(NSINSTALL) -D $(MAKE_JARS_TARGET)/chrome; fi; \
$(PERL) $(MOZILLA_DIR)/config/preprocessor.pl $(XULPPFLAGS) $(DEFINES) $(ACDEFINES) \ $(PERL) $(MOZILLA_DIR)/config/preprocessor.pl $(XULPPFLAGS) $(DEFINES) $(ACDEFINES) \
$(JAR_MANIFEST) | \ $(JAR_MANIFEST) | \
$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/make-jars.pl \ $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/make-jars.pl \
-d $(FINAL_TARGET)/chrome \ -d $(MAKE_JARS_TARGET)/chrome -j $(FINAL_TARGET)/chrome \
$(MAKE_JARS_FLAGS) -- "$(XULPPFLAGS) $(DEFINES) $(ACDEFINES)"; \ $(MAKE_JARS_FLAGS) -- "$(XULPPFLAGS) $(DEFINES) $(ACDEFINES)"; \
$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/make-chromelist.pl \ $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/make-chromelist.pl \
$(FINAL_TARGET)/chrome $(JAR_MANIFEST) $(_NO_FLOCK); \ $(FINAL_TARGET)/chrome $(JAR_MANIFEST) $(_NO_FLOCK); \
@ -1568,10 +1569,11 @@ ifndef NO_INSTALL
@$(EXIT_ON_ERROR) \ @$(EXIT_ON_ERROR) \
if test -f $(JAR_MANIFEST); then \ if test -f $(JAR_MANIFEST); then \
if test ! -d $(DESTDIR)$(mozappdir)/chrome; then $(NSINSTALL) -D $(DESTDIR)$(mozappdir)/chrome; fi; \ if test ! -d $(DESTDIR)$(mozappdir)/chrome; then $(NSINSTALL) -D $(DESTDIR)$(mozappdir)/chrome; fi; \
if test ! -d $(MAKE_JARS_TARGET)/chrome; then $(NSINSTALL) -D $(MAKE_JARS_TARGET)/chrome; fi; \
$(PERL) $(MOZILLA_DIR)/config/preprocessor.pl $(XULPPFLAGS) $(DEFINES) $(ACDEFINES) \ $(PERL) $(MOZILLA_DIR)/config/preprocessor.pl $(XULPPFLAGS) $(DEFINES) $(ACDEFINES) \
$(JAR_MANIFEST) | \ $(JAR_MANIFEST) | \
$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/make-jars.pl \ $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/make-jars.pl \
-d $(DESTDIR)$(mozappdir)/chrome \ -d $(MAKE_JARS_TARGET) -j $(DESTDIR)$(mozappdir)/chrome \
$(MAKE_JARS_FLAGS) -- "$(XULPPFLAGS) $(DEFINES) $(ACDEFINES)"; \ $(MAKE_JARS_FLAGS) -- "$(XULPPFLAGS) $(DEFINES) $(ACDEFINES)"; \
$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/make-chromelist.pl \ $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/make-chromelist.pl \
$(DESTDIR)$(mozappdir)/chrome $(JAR_MANIFEST) $(_NO_FLOCK); \ $(DESTDIR)$(mozappdir)/chrome $(JAR_MANIFEST) $(_NO_FLOCK); \