Skip to content

Commit 6917e64

Browse files
committed
Pass in javaArgs to --list-modules call
This ensures that the --upgrade-module-path is being passed to --list-modules as well ensuring appropriate packages are exported by the upgradable jvmci module.
1 parent 22974bd commit 6917e64

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,7 +1503,7 @@ protected int buildImage(List<String> javaArgs, LinkedHashSet<Path> cp, LinkedHa
15031503
Function<Path, Path> substituteModulePath = useBundle() ? bundleSupport::substituteModulePath : Function.identity();
15041504
List<Path> substitutedImageModulePath = imagemp.stream().map(substituteModulePath).toList();
15051505

1506-
Map<String, Path> modules = listModulesFromPath(javaExecutable, Stream.concat(mp.stream(), imagemp.stream()).distinct().toList());
1506+
Map<String, Path> modules = listModulesFromPath(javaExecutable, javaArgs, Stream.concat(mp.stream(), imagemp.stream()).distinct().toList());
15071507
if (!addModules.isEmpty()) {
15081508

15091509
arguments.add("-D" + ModuleSupport.PROPERTY_IMAGE_EXPLICITLY_ADDED_MODULES + "=" +
@@ -1630,16 +1630,16 @@ protected int buildImage(List<String> javaArgs, LinkedHashSet<Path> cp, LinkedHa
16301630
/**
16311631
* Resolves and lists all modules given a module path.
16321632
*
1633-
* @see #callListModules(String, List)
1633+
* @see #callListModules(String, List, List)
16341634
*/
1635-
private Map<String, Path> listModulesFromPath(String javaExecutable, Collection<Path> modulePath) {
1635+
private Map<String, Path> listModulesFromPath(String javaExecutable, List<String> javaArgs, List<Path> modulePath) {
16361636
if (modulePath.isEmpty() || !config.modulePathBuild) {
16371637
return Map.of();
16381638
}
16391639
String modulePathEntries = modulePath.stream()
16401640
.map(Path::toString)
16411641
.collect(Collectors.joining(File.pathSeparator));
1642-
return callListModules(javaExecutable, List.of("-p", modulePathEntries));
1642+
return callListModules(javaExecutable, javaArgs, List.of("-p", modulePathEntries));
16431643
}
16441644

16451645
/**
@@ -1650,11 +1650,12 @@ private Map<String, Path> listModulesFromPath(String javaExecutable, Collection<
16501650
* <p>
16511651
* This is a much more robust solution then trying to parse the JDK file structure manually.
16521652
*/
1653-
private static Map<String, Path> callListModules(String javaExecutable, List<String> arguments) {
1653+
private static Map<String, Path> callListModules(String javaExecutable, List<String> javaArgs, List<String> arguments) {
16541654
Process listModulesProcess = null;
16551655
Map<String, Path> result = new LinkedHashMap<>();
16561656
try {
16571657
var pb = new ProcessBuilder(javaExecutable);
1658+
pb.command().addAll(javaArgs);
16581659
pb.command().addAll(arguments);
16591660
pb.command().add("--list-modules");
16601661
pb.environment().clear();

0 commit comments

Comments
 (0)