Providing paths to jars via VM options, some other minor stuff.

This commit is contained in:
Evgeny Gerashchenko
2013-03-14 14:41:49 +04:00
parent 53f775e98d
commit 1e88d4ea2c
@@ -337,6 +337,9 @@ public class GenerateMockJdk {
private static void generateFilteredJar(File source, File target, Set<String> entryNamesToInclude, boolean assertAllFound) throws IOException { private static void generateFilteredJar(File source, File target, Set<String> entryNamesToInclude, boolean assertAllFound) throws IOException {
if (!source.exists()) {
throw new AssertionError(source + " doesn't exist");
}
JarFile sourceJar = new JarFile(source); JarFile sourceJar = new JarFile(source);
JarOutputStream targetJar = new JarOutputStream(new FileOutputStream(target)); JarOutputStream targetJar = new JarOutputStream(new FileOutputStream(target));
@@ -382,8 +385,14 @@ public class GenerateMockJdk {
} }
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
File rtJar = new File("<your jdk rt.jar>"); String rtJarPath = System.getProperty("rt.jar");
File srcJar = new File("<your jdk src dir>/src.jar"); String srcZipPath = System.getProperty("src.zip");
if (rtJarPath == null || srcZipPath == null) {
throw new AssertionError("Provide path to rt.jar and src.zip in VM options: \"-Drt.jar=... -Dsrc.zip=...\"");
}
File rtJar = new File(rtJarPath);
File srcJar = new File(srcZipPath);
generateFilteredJar( generateFilteredJar(
rtJar, rtJar,
@@ -396,4 +405,7 @@ public class GenerateMockJdk {
getSourceFileEntries(), getSourceFileEntries(),
false); false);
} }
private GenerateMockJdk() {
}
} }