Introducing vmtest.precompiled=<regexp> to verify that bck2brwsr generated resources are really used
1.1 --- a/launcher/http/pom.xml Fri Mar 25 21:47:31 2016 +0100
1.2 +++ b/launcher/http/pom.xml Mon Mar 28 05:55:43 2016 +0200
1.3 @@ -30,6 +30,29 @@
1.4 <skip>false</skip>
1.5 </configuration>
1.6 </plugin>
1.7 + <plugin>
1.8 + <groupId>org.apidesign.bck2brwsr</groupId>
1.9 + <artifactId>bck2brwsr-maven-plugin</artifactId>
1.10 + <version>0.17</version>
1.11 + <executions>
1.12 + <execution>
1.13 + <goals>
1.14 + <goal>library</goal>
1.15 + </goals>
1.16 + </execution>
1.17 + </executions>
1.18 + <configuration>
1.19 + <ignoreBootClassPath>false</ignoreBootClassPath>
1.20 + </configuration>
1.21 + <dependencies>
1.22 + <dependency>
1.23 + <groupId>org.apidesign.bck2brwsr</groupId>
1.24 + <artifactId>aot</artifactId>
1.25 + <version>${project.version}</version>
1.26 + <type>jar</type>
1.27 + </dependency>
1.28 + </dependencies>
1.29 + </plugin>
1.30 </plugins>
1.31 </build>
1.32 <properties>
1.33 @@ -70,7 +93,7 @@
1.34 <dependency>
1.35 <groupId>org.apidesign.bck2brwsr</groupId>
1.36 <artifactId>aot</artifactId>
1.37 - <version>0.18</version>
1.38 + <version>${project.version}</version>
1.39 <type>jar</type>
1.40 </dependency>
1.41 </dependencies>
2.1 --- a/launcher/http/src/main/java/org/apidesign/bck2brwsr/launcher/Bck2BrwsrLauncher.java Fri Mar 25 21:47:31 2016 +0100
2.2 +++ b/launcher/http/src/main/java/org/apidesign/bck2brwsr/launcher/Bck2BrwsrLauncher.java Mon Mar 28 05:55:43 2016 +0200
2.3 @@ -24,11 +24,10 @@
2.4 import java.net.MalformedURLException;
2.5 import java.net.URISyntaxException;
2.6 import java.net.URL;
2.7 -import java.util.Arrays;
2.8 import java.util.HashSet;
2.9 -import java.util.List;
2.10 import java.util.Set;
2.11 import java.util.logging.Level;
2.12 +import java.util.regex.Pattern;
2.13
2.14 /**
2.15 * Lightweight server to launch Bck2Brwsr applications and tests.
2.16 @@ -59,6 +58,10 @@
2.17 } catch (URISyntaxException ex) {
2.18 throw new IOException(ex);
2.19 }
2.20 + final String precompile = System.getProperty("vmtest.precompiled");
2.21 + if (precompile != null && Pattern.compile(precompile).matcher(jar.toString()).find()) {
2.22 + throw new IOException("Compilation of " + jar + " forbidden");
2.23 + }
2.24 LOG.log(Level.INFO, "No precompiled version for {0} found. Compiling.", jar);
2.25 return CompileCP.compileJAR(f, testClasses);
2.26 }
3.1 --- a/rt/emul/compact/src/main/assembly/rt.xml Fri Mar 25 21:47:31 2016 +0100
3.2 +++ b/rt/emul/compact/src/main/assembly/rt.xml Mon Mar 28 05:55:43 2016 +0200
3.3 @@ -12,7 +12,7 @@
3.4 <scope>provided</scope>
3.5 <unpackOptions>
3.6 <excludes>
3.7 - <exclude>META-INF/maven/**</exclude>
3.8 + <exclude>META-INF/maven/**/*mini*/**</exclude>
3.9 </excludes>
3.10 </unpackOptions>
3.11 <excludes>
4.1 --- a/rt/emul/compacttest/pom.xml Fri Mar 25 21:47:31 2016 +0100
4.2 +++ b/rt/emul/compacttest/pom.xml Mon Mar 28 05:55:43 2016 +0200
4.3 @@ -29,12 +29,26 @@
4.4 </dependency>
4.5 <dependency>
4.6 <groupId>${project.groupId}</groupId>
4.7 + <artifactId>launcher.http</artifactId>
4.8 + <version>${project.version}</version>
4.9 + <classifier>bck2brwsr</classifier>
4.10 + <scope>test</scope>
4.11 + </dependency>
4.12 + <dependency>
4.13 + <groupId>${project.groupId}</groupId>
4.14 <artifactId>emul</artifactId>
4.15 <classifier>rt</classifier>
4.16 <version>${project.version}</version>
4.17 <scope>test</scope>
4.18 </dependency>
4.19 <dependency>
4.20 + <groupId>${project.groupId}</groupId>
4.21 + <artifactId>emul</artifactId>
4.22 + <classifier>bck2brwsr</classifier>
4.23 + <version>${project.version}</version>
4.24 + <scope>test</scope>
4.25 + </dependency>
4.26 + <dependency>
4.27 <groupId>org.netbeans.api</groupId>
4.28 <artifactId>org-openide-util-lookup</artifactId>
4.29 <scope>test</scope>
4.30 @@ -76,7 +90,12 @@
4.31 </configuration>
4.32 </execution>
4.33 </executions>
4.34 - </plugin>
4.35 + <configuration>
4.36 + <systemProperties>
4.37 + <vmtest.precompiled>.*</vmtest.precompiled>
4.38 + </systemProperties>
4.39 + </configuration>
4.40 + </plugin>
4.41 </plugins>
4.42 </build>
4.43 </project>
5.1 --- a/rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/AOTLibrary.java Fri Mar 25 21:47:31 2016 +0100
5.2 +++ b/rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/AOTLibrary.java Mon Mar 28 05:55:43 2016 +0200
5.3 @@ -18,6 +18,7 @@
5.4 package org.apidesign.bck2brwsr.mojo;
5.5
5.6 import java.io.File;
5.7 +import java.io.FileNotFoundException;
5.8 import java.io.FileOutputStream;
5.9 import java.io.IOException;
5.10 import java.io.OutputStreamWriter;
5.11 @@ -141,10 +142,12 @@
5.12 }
5.13 }
5.14
5.15 - FileOutputStream fos = new FileOutputStream(this.aotJar);
5.16 - JarOutputStream os = new JarOutputStream(fos, m);
5.17
5.18 + JarOutputStream os = null;
5.19 if (!"false".equals(debug)) {
5.20 + if (os == null) {
5.21 + os = aotJar(m);
5.22 + }
5.23 os.putNextEntry(new JarEntry(debug));
5.24 Writer w = new OutputStreamWriter(os, "UTF-8");
5.25 configureMain(loader).
5.26 @@ -154,6 +157,9 @@
5.27 os.closeEntry();
5.28 }
5.29 if (!"false".equals(minified)) {
5.30 + if (os == null) {
5.31 + os = aotJar(m);
5.32 + }
5.33 os.putNextEntry(new JarEntry(minified));
5.34
5.35 Writer w = new OutputStreamWriter(os, "UTF-8");
5.36 @@ -177,6 +183,9 @@
5.37 }
5.38 }
5.39 {
5.40 + if (os == null) {
5.41 + os = aotJar(m);
5.42 + }
5.43 os.putNextEntry(new JarEntry(artifactName(a, true)));
5.44 Writer w = new OutputStreamWriter(os, "UTF-8");
5.45 c.
5.46 @@ -197,7 +206,9 @@
5.47 }
5.48 }
5.49 }
5.50 - os.close();
5.51 + if (os != null) {
5.52 + os.close();
5.53 + }
5.54
5.55 projectHelper.attachArtifact(prj, "jar", "bck2brwsr", aotJar);
5.56 } catch (IOException ex) {
5.57 @@ -205,6 +216,13 @@
5.58 }
5.59 }
5.60
5.61 + private JarOutputStream aotJar(Manifest m) throws IOException, FileNotFoundException {
5.62 + this.aotJar.getParentFile().mkdirs();
5.63 + FileOutputStream fos = new FileOutputStream(this.aotJar);
5.64 + JarOutputStream os = new JarOutputStream(fos, m);
5.65 + return os;
5.66 + }
5.67 +
5.68 private Bck2Brwsr configureMain(URLClassLoader loader) throws IOException {
5.69 Bck2Brwsr c = Bck2BrwsrJars.configureFrom(null, mainJar, loader, ignoreBootClassPath);
5.70 if (exports != null) {