Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions substratevm/ci_includes/gate.hocon
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ builds += [
timelimit: "45:00"
environment : {
MAVEN_REPO_LOCAL : "$BUILD_DIR/.m2"
MX_BUILD_EXPLODED : "true"
}
run: [
${svm-cmd-gate} ["style,fullbuild,helloworld,test,svmjunit,maven"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,41 @@ public ClassLoader getClassLoader() {
return classLoader;
}

private static ModuleFinder upgradeAndSystemModuleFinder;

/**
* Creates a finder from a module path specified by the {@code prop} system property.
*/
private static ModuleFinder finderFor(String prop) {
String s = System.getProperty(prop);
if (s == null || s.isEmpty()) {
return null;
} else {
String[] dirs = s.split(File.pathSeparator);
Path[] paths = new Path[dirs.length];
int i = 0;
for (String dir : dirs) {
paths[i++] = Path.of(dir);
}
return ModuleFinder.of(paths);
}
}

/**
* Gets a finder that locates the upgrade modules and the system modules, in that order.
*/
private static ModuleFinder getUpgradeAndSystemModuleFinder() {
if (upgradeAndSystemModuleFinder == null) {
ModuleFinder finder = ModuleFinder.ofSystem();
ModuleFinder upgradeModulePath = finderFor("jdk.module.upgrade.path");
if (upgradeModulePath != null) {
finder = ModuleFinder.compose(upgradeModulePath, finder);
}
upgradeAndSystemModuleFinder = finder;
}
return upgradeAndSystemModuleFinder;
}

private class ClassInitWithModules extends ClassInit {

ClassInitWithModules(ForkJoinPool executor, ImageClassLoader imageClassLoader) {
Expand All @@ -260,7 +295,7 @@ protected void init() {
"jdk.internal.vm.ci", "jdk.internal.vm.compiler", "com.oracle.graal.graal_enterprise",
"org.graalvm.sdk", "org.graalvm.truffle");

for (ModuleReference moduleReference : ModuleFinder.ofSystem().findAll()) {
for (ModuleReference moduleReference : getUpgradeAndSystemModuleFinder().findAll()) {
if (requiresInit.contains(moduleReference.descriptor().name())) {
initModule(moduleReference);
}
Expand Down