The closure compiler was broken due to presence of old version of sisu-guava. Exclude and test minification works on JavaQuery API.
1.1 --- a/javaquery/demo-calculator/pom.xml Mon Feb 23 09:00:13 2015 +0100
1.2 +++ b/javaquery/demo-calculator/pom.xml Tue Feb 24 11:01:47 2015 +0100
1.3 @@ -125,5 +125,11 @@
1.4 <classifier>bck2brwsr</classifier>
1.5 <scope>provided</scope>
1.6 </dependency>
1.7 + <dependency>
1.8 + <groupId>org.testng</groupId>
1.9 + <artifactId>testng</artifactId>
1.10 + <version>6.8.8</version>
1.11 + <scope>test</scope>
1.12 + </dependency>
1.13 </dependencies>
1.14 </project>
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/javaquery/demo-calculator/src/test/java/org/apidesign/bck2brwsr/demo/calc/staticcompilation/MinifiedTest.java Tue Feb 24 11:01:47 2015 +0100
2.3 @@ -0,0 +1,95 @@
2.4 +/**
2.5 + * Back 2 Browser Bytecode Translator
2.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
2.7 + *
2.8 + * This program is free software: you can redistribute it and/or modify
2.9 + * it under the terms of the GNU General Public License as published by
2.10 + * the Free Software Foundation, version 2 of the License.
2.11 + *
2.12 + * This program is distributed in the hope that it will be useful,
2.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2.15 + * GNU General Public License for more details.
2.16 + *
2.17 + * You should have received a copy of the GNU General Public License
2.18 + * along with this program. Look for COPYING file in the top folder.
2.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
2.20 + */
2.21 +package org.apidesign.bck2brwsr.demo.calc.staticcompilation;
2.22 +
2.23 +import java.io.BufferedReader;
2.24 +import java.io.InputStreamReader;
2.25 +import java.net.URL;
2.26 +import java.util.Enumeration;
2.27 +import java.util.Map;
2.28 +import java.util.jar.Attributes;
2.29 +import java.util.jar.Manifest;
2.30 +import org.testng.annotations.Test;
2.31 +import static org.testng.Assert.*;
2.32 +
2.33 +public class MinifiedTest {
2.34 + @Test public void minifiedVersionDoesNotContainFQN() throws Exception {
2.35 + final ClassLoader l = MinifiedTest.class.getClassLoader();
2.36 + Enumeration<URL> en = l.getResources("META-INF/MANIFEST.MF");
2.37 + while (en.hasMoreElements()) {
2.38 + URL u = en.nextElement();
2.39 + Manifest mf = new Manifest(u.openStream());
2.40 + for (Map.Entry<String, Attributes> entrySet : mf.getEntries().entrySet()) {
2.41 + String key = entrySet.getKey();
2.42 + if (!key.contains("-min.js")) {
2.43 + continue;
2.44 + }
2.45 + if (!key.contains("javaquery.api")) {
2.46 + continue;
2.47 + }
2.48 + try (BufferedReader r = new BufferedReader(new InputStreamReader(l.getResourceAsStream(key)))) {
2.49 + for (;;) {
2.50 + String line = r.readLine();
2.51 + if (line == null) {
2.52 + break;
2.53 + }
2.54 + if (line.contains(" org_apidesign_bck2brwsr_htmlpage_Knockout")) {
2.55 + fail("Found FQN of non-public class. Is it minified version?: " + line + " in " + key);
2.56 + }
2.57 + }
2.58 + }
2.59 + // success
2.60 + return;
2.61 + }
2.62 + }
2.63 + fail("No minified javaquery found: " + System.getProperty("java.class.path"));
2.64 + }
2.65 +
2.66 + @Test public void debugVersionContainsFQN() throws Exception {
2.67 + final ClassLoader l = MinifiedTest.class.getClassLoader();
2.68 + Enumeration<URL> en = l.getResources("META-INF/MANIFEST.MF");
2.69 + while (en.hasMoreElements()) {
2.70 + URL u = en.nextElement();
2.71 + Manifest mf = new Manifest(u.openStream());
2.72 + for (Map.Entry<String, Attributes> entrySet : mf.getEntries().entrySet()) {
2.73 + String key = entrySet.getKey();
2.74 + if (!key.contains("-debug.js")) {
2.75 + continue;
2.76 + }
2.77 + if (!key.contains("javaquery.api")) {
2.78 + continue;
2.79 + }
2.80 + try (BufferedReader r = new BufferedReader(new InputStreamReader(l.getResourceAsStream(key)))) {
2.81 + for (;;) {
2.82 + String line = r.readLine();
2.83 + if (line == null) {
2.84 + break;
2.85 + }
2.86 + if (line.contains(" org_apidesign_bck2brwsr_htmlpage_Knockout")) {
2.87 + // ok, it should be there
2.88 + return;
2.89 + }
2.90 + }
2.91 + }
2.92 + fail("Found no FQN of non-public Knockout class. Is it debug version?:" + key);
2.93 + }
2.94 + }
2.95 + fail("No debug javaquery found: " + System.getProperty("java.class.path"));
2.96 + }
2.97 +
2.98 +}
3.1 --- a/rt/mojo/pom.xml Mon Feb 23 09:00:13 2015 +0100
3.2 +++ b/rt/mojo/pom.xml Tue Feb 24 11:01:47 2015 +0100
3.3 @@ -52,6 +52,12 @@
3.4 <artifactId>maven-plugin-api</artifactId>
3.5 <version>3.0.4</version>
3.6 <type>jar</type>
3.7 + <exclusions>
3.8 + <exclusion>
3.9 + <groupId>org.sonatype.sisu</groupId>
3.10 + <artifactId>sisu-guava</artifactId>
3.11 + </exclusion>
3.12 + </exclusions>
3.13 </dependency>
3.14 <dependency>
3.15 <groupId>org.apache.maven.plugin-tools</groupId>