CreateRomTestClassespublic class CreateRomTestClasses extends Object Create the romtestclasses.zip that contains classes that need to be
romized for the romizer unit tests. |
Fields Summary |
---|
static File | workspacedir | static File | outputdir | static Vector | sourcefiles | static PrintWriter | pw |
Methods Summary |
---|
static void | copyZipEntries(java.util.zip.ZipOutputStream zout, java.io.File src, tests.CreateRomTestClasses$Filter filter)Copy the content of of the given zip file source
to the ZIP file output stream
ZipFile zipSrc = null;
try {
zipSrc = new ZipFile(src);
} catch (Throwable t) {
System.out.println("Unexpected error:");
t.printStackTrace();
System.out.println();
System.out.println("Your JDK_DIR cannot handle long JAR entries");
System.out.println("Please upgrade to JDK 1.4.1 or later.");
System.out.println("JDK version '1.4.1' is known to work.");
System.exit(-1);
}
for (Enumeration e = zipSrc.entries(); e.hasMoreElements(); ) {
ZipEntry entry = (ZipEntry) e.nextElement();
String name = entry.getName();
if (name.startsWith("META-INF")) {
continue;
}
if (filter != null && !filter.includeEntry(entry.getName())) {
continue;
}
int size = (int)entry.getSize();
byte data[] = new byte[size];
InputStream in = zipSrc.getInputStream(entry);
DataInputStream din = new DataInputStream(in);
din.readFully(data);
zout.putNextEntry(entry);
zout.write(data, 0, data.length);
zout.closeEntry();
din.close();
}
| public static void | main(java.lang.String[] args)
if (args.length != 4) {
usage();
System.exit(1);
}
File cldc_classes_zip = new File(args[0]);
File cldcx_classes_zip = new File(args[1]);
File tests_jar = new File(args[2]);
File output = new File(args[3]);
FileOutputStream out = new FileOutputStream(output);
ZipOutputStream zout = new ZipOutputStream(out);
// Simply copy all entries from cldc_classes_zip and cldcx_classes_zip
copyZipEntries(zout, cldc_classes_zip, null);
copyZipEntries(zout, cldcx_classes_zip, null);
// We need to filter out the entries in tests_jar if:
// (1) The test is a negative test case
// (2) The test may use a feature that's not supported by the
// VM's configuration (e.g., floating point or CLDC 1.1 API)
Filter filter = new Filter();
copyZipEntries(zout, tests_jar, filter);
zout.close();
| static void | usage()
System.out.println("Usage: java -jar buildtool.jar " +
"romtestclasses cldc_classes.zip " +
"cldcx_classes.zip tests.jar <outputfile>");
|
|