1 | #!perl |
---|
2 | # |
---|
3 | # The contents of this file are subject to the Netscape Public |
---|
4 | # License Version 1.1 (the "License"); you may not use this file |
---|
5 | # except in compliance with the License. You may obtain a copy of |
---|
6 | # the License at http://www.mozilla.org/NPL/ |
---|
7 | # |
---|
8 | # Software distributed under the License is distributed on an "AS |
---|
9 | # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or |
---|
10 | # implied. See the License for the specific language governing |
---|
11 | # rights and limitations under the License. |
---|
12 | # |
---|
13 | # The Original Code is mozilla.org code. |
---|
14 | # |
---|
15 | # The Initial Developer of the Original Code is Netscape |
---|
16 | # Communications Corporation. Portions created by Netscape are |
---|
17 | # Copyright (C) 1998 Netscape Communications Corporation. All |
---|
18 | # Rights Reserved. |
---|
19 | # |
---|
20 | # Contributor(s): |
---|
21 | # |
---|
22 | |
---|
23 | # |
---|
24 | # Input: output_class_dir argfile javafilelist |
---|
25 | # |
---|
26 | |
---|
27 | $classdir = $ARGV[0]; |
---|
28 | $argfile = $ARGV[1]; |
---|
29 | $filelist = $ARGV[2]; |
---|
30 | shift; |
---|
31 | |
---|
32 | $sjcmd = $ENV{'MOZ_TOOLS'} . '\bin\sj.exe'; |
---|
33 | |
---|
34 | open(FL, "<$filelist" ) || die "can't open $filelist for reading"; |
---|
35 | |
---|
36 | while( <FL> ){ |
---|
37 | # print; |
---|
38 | @java_files = (@java_files, split(/[ \t\n]/)); |
---|
39 | } |
---|
40 | close (FL); |
---|
41 | |
---|
42 | open(FL, "<$argfile" ) || die "can't open $argfile for reading"; |
---|
43 | |
---|
44 | while( <FL> ){ |
---|
45 | chop; |
---|
46 | $args .= $_; |
---|
47 | } |
---|
48 | close (FL); |
---|
49 | |
---|
50 | |
---|
51 | print "Java Files: @java_files\n"; |
---|
52 | |
---|
53 | |
---|
54 | # compile as many java files as we can in one invocation |
---|
55 | # given the limitations of the command line |
---|
56 | foreach $filename (@java_files) { |
---|
57 | $classfilename = $classdir; |
---|
58 | $classfilename .= $filename; |
---|
59 | $classfilename =~ s/.java$/.class/; |
---|
60 | ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime, |
---|
61 | $ctime,$blksize,$blocks) = stat($filename); |
---|
62 | ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$classmtime, |
---|
63 | $ctime,$blksize,$blocks) = stat($classfilename); |
---|
64 | # print $filename, " ", $mtime, ", ", $classfilename, " ", $classmtime, "\n"; |
---|
65 | if ($mtime > $classmtime) { |
---|
66 | # are we too big? |
---|
67 | $len += length($filename); |
---|
68 | if( $len >= 512 ) { |
---|
69 | print "$sjcmd $args $outofdate\n"; |
---|
70 | $status = system "$sjcmd $args $outofdate"; |
---|
71 | if( $status != 0 ) { |
---|
72 | exit( $status / 256 ); |
---|
73 | } |
---|
74 | $outofdate = ""; |
---|
75 | $len = length($filename); |
---|
76 | } |
---|
77 | $outofdate .= $filename; |
---|
78 | $outofdate .= " "; |
---|
79 | } |
---|
80 | } |
---|
81 | |
---|
82 | if( length($outofdate) > 0 ) { |
---|
83 | print "$sjcmd $args $outofdate\n"; |
---|
84 | $status = system "$sjcmd $args $outofdate"; |
---|
85 | if( $status != 0 ) { |
---|
86 | exit( $status / 256 ); |
---|
87 | } |
---|
88 | } else { |
---|
89 | print "Files are up to date.\n"; |
---|
90 | } |
---|
91 | |
---|
92 | |
---|
93 | print "\n"; |
---|