rt/vm/src/main/java/org/apidesign/vm4brwsr/Bck2Brwsr.java
branchclosure
changeset 1584 7b6295731c30
parent 1583 89b6b369c13d
child 1604 7665471a56c1
     1.1 --- a/rt/vm/src/main/java/org/apidesign/vm4brwsr/Bck2Brwsr.java	Wed May 21 23:42:24 2014 +0200
     1.2 +++ b/rt/vm/src/main/java/org/apidesign/vm4brwsr/Bck2Brwsr.java	Thu May 22 10:48:09 2014 +0200
     1.3 @@ -57,9 +57,13 @@
     1.4      private final StringArray classes;
     1.5      private final StringArray resources;
     1.6      private final Resources res;
     1.7 -    private final boolean extension;
     1.8 +    private final Boolean extension;
     1.9  
    1.10 -    private Bck2Brwsr(ObfuscationLevel level, StringArray exported, StringArray classes, StringArray resources, Resources res, boolean extension) {
    1.11 +    private Bck2Brwsr(
    1.12 +        ObfuscationLevel level, 
    1.13 +        StringArray exported, StringArray classes, StringArray resources, 
    1.14 +        Resources res, Boolean extension
    1.15 +    ) {
    1.16          this.level = level;
    1.17          this.exported = exported;
    1.18          this.classes = classes;
    1.19 @@ -226,6 +230,19 @@
    1.20      public Bck2Brwsr library(boolean library) {
    1.21          return new Bck2Brwsr(level, exported, classes, resources, res, library);
    1.22      }
    1.23 +    
    1.24 +    /** Turns on the standalone mode. E.g. acts like {@link #library(boolean) library(false)},
    1.25 +     * but also allows to specify whether the <em>Bck2Brwsr VM</em> should
    1.26 +     * be included at all. If not, only the skeleton of the launcher is
    1.27 +     * generated without any additional VM classes referenced.
    1.28 +     * 
    1.29 +     * @param includeVM should the VM be compiled in, or left out
    1.30 +     * @return new instance of the compiler with standalone mode on
    1.31 +     * @since 0.9
    1.32 +     */
    1.33 +    public Bck2Brwsr standalone(boolean includeVM) {
    1.34 +        return new Bck2Brwsr(level, exported, classes, resources, res, includeVM ? false : null);
    1.35 +    }
    1.36  
    1.37      /** A way to change the provider of additional resources (classes) for the 
    1.38       * compiler by specifying classloader to use for loading them.
    1.39 @@ -296,7 +313,11 @@
    1.40      }
    1.41      
    1.42      boolean isExtension() {
    1.43 -        return extension;
    1.44 +        return Boolean.TRUE.equals(extension);
    1.45 +    }
    1.46 +    
    1.47 +    boolean includeVM() {
    1.48 +        return extension != null;
    1.49      }
    1.50  
    1.51      /** Provider of resources (classes and other files). The