1998-03-28 02:44:41 +00:00
|
|
|
#!perl
|
|
|
|
#
|
1999-11-06 03:40:37 +00:00
|
|
|
# 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/
|
1998-03-28 02:44:41 +00:00
|
|
|
#
|
1999-11-06 03:40:37 +00:00
|
|
|
# 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.
|
1998-03-28 02:44:41 +00:00
|
|
|
#
|
1999-11-06 03:40:37 +00:00
|
|
|
# The Original Code is mozilla.org code.
|
|
|
|
#
|
|
|
|
# The Initial Developer of the Original Code is Netscape
|
1998-03-28 02:44:41 +00:00
|
|
|
# Communications Corporation. Portions created by Netscape are
|
1999-11-06 03:40:37 +00:00
|
|
|
# Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
# Rights Reserved.
|
|
|
|
#
|
|
|
|
# Contributor(s):
|
1998-03-28 02:44:41 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
#Input: [-d dir] foo1.java foo2.java
|
|
|
|
#Compares with: foo1.class foo2.class (if -d specified, checks in 'dir',
|
|
|
|
# otherwise assumes .class files in same directory as .java files)
|
|
|
|
#Returns: list of input arguments which are newer than corresponding class
|
|
|
|
#files (non-existant class files are considered to be real old :-)
|
|
|
|
#
|
|
|
|
|
|
|
|
$found = 1;
|
|
|
|
|
1999-07-30 22:04:08 +00:00
|
|
|
# GLOBALS
|
|
|
|
$SEP = 0; # the paltform independent path separator
|
|
|
|
$CFG = 0; # the value of the -cfg flag
|
|
|
|
|
|
|
|
# determine the path separator
|
|
|
|
$_ = $ENV{"PATH"};
|
|
|
|
if (m|/|) {
|
|
|
|
$SEP = "/";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$SEP = "\\";
|
|
|
|
}
|
|
|
|
|
1998-03-28 02:44:41 +00:00
|
|
|
if ($ARGV[0] eq '-d') {
|
|
|
|
$classdir = $ARGV[1];
|
1999-07-30 22:04:08 +00:00
|
|
|
$classdir .= $SEP;
|
1998-03-28 02:44:41 +00:00
|
|
|
shift;
|
|
|
|
shift;
|
|
|
|
} else {
|
1999-07-30 22:04:08 +00:00
|
|
|
$classdir = "." . $SEP;
|
|
|
|
}
|
|
|
|
|
|
|
|
# if -cfg is specified, print out the contents of the cfg file to stdout
|
|
|
|
if ($ARGV[0] eq '-cfg') {
|
|
|
|
$CFG = $ARGV[1];
|
|
|
|
shift;
|
|
|
|
shift;
|
|
|
|
}
|
|
|
|
|
|
|
|
$_ = $ARGV[0];
|
|
|
|
if (m/\*.java/) {
|
|
|
|
# Account for the fact that the shell didn't expand *.java by doing it
|
|
|
|
# manually.
|
|
|
|
&manuallyExpandArgument("java");
|
1998-03-28 02:44:41 +00:00
|
|
|
}
|
|
|
|
|
1999-07-30 22:04:08 +00:00
|
|
|
$printFile = 0;
|
|
|
|
|
1998-03-28 02:44:41 +00:00
|
|
|
foreach $filename (@ARGV) {
|
|
|
|
$classfilename = $classdir;
|
|
|
|
$classfilename .= $filename;
|
|
|
|
$classfilename =~ s/.java$/.class/;
|
|
|
|
# workaround to only build sun/io/* classes when necessary
|
|
|
|
# change the pathname of target file to be consistent
|
|
|
|
# with sun/io subdirectories
|
|
|
|
#
|
|
|
|
# sun/io was always getting rebuilt because the java files
|
|
|
|
# were split into subdirectories, but the package names
|
|
|
|
# remained the same. This was confusing outofdate.pl
|
|
|
|
#
|
|
|
|
$classfilename =~ s/sun\/io\/extended.\//sun\/io\//;
|
1998-04-21 06:42:48 +00:00
|
|
|
$classfilename =~ s/\.\.\/\.\.\/sun-java\/classsrc\///;
|
1998-03-28 02:44:41 +00:00
|
|
|
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,
|
|
|
|
$ctime,$blksize,$blocks) = stat($filename);
|
|
|
|
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$classmtime,
|
|
|
|
$ctime,$blksize,$blocks) = stat($classfilename);
|
|
|
|
# print $filename, " ", $mtime, ", ", $classfilename, " ", $classmtime, "\n";
|
|
|
|
if ($mtime > $classmtime) {
|
1999-07-30 22:04:08 +00:00
|
|
|
|
|
|
|
# Only print the file header if we actually have some files to
|
|
|
|
# compile.
|
|
|
|
if (!$printFile) {
|
|
|
|
$printFile = 1;
|
|
|
|
&printFile($CFG);
|
|
|
|
}
|
1998-03-28 02:44:41 +00:00
|
|
|
print $filename, " ";
|
|
|
|
$found = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
print "\n";
|
1999-07-30 22:04:08 +00:00
|
|
|
|
|
|
|
# push onto $ARG array all filenames with extension $ext
|
|
|
|
|
|
|
|
# @param ext the extension of the file
|
|
|
|
|
|
|
|
sub manuallyExpandArgument {
|
|
|
|
local($ext) = @_;
|
|
|
|
$ext = "\." . $ext; # put it in regexp
|
|
|
|
|
|
|
|
$result = opendir(DIR, ".");
|
|
|
|
|
|
|
|
@allfiles = grep(/$ext/, readdir(DIR));
|
|
|
|
$i = 0;
|
|
|
|
foreach $file (@allfiles) {
|
|
|
|
#skip emacs save files
|
|
|
|
$_ = $file;
|
|
|
|
if (!/~/) {
|
|
|
|
$ARGV[$i++] = $file;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub printFile {
|
|
|
|
local($file) = @_;
|
|
|
|
|
|
|
|
$result = open(CFG, $file);
|
|
|
|
while (<CFG>) {
|
|
|
|
chop;
|
|
|
|
print $_;
|
|
|
|
}
|
|
|
|
}
|