Don't report warnings when generating minified version of bck2brwsr libraries
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Thu, 28 Apr 2016 06:09:26 +0200
changeset 1956442c7f2d54ea
parent 1955 ebda6f4d0336
child 1957 85f1fbb0f2f6
Don't report warnings when generating minified version of bck2brwsr libraries
rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/AOTLibrary.java
rt/vm/src/main/java/org/apidesign/vm4brwsr/ClosureWrapper.java
     1.1 --- a/rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/AOTLibrary.java	Thu Apr 28 05:59:32 2016 +0200
     1.2 +++ b/rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/AOTLibrary.java	Thu Apr 28 06:09:26 2016 +0200
     1.3 @@ -147,7 +147,8 @@
     1.4                      }
     1.5                  }
     1.6              }
     1.7 -            
     1.8 +
     1.9 +            boolean notified = false;
    1.10  
    1.11              JarOutputStream os = null;
    1.12              if (!"false".equals(debug)) {
    1.13 @@ -155,6 +156,8 @@
    1.14                      os = aotJar(m);
    1.15                  }
    1.16                  os.putNextEntry(new JarEntry(debug));
    1.17 +                getLog().info("Generating bck2brwsr for " + mainJar);
    1.18 +                notified = true;
    1.19                  Writer w = new OutputStreamWriter(os, "UTF-8");
    1.20                  configureMain(loader).
    1.21                      obfuscation(ObfuscationLevel.NONE).
    1.22 @@ -167,7 +170,10 @@
    1.23                      os = aotJar(m);
    1.24                  }
    1.25                  os.putNextEntry(new JarEntry(minified));
    1.26 -            
    1.27 +
    1.28 +                if (!notified) {
    1.29 +                    getLog().info("Generating bck2brwsr for " + mainJar);
    1.30 +                }
    1.31                  Writer w = new OutputStreamWriter(os, "UTF-8");
    1.32                  configureMain(loader).
    1.33                      obfuscation(obfuscation).
     2.1 --- a/rt/vm/src/main/java/org/apidesign/vm4brwsr/ClosureWrapper.java	Thu Apr 28 05:59:32 2016 +0200
     2.2 +++ b/rt/vm/src/main/java/org/apidesign/vm4brwsr/ClosureWrapper.java	Thu Apr 28 06:09:26 2016 +0200
     2.3 @@ -19,6 +19,7 @@
     2.4  
     2.5  import com.google.javascript.jscomp.CommandLineRunner;
     2.6  import com.google.javascript.jscomp.SourceFile;
     2.7 +import java.io.ByteArrayOutputStream;
     2.8  import java.io.IOException;
     2.9  import java.io.OutputStream;
    2.10  import java.io.PrintStream;
    2.11 @@ -48,10 +49,10 @@
    2.12      private String externsCode;
    2.13  
    2.14      private ClosureWrapper(Appendable out,
    2.15 -                           String compilationLevel, Bck2Brwsr config) {
    2.16 +                           String compilationLevel, Bck2Brwsr config, PrintStream err) {
    2.17          super(
    2.18              generateArguments(compilationLevel),
    2.19 -            new PrintStream(new APS(out)), System.err
    2.20 +            new PrintStream(new APS(out)), err
    2.21          );
    2.22          this.config = config;
    2.23      }
    2.24 @@ -142,16 +143,16 @@
    2.25          ObfuscationLevel obfuscationLevel,
    2.26          Bck2Brwsr config
    2.27      ) throws IOException {
    2.28 -        final ClosureWrapper cw =
    2.29 -                new ClosureWrapper(output,
    2.30 -                                   (obfuscationLevel == ObfuscationLevel.FULL)
    2.31 -                                           ? "ADVANCED_OPTIMIZATIONS"
    2.32 -                                           : "SIMPLE_OPTIMIZATIONS",
    2.33 -                                   config);
    2.34 +        ByteArrayOutputStream out = new ByteArrayOutputStream();
    2.35 +        PrintStream err = new PrintStream(out);
    2.36 +        final ClosureWrapper cw = new ClosureWrapper(output,
    2.37 +            (obfuscationLevel == ObfuscationLevel.FULL) ? "ADVANCED_OPTIMIZATIONS" : "SIMPLE_OPTIMIZATIONS",
    2.38 +            config, err
    2.39 +        );
    2.40          try {
    2.41              return cw.doRun();
    2.42          } catch (FlagUsageException ex) {
    2.43 -            throw new IOException(ex);
    2.44 +            throw new IOException(out.toString(), ex);
    2.45          }
    2.46      }
    2.47