X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=src%2Forg%2Fargeo%2Fbuild%2FMake.java;h=b1d96e2ee9c710d9d86d69f4645722d8c872a5a7;hb=09077e4ece9ea6d8e0b442084a80103bd5733b4b;hp=b0066ac99bdf7ca0295b1bef5aef8e04efe4e882;hpb=dc142b1688d1163ae5afe93fd39bec0fda62c71a;p=cc0%2Fargeo-build.git diff --git a/src/org/argeo/build/Make.java b/src/org/argeo/build/Make.java index b0066ac..b1d96e2 100644 --- a/src/org/argeo/build/Make.java +++ b/src/org/argeo/build/Make.java @@ -45,6 +45,8 @@ import org.eclipse.jdt.core.compiler.CompilationProgress; import aQute.bnd.osgi.Analyzer; import aQute.bnd.osgi.Jar; +import aQute.bnd.osgi.Resource; +import aQute.bnd.plugin.jpms.JPMSModuleInfoPlugin; /** * Minimalistic OSGi compiler and packager, meant to be used as a single file @@ -481,11 +483,18 @@ public class Make { if (!Files.exists(binP)) Files.createDirectories(binP); Manifest manifest; + Resource moduleInfoClass = null; try (Analyzer bndAnalyzer = new Analyzer()) { bndAnalyzer.setProperties(properties); Jar jar = new Jar(bundleSymbolicName, binP.toFile()); bndAnalyzer.setJar(jar); manifest = bndAnalyzer.calcManifest(); + + // JPMS module + jar.setManifest(manifest); + JPMSModuleInfoPlugin jpmsModuleInfoPlugin = new JPMSModuleInfoPlugin(); + jpmsModuleInfoPlugin.verify(bndAnalyzer); + moduleInfoClass = bndAnalyzer.getJar().getResource("module-info.class"); } catch (Exception e) { throw new RuntimeException("Bnd analysis of " + compiled + " failed", e); } @@ -502,6 +511,18 @@ public class Make { manifest.write(out); } + // Write module-info.class + if (moduleInfoClass != null) { + Path moduleInfoClassP = binP.resolve("module-info.class"); + Files.createDirectories(moduleInfoClassP.getParent()); + try (OutputStream out = Files.newOutputStream(moduleInfoClassP)) { + moduleInfoClass.write(out); +// logger.log(INFO, "Wrote " + moduleInfoClassP); + } catch (Exception e) { + throw new RuntimeException("Cannot write module-info.class"); + } + } + // Load excludes List excludes = new ArrayList<>(); Path excludesP = argeoBuildBase.resolve("excludes.txt");