1.1 --- a/benchmarks/jbox2d-osgi/pom.xml Mon Mar 28 05:56:31 2016 +0200
1.2 +++ b/benchmarks/jbox2d-osgi/pom.xml Mon Mar 28 06:34:38 2016 +0200
1.3 @@ -6,6 +6,7 @@
1.4 <artifactId>benchmarks</artifactId>
1.5 <version>0.18</version>
1.6 </parent>
1.7 + <name>JBox2d OSGI Wrapper</name>
1.8 <packaging>bundle</packaging>
1.9 <artifactId>jbox2d-osgi</artifactId>
1.10 <properties>
1.11 @@ -41,6 +42,15 @@
1.12 <extensions>true</extensions>
1.13 </plugin>
1.14 <plugin>
1.15 + <artifactId>maven-jar-plugin</artifactId>
1.16 + <version>2.6</version>
1.17 + <configuration>
1.18 + <archive>
1.19 + <addMavenDescriptor>false</addMavenDescriptor>
1.20 + </archive>
1.21 + </configuration>
1.22 + </plugin>
1.23 + <plugin>
1.24 <groupId>org.apidesign.bck2brwsr</groupId>
1.25 <artifactId>bck2brwsr-maven-plugin</artifactId>
1.26 <version>${project.version}</version>
2.1 --- a/launcher/fx/src/main/java/org/apidesign/bck2brwsr/launcher/BaseHTTPLauncher.java Mon Mar 28 05:56:31 2016 +0200
2.2 +++ b/launcher/fx/src/main/java/org/apidesign/bck2brwsr/launcher/BaseHTTPLauncher.java Mon Mar 28 06:34:38 2016 +0200
2.3 @@ -37,6 +37,7 @@
2.4 import java.util.ArrayList;
2.5 import java.util.Arrays;
2.6 import java.util.Enumeration;
2.7 +import java.util.HashMap;
2.8 import java.util.HashSet;
2.9 import java.util.LinkedHashSet;
2.10 import java.util.List;
2.11 @@ -649,6 +650,7 @@
2.12
2.13 Object compileJar(URL jarURL) throws IOException {
2.14 List<String[]> libraries = new ArrayList<String[]>();
2.15 + Map<String,Object[]> osgiJars = new HashMap<String, Object[]>();
2.16 for (ClassLoader loader : loaders) {
2.17 Enumeration<URL> en = loader.getResources("META-INF/MANIFEST.MF");
2.18 while (en.hasMoreElements()) {
2.19 @@ -662,13 +664,26 @@
2.20 final String g = attr.getValue("Bck2BrwsrGroupId");
2.21 final String v = attr.getValue("Bck2BrwsrVersion");
2.22 final String d = attr.getValue("Bck2BrwsrDebug");
2.23 + final String n = attr.getValue("Bck2BrwsrName");
2.24
2.25 if (g != null && a != null && v != null && "true".equals(d)) {
2.26 libraries.add(new String[] {
2.27 - a, g, v, key
2.28 + a, g, v, key, n
2.29 });
2.30 }
2.31 }
2.32 + final Attributes main = mf.getMainAttributes();
2.33 + String symbol = main.getValue("Bundle-SymbolicName");
2.34 + String version;
2.35 + if (symbol == null) {
2.36 + symbol = main.getValue("OpenIDE-Module-Name");
2.37 + version = main.getValue("OpenIDE-Module-SpecificationVersion");
2.38 + } else {
2.39 + version = main.getValue("Bundle-Version");
2.40 + }
2.41 + if (symbol != null) {
2.42 + osgiJars.put(symbol, new Object[] { e, version });
2.43 + }
2.44 }
2.45 }
2.46 URL precompiled = null;
2.47 @@ -693,6 +708,16 @@
2.48 }
2.49 }
2.50 }
2.51 + if (precompiled == null) {
2.52 + for (ClassLoader loader : loaders) {
2.53 + for (String[] lib : libraries) {
2.54 + Object[] urlVersion = osgiJars.get(lib[4]);
2.55 + if (urlVersion != null && urlVersion[1].toString().startsWith(lib[2])) {
2.56 + precompiled = loader.getResource(lib[3]);
2.57 + }
2.58 + }
2.59 + }
2.60 + }
2.61 Object ret = BaseHTTPLauncher.this.compileJar(jarURL, precompiled);
2.62 ignore.add(jarURL);
2.63 return ret;
3.1 --- a/rt/mojo/pom.xml Mon Mar 28 05:56:31 2016 +0200
3.2 +++ b/rt/mojo/pom.xml Mon Mar 28 06:34:38 2016 +0200
3.3 @@ -39,8 +39,8 @@
3.4 <artifactId>maven-compiler-plugin</artifactId>
3.5 <version>2.3.2</version>
3.6 <configuration>
3.7 - <source>1.6</source>
3.8 - <target>1.6</target>
3.9 + <source>1.7</source>
3.10 + <target>1.7</target>
3.11 </configuration>
3.12 </plugin>
3.13 </plugins>
4.1 --- a/rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/AOTLibrary.java Mon Mar 28 05:56:31 2016 +0200
4.2 +++ b/rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/AOTLibrary.java Mon Mar 28 06:34:38 2016 +0200
4.3 @@ -31,6 +31,7 @@
4.4 import java.util.List;
4.5 import java.util.jar.Attributes;
4.6 import java.util.jar.JarEntry;
4.7 +import java.util.jar.JarFile;
4.8 import java.util.jar.JarOutputStream;
4.9 import java.util.jar.Manifest;
4.10 import org.apache.maven.artifact.Artifact;
4.11 @@ -106,6 +107,7 @@
4.12 attr.putValue("Bck2BrwsrGroupId", prj.getGroupId());
4.13 attr.putValue("Bck2BrwsrVersion", prj.getVersion());
4.14 attr.putValue("Bck2BrwsrMinified", "true");
4.15 + bundleName(attr, mainJar);
4.16 m.getEntries().put(minified, attr);
4.17 }
4.18 if (!"false".equals(debug)) {
4.19 @@ -114,6 +116,7 @@
4.20 attr.putValue("Bck2BrwsrGroupId", prj.getGroupId());
4.21 attr.putValue("Bck2BrwsrVersion", prj.getVersion());
4.22 attr.putValue("Bck2BrwsrDebug", "true");
4.23 + bundleName(attr, mainJar);
4.24 m.getEntries().put(debug, attr);
4.25 }
4.26
4.27 @@ -129,6 +132,8 @@
4.28 attr.putValue("Bck2BrwsrGroupId", a.getGroupId());
4.29 attr.putValue("Bck2BrwsrVersion", a.getVersion());
4.30 attr.putValue("Bck2BrwsrDebug", "true");
4.31 + bundleName(attr, a.getFile());
4.32 +
4.33 m.getEntries().put(artifactName(a, true), attr);
4.34 }
4.35 {
4.36 @@ -137,6 +142,7 @@
4.37 attr.putValue("Bck2BrwsrGroupId", a.getGroupId());
4.38 attr.putValue("Bck2BrwsrVersion", a.getVersion());
4.39 attr.putValue("Bck2BrwsrMinified", "true");
4.40 + bundleName(attr, a.getFile());
4.41 m.getEntries().put(artifactName(a, false), attr);
4.42 }
4.43 }
4.44 @@ -237,6 +243,19 @@
4.45 return a.getGroupId() + "-" + a.getArtifactId() + (debug ? "-debug.js" : "-min.js");
4.46 }
4.47
4.48 + private static void bundleName(Attributes attr, File file) throws IOException {
4.49 + try (JarFile jf = new JarFile(file)) {
4.50 + Attributes main = jf.getManifest().getMainAttributes();
4.51 + String version = main.getValue("Bundle-SymbolicName");
4.52 + if (version == null) {
4.53 + version = main.getValue("OpenIDE-Module-Name");
4.54 + }
4.55 + if (version != null) {
4.56 + attr.putValue("Bck2BrwsrName", version);
4.57 + }
4.58 + }
4.59 + }
4.60 +
4.61 private static URLClassLoader buildClassLoader(File root, Collection<Artifact> deps) throws MalformedURLException {
4.62 List<URL> arr = new ArrayList<URL>();
4.63 if (root != null) {