Bug 458440 - Attempt to work around speculative parsing crash. r+sr=dbaron
[mozilla-central.git] / config / sj.pl
blob6ad927504069f8a56888e602a3ea8ab059cbee9c
1 #!perl
3 # ***** BEGIN LICENSE BLOCK *****
4 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 # The contents of this file are subject to the Mozilla Public License Version
7 # 1.1 (the "License"); you may not use this file except in compliance with
8 # the License. You may obtain a copy of the License at
9 # http://www.mozilla.org/MPL/
11 # Software distributed under the License is distributed on an "AS IS" basis,
12 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 # for the specific language governing rights and limitations under the
14 # License.
16 # The Original Code is mozilla.org code.
18 # The Initial Developer of the Original Code is
19 # Netscape Communications Corporation.
20 # Portions created by the Initial Developer are Copyright (C) 1998
21 # the Initial Developer. All Rights Reserved.
23 # Contributor(s):
24 # Jamie Zawinski <jwz@mozilla.org>
26 # Alternatively, the contents of this file may be used under the terms of
27 # either of the GNU General Public License Version 2 or later (the "GPL"),
28 # or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 # in which case the provisions of the GPL or the LGPL are applicable instead
30 # of those above. If you wish to allow use of your version of this file only
31 # under the terms of either the GPL or the LGPL, and not to allow others to
32 # use your version of this file under the terms of the MPL, indicate your
33 # decision by deleting the provisions above and replace them with the notice
34 # and other provisions required by the GPL or the LGPL. If you do not delete
35 # the provisions above, a recipient may use your version of this file under
36 # the terms of any one of the MPL, the GPL or the LGPL.
38 # ***** END LICENSE BLOCK *****
41 # Input: output_class_dir argfile javafilelist
44 $classdir = $ARGV[0];
45 $argfile = $ARGV[1];
46 $filelist = $ARGV[2];
47 shift;
49 $sjcmd = $ENV{'MOZ_TOOLS'} . '\bin\sj.exe';
51 open(FL, "<$filelist" ) || die "can't open $filelist for reading";
53 while( <FL> ){
54 # print;
55 @java_files = (@java_files, split(/[ \t\n]/));
57 close (FL);
59 open(FL, "<$argfile" ) || die "can't open $argfile for reading";
61 while( <FL> ){
62 chop;
63 $args .= $_;
65 close (FL);
68 print "Java Files: @java_files\n";
71 # compile as many java files as we can in one invocation
72 # given the limitations of the command line
73 foreach $filename (@java_files) {
74 $classfilename = $classdir;
75 $classfilename .= $filename;
76 $classfilename =~ s/.java$/.class/;
77 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,
78 $ctime,$blksize,$blocks) = stat($filename);
79 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$classmtime,
80 $ctime,$blksize,$blocks) = stat($classfilename);
81 # print $filename, " ", $mtime, ", ", $classfilename, " ", $classmtime, "\n";
82 if ($mtime > $classmtime) {
83 # are we too big?
84 $len += length($filename);
85 if( $len >= 512 ) {
86 print "$sjcmd $args $outofdate\n";
87 $status = system "$sjcmd $args $outofdate";
88 if( $status != 0 ) {
89 exit( $status / 256 );
91 $outofdate = "";
92 $len = length($filename);
94 $outofdate .= $filename;
95 $outofdate .= " ";
99 if( length($outofdate) > 0 ) {
100 print "$sjcmd $args $outofdate\n";
101 $status = system "$sjcmd $args $outofdate";
102 if( $status != 0 ) {
103 exit( $status / 256 );
105 } else {
106 print "Files are up to date.\n";
110 print "\n";