# HG changeset patch # User Jaroslav Tulach # Date 1381406369 -7200 # Node ID 4393b7db103b842b1069c69095bf9321e7846fd8 # Parent 2cb12e6693d3ade3f0d9dd482661cf7eaccf04ee Public API to disallow classes from rt.jar diff -r 2cb12e6693d3 -r 4393b7db103b rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/Java2JavaScript.java --- a/rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/Java2JavaScript.java Thu Oct 10 09:33:40 2013 +0200 +++ b/rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/Java2JavaScript.java Thu Oct 10 13:59:29 2013 +0200 @@ -70,6 +70,10 @@ */ @Parameter(defaultValue="NONE") private ObfuscationLevel obfuscation; + + /** Should classes from rt.jar be included? */ + @Parameter(defaultValue = "false") + private boolean ignoreBootClassPath; @Override public void execute() throws MojoExecutionException { @@ -94,7 +98,7 @@ FileWriter w = new FileWriter(javascript); Bck2Brwsr.newCompiler(). obfuscation(obfuscation). - resources(url). + resources(url, ignoreBootClassPath). addRootClasses(arr.toArray(new String[0])). generate(w); w.close(); diff -r 2cb12e6693d3 -r 4393b7db103b rt/vm/src/main/java/org/apidesign/vm4brwsr/Bck2Brwsr.java --- a/rt/vm/src/main/java/org/apidesign/vm4brwsr/Bck2Brwsr.java Thu Oct 10 09:33:40 2013 +0200 +++ b/rt/vm/src/main/java/org/apidesign/vm4brwsr/Bck2Brwsr.java Thu Oct 10 13:59:29 2013 +0200 @@ -151,7 +151,21 @@ * @since 0.5 */ public Bck2Brwsr resources(final ClassLoader loader) { - return resources(new LdrRsrcs(loader, false)); + return resources(loader, false); + } + + /** A way to change the provider of additional resources (classes) for the + * compiler by specifying classloader to use for loading them. + * + * @param loader class loader to load the resources from + * @param ignoreBootClassPath true if classes loaded + * from rt.jar + * @return new instance of the compiler with all values being the same, just + * different resources provider + * @since 0.9 + */ + public Bck2Brwsr resources(final ClassLoader loader, boolean ignoreBootClassPath) { + return resources(new LdrRsrcs(loader, ignoreBootClassPath)); } /** Generates virtual machine based on previous configuration of the