1.1 --- a/rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/AOTLibrary.java Mon Mar 28 05:55:43 2016 +0200
1.2 +++ b/rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/AOTLibrary.java Mon Mar 28 06:34:38 2016 +0200
1.3 @@ -31,6 +31,7 @@
1.4 import java.util.List;
1.5 import java.util.jar.Attributes;
1.6 import java.util.jar.JarEntry;
1.7 +import java.util.jar.JarFile;
1.8 import java.util.jar.JarOutputStream;
1.9 import java.util.jar.Manifest;
1.10 import org.apache.maven.artifact.Artifact;
1.11 @@ -106,6 +107,7 @@
1.12 attr.putValue("Bck2BrwsrGroupId", prj.getGroupId());
1.13 attr.putValue("Bck2BrwsrVersion", prj.getVersion());
1.14 attr.putValue("Bck2BrwsrMinified", "true");
1.15 + bundleName(attr, mainJar);
1.16 m.getEntries().put(minified, attr);
1.17 }
1.18 if (!"false".equals(debug)) {
1.19 @@ -114,6 +116,7 @@
1.20 attr.putValue("Bck2BrwsrGroupId", prj.getGroupId());
1.21 attr.putValue("Bck2BrwsrVersion", prj.getVersion());
1.22 attr.putValue("Bck2BrwsrDebug", "true");
1.23 + bundleName(attr, mainJar);
1.24 m.getEntries().put(debug, attr);
1.25 }
1.26
1.27 @@ -129,6 +132,8 @@
1.28 attr.putValue("Bck2BrwsrGroupId", a.getGroupId());
1.29 attr.putValue("Bck2BrwsrVersion", a.getVersion());
1.30 attr.putValue("Bck2BrwsrDebug", "true");
1.31 + bundleName(attr, a.getFile());
1.32 +
1.33 m.getEntries().put(artifactName(a, true), attr);
1.34 }
1.35 {
1.36 @@ -137,6 +142,7 @@
1.37 attr.putValue("Bck2BrwsrGroupId", a.getGroupId());
1.38 attr.putValue("Bck2BrwsrVersion", a.getVersion());
1.39 attr.putValue("Bck2BrwsrMinified", "true");
1.40 + bundleName(attr, a.getFile());
1.41 m.getEntries().put(artifactName(a, false), attr);
1.42 }
1.43 }
1.44 @@ -237,6 +243,19 @@
1.45 return a.getGroupId() + "-" + a.getArtifactId() + (debug ? "-debug.js" : "-min.js");
1.46 }
1.47
1.48 + private static void bundleName(Attributes attr, File file) throws IOException {
1.49 + try (JarFile jf = new JarFile(file)) {
1.50 + Attributes main = jf.getManifest().getMainAttributes();
1.51 + String version = main.getValue("Bundle-SymbolicName");
1.52 + if (version == null) {
1.53 + version = main.getValue("OpenIDE-Module-Name");
1.54 + }
1.55 + if (version != null) {
1.56 + attr.putValue("Bck2BrwsrName", version);
1.57 + }
1.58 + }
1.59 + }
1.60 +
1.61 private static URLClassLoader buildClassLoader(File root, Collection<Artifact> deps) throws MalformedURLException {
1.62 List<URL> arr = new ArrayList<URL>();
1.63 if (root != null) {