1.1 --- a/rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/AOTLibrary.java Sat Dec 06 07:11:02 2014 +0100
1.2 +++ b/rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/AOTLibrary.java Sat Dec 06 08:02:33 2014 +0100
1.3 @@ -90,7 +90,7 @@
1.4
1.5 try {
1.6 Manifest m = new Manifest();
1.7 - {
1.8 + if (!"false".equals(minified)) {
1.9 Attributes attr = new Attributes();
1.10 attr.putValue("Bck2BrwsrArtifactId", prj.getArtifactId());
1.11 attr.putValue("Bck2BrwsrGroupId", prj.getGroupId());
1.12 @@ -98,7 +98,7 @@
1.13 attr.putValue("Bck2BrwsrMinified", "true");
1.14 m.getEntries().put(minified, attr);
1.15 }
1.16 - {
1.17 + if (!"false".equals(debug)) {
1.18 Attributes attr = new Attributes();
1.19 attr.putValue("Bck2BrwsrArtifactId", prj.getArtifactId());
1.20 attr.putValue("Bck2BrwsrGroupId", prj.getGroupId());
1.21 @@ -123,38 +123,32 @@
1.22 }
1.23 {
1.24 Attributes attr = new Attributes();
1.25 - attr.putValue("Bck2BrwsrArtifactId", prj.getArtifactId());
1.26 - attr.putValue("Bck2BrwsrGroupId", prj.getGroupId());
1.27 - attr.putValue("Bck2BrwsrVersion", prj.getVersion());
1.28 + attr.putValue("Bck2BrwsrArtifactId", a.getArtifactId());
1.29 + attr.putValue("Bck2BrwsrGroupId", a.getGroupId());
1.30 + attr.putValue("Bck2BrwsrVersion", a.getVersion());
1.31 attr.putValue("Bck2BrwsrDebug", "true");
1.32 m.getEntries().put(artifactName(a, false), attr);
1.33 }
1.34 - }
1.35 + }
1.36 }
1.37
1.38 FileOutputStream fos = new FileOutputStream(this.aotJar);
1.39 JarOutputStream os = new JarOutputStream(fos, m);
1.40
1.41 - Bck2Brwsr c = Bck2BrwsrJars.configureFrom(null, mainJar, loader);
1.42 - if (exports != null) {
1.43 - for (String e : exports) {
1.44 - c = c.addExported(e.replace('.', '/'));
1.45 - }
1.46 - }
1.47 - {
1.48 + if (!"false".equals(debug)) {
1.49 os.putNextEntry(new JarEntry(debug));
1.50 Writer w = new OutputStreamWriter(os);
1.51 - c.
1.52 + configureMain(loader).
1.53 obfuscation(ObfuscationLevel.NONE).
1.54 generate(w);
1.55 w.flush();
1.56 os.closeEntry();
1.57 }
1.58 - {
1.59 + if (!"false".equals(minified)) {
1.60 os.putNextEntry(new JarEntry(minified));
1.61
1.62 Writer w = new OutputStreamWriter(os);
1.63 - c.
1.64 + configureMain(loader).
1.65 obfuscation(ObfuscationLevel.FULL).
1.66 generate(w);
1.67 w.flush();
1.68 @@ -166,6 +160,13 @@
1.69 if (!matches(aotDeps, a)) {
1.70 continue;
1.71 }
1.72 + getLog().info("Generating bck2brwsr for " + a.getFile());
1.73 + Bck2Brwsr c = Bck2BrwsrJars.configureFrom(null, a.getFile(), loader);
1.74 + if (exports != null) {
1.75 + for (String e : exports) {
1.76 + c = c.addExported(e.replace('.', '/'));
1.77 + }
1.78 + }
1.79 {
1.80 os.putNextEntry(new JarEntry(artifactName(a, true)));
1.81 Writer w = new OutputStreamWriter(os);
1.82 @@ -195,6 +196,16 @@
1.83 }
1.84 }
1.85
1.86 + private Bck2Brwsr configureMain(URLClassLoader loader) throws IOException {
1.87 + Bck2Brwsr c = Bck2BrwsrJars.configureFrom(null, mainJar, loader);
1.88 + if (exports != null) {
1.89 + for (String e : exports) {
1.90 + c = c.addExported(e.replace('.', '/'));
1.91 + }
1.92 + }
1.93 + return c;
1.94 + }
1.95 +
1.96 private static String artifactName(Artifact a, boolean debug) {
1.97 return a.getGroupId() + "-" + a.getArtifactId() + (debug ? "-debug.js" : "-min.js");
1.98 }