In CDS/AOT testing, we have a lot of code that deal with compiling/packaging modules, as well as running various child processes for the training/assembly/production phases.
Currently, these operations are done in many low-level steps, so it's difficult to understand and maintain:
https://github.com/openjdk/jdk/blob/fcc2a24291d499f7149debad1250903ddc369d91/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/ExportModule.java
=============================
Proposal:
For simplification, the following APIs should be added (examples)
======= build two modular JAR files into <modulePath>
CDSModulePackager modulePackager = new CDSModulePackager(SRC);
modulePath = modulePackager.getOutputDir().toString();
modulePackager.createModularJar("com.foos");
modulePackager.createModularJar("com.needsfoosaddexport",
"--add-exports",
"com.foos/com.foos.internal=com.needsfoosaddexport");
============= running training/assembly/production phases
SimpleCDSAppTester.of("moduleNeedsJdkAddExport")
.classpath(dummyJar)
.modulepath(modulePath)
.addVmArgs("--add-modules", "com.needsjdkaddexport",
"--add-exports", "java.base/jdk.internal.misc=com.needsjdkaddexport", "-Xlog:cds")
.appCommandLine("-m", "com.needsjdkaddexport/com.needsjdkaddexport.Main")
.setAssemblyChecker((OutputAnalyzer out) -> {
out.shouldContain("Full module graph = enabled");
})
.setProductionChecker((OutputAnalyzer out) -> {
out.shouldContain("use_full_module_graph = true; java.base");
})
.runStaticWorkflow()
.runAOTWorkflow();
Currently, these operations are done in many low-level steps, so it's difficult to understand and maintain:
https://github.com/openjdk/jdk/blob/fcc2a24291d499f7149debad1250903ddc369d91/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/ExportModule.java
=============================
Proposal:
For simplification, the following APIs should be added (examples)
======= build two modular JAR files into <modulePath>
CDSModulePackager modulePackager = new CDSModulePackager(SRC);
modulePath = modulePackager.getOutputDir().toString();
modulePackager.createModularJar("com.foos");
modulePackager.createModularJar("com.needsfoosaddexport",
"--add-exports",
"com.foos/com.foos.internal=com.needsfoosaddexport");
============= running training/assembly/production phases
SimpleCDSAppTester.of("moduleNeedsJdkAddExport")
.classpath(dummyJar)
.modulepath(modulePath)
.addVmArgs("--add-modules", "com.needsjdkaddexport",
"--add-exports", "java.base/jdk.internal.misc=com.needsjdkaddexport", "-Xlog:cds")
.appCommandLine("-m", "com.needsjdkaddexport/com.needsjdkaddexport.Main")
.setAssemblyChecker((OutputAnalyzer out) -> {
out.shouldContain("Full module graph = enabled");
})
.setProductionChecker((OutputAnalyzer out) -> {
out.shouldContain("use_full_module_graph = true; java.base");
})
.runStaticWorkflow()
.runAOTWorkflow();
- links to
-
Commit(master) openjdk/jdk/4ce9b4c7
-
Review(master) openjdk/jdk/24122