projects
/
cc0
/
argeo-build.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
022586d
)
Generate JPMS module-info
author
Mathieu Baudier <mbaudier@argeo.org>
Fri, 12 Apr 2024 11:04:31 +0000
(13:04 +0200)
committer
Mathieu Baudier <mbaudier@argeo.org>
Fri, 12 Apr 2024 11:04:31 +0000
(13:04 +0200)
src/org/argeo/build/Make.java
patch
|
blob
|
history
diff --git
a/src/org/argeo/build/Make.java
b/src/org/argeo/build/Make.java
index e1e81deed4911992ad9b1bdce358664431d5e872..05f95b33f18e38396bfff37f429d135be55edb81 100644
(file)
--- a/
src/org/argeo/build/Make.java
+++ b/
src/org/argeo/build/Make.java
@@
-45,6
+45,7
@@
import org.eclipse.jdt.core.compiler.CompilationProgress;
import aQute.bnd.osgi.Analyzer;
import aQute.bnd.osgi.Jar;
import aQute.bnd.osgi.Analyzer;
import aQute.bnd.osgi.Jar;
+import aQute.bnd.osgi.Resource;
import aQute.bnd.plugin.jpms.JPMSModuleInfoPlugin;
/**
import aQute.bnd.plugin.jpms.JPMSModuleInfoPlugin;
/**
@@
-482,6
+483,7
@@
public class Make {
if (!Files.exists(binP))
Files.createDirectories(binP);
Manifest manifest;
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());
try (Analyzer bndAnalyzer = new Analyzer()) {
bndAnalyzer.setProperties(properties);
Jar jar = new Jar(bundleSymbolicName, binP.toFile());
@@
-492,6
+494,7
@@
public class Make {
jar.setManifest(manifest);
JPMSModuleInfoPlugin jpmsModuleInfoPlugin = new JPMSModuleInfoPlugin();
jpmsModuleInfoPlugin.verify(bndAnalyzer);
jar.setManifest(manifest);
JPMSModuleInfoPlugin jpmsModuleInfoPlugin = new JPMSModuleInfoPlugin();
jpmsModuleInfoPlugin.verify(bndAnalyzer);
+ moduleInfoClass = jar.getResource("module-info.class");
} catch (Exception e) {
throw new RuntimeException("Bnd analysis of " + compiled + " failed", e);
}
} catch (Exception e) {
throw new RuntimeException("Bnd analysis of " + compiled + " failed", e);
}
@@
-508,6
+511,17
@@
public class Make {
manifest.write(out);
}
manifest.write(out);
}
+ // Write module-info.class
+ if (moduleInfoClass != null) {
+ Path moduleInfoClassP = compiled.resolve("module-info.class");
+ Files.createDirectories(moduleInfoClassP.getParent());
+ try (OutputStream out = Files.newOutputStream(moduleInfoClassP)) {
+ moduleInfoClass.write(out);
+ } catch (Exception e) {
+ throw new RuntimeException("Cannot write module-info.class");
+ }
+ }
+
// Load excludes
List<PathMatcher> excludes = new ArrayList<>();
Path excludesP = argeoBuildBase.resolve("excludes.txt");
// Load excludes
List<PathMatcher> excludes = new ArrayList<>();
Path excludesP = argeoBuildBase.resolve("excludes.txt");