diff --git a/ci/common.jsonnet b/ci/common.jsonnet index 91041748..70f1f909 100644 --- a/ci/common.jsonnet +++ b/ci/common.jsonnet @@ -236,11 +236,17 @@ local common_json = import "../common.json"; mount_modules: true, }, }, + local ol9 = { + docker+: { + image: "buildslave_ol9", + mount_modules: true, + }, + }, local ubuntu22 = { - docker: { - image: "buildslave_ubuntu22", - mount_modules: true, - }, + docker+: { + image: "buildslave_ubuntu22", + mount_modules: true, + }, }, local deps_linux = { }, @@ -256,10 +262,13 @@ local common_json = import "../common.json"; local amd64 = { arch:: "amd64", capabilities+: [self.arch] }, local aarch64 = { arch:: "aarch64", capabilities+: [self.arch] }, + local ol_distro = {os_distro:: "ol"}, - linux_amd64: linux + amd64 + ol7, - linux_amd64_ubuntu: linux + amd64 + ubuntu22, - linux_aarch64: linux + aarch64, + linux_amd64: linux + amd64 + ol7 + ol_distro, + linux_amd64_ubuntu: linux + amd64 + ubuntu22 + {os_distro:: "ubuntu"}, + linux_amd64_ol9: linux + amd64 + ol9 + ol_distro, + linux_aarch64: linux + aarch64 + ol_distro, + linux_aarch64_ol9: linux + aarch64 + ol9 + ol_distro, darwin_amd64: darwin + amd64, darwin_aarch64: darwin + aarch64, @@ -267,6 +276,7 @@ local common_json = import "../common.json"; windows_amd64: windows + amd64, windows_server_2016_amd64: windows_server_2016 + amd64, + # Utils disable_proxies: { setup+: [ diff --git a/common.json b/common.json index 59991f63..d876612c 100644 --- a/common.json +++ b/common.json @@ -4,7 +4,7 @@ "Jsonnet files should not include this file directly but use ci/common.jsonnet instead." ], - "mx_version": "6.34.0", + "mx_version": "6.35.1", "COMMENT.jdks": "When adding or removing JDKs keep in sync with JDKs in ci/common.jsonnet", "jdks": { diff --git a/java/com.oracle.mxtool.junit.jdk9/src/com/oracle/mxtool/junit/ModuleSupport.java b/java/com.oracle.mxtool.junit.jdk9/src/com/oracle/mxtool/junit/ModuleSupport.java index 06b7c8a8..2d4fc640 100644 --- a/java/com.oracle.mxtool.junit.jdk9/src/com/oracle/mxtool/junit/ModuleSupport.java +++ b/java/com.oracle.mxtool.junit.jdk9/src/com/oracle/mxtool/junit/ModuleSupport.java @@ -68,6 +68,29 @@ void processAddExportsAnnotations(Set> classes, Set opened, Set } } + void processAddModulesAnnotations(Set> classes) { + Set> types = new HashSet<>(); + for (Class cls : classes) { + gatherSupertypes(cls, types); + } + for (Class cls : types) { + Annotation[] annos = cls.getAnnotations(); + for (Annotation a : annos) { + Class annotationType = a.annotationType(); + if (annotationType.getSimpleName().equals("AddModules")) { + Optional value = getElement("value", String[].class, a); + if (value.isPresent()) { + for (String spec : value.get()) { + Modules.loadModule(spec); + } + } else { + out.printf("%s: Ignoring \"AddModules\" annotation without `String value` element: %s%n", cls.getName(), a); + } + } + } + } + } + public static List findModules(String spec) { ModuleLayer bootLayer = ModuleLayer.boot(); Set modules = bootLayer.modules(); diff --git a/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/ModuleSupport.java b/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/ModuleSupport.java index c359aebe..80b1b8a5 100644 --- a/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/ModuleSupport.java +++ b/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/ModuleSupport.java @@ -70,4 +70,14 @@ void openPackages(String spec, Object context, Set opened, Set e void processAddExportsAnnotations(Set> classes, Set opened, Set exported) { // Nop on JDK 8 } + + /** + * Loads modules specified in {@code AddModules} annotations on {@code classes}. + * + * @param classes the list of classes whose annotations are to be processed + */ + @SuppressWarnings("unused") + public void processAddModulesAnnotations(Set> classes) { + // Nop on JDK 8 + } } diff --git a/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/MxJUnitRequest.java b/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/MxJUnitRequest.java index 6bfa9e9a..19e1c60f 100644 --- a/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/MxJUnitRequest.java +++ b/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/MxJUnitRequest.java @@ -163,5 +163,9 @@ public MxJUnitRequest build() { } return new MxJUnitRequest(request, classes, methodName, missingClasses); } + + protected Set> getClasses() { + return classes; + } } } diff --git a/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/MxJUnitWrapper.java b/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/MxJUnitWrapper.java index 6db9a529..486b92eb 100644 --- a/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/MxJUnitWrapper.java +++ b/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/MxJUnitWrapper.java @@ -27,10 +27,9 @@ import java.io.BufferedReader; import java.io.File; import java.io.FileOutputStream; -import java.util.zip.GZIPOutputStream; -import java.io.OutputStream; import java.io.FileReader; import java.io.IOException; +import java.io.OutputStream; import java.io.PrintStream; import java.util.ArrayList; import java.util.Collections; @@ -39,6 +38,7 @@ import java.util.ServiceLoader; import java.util.Set; import java.util.TreeSet; +import java.util.zip.GZIPOutputStream; import org.junit.internal.JUnitSystem; import org.junit.internal.RealSystem; @@ -213,6 +213,7 @@ public static void main(String... args) { } } + moduleSupport.processAddModulesAnnotations(builder.getClasses()); MxJUnitRequest request = builder.build(); moduleSupport.processAddExportsAnnotations(request.classes, opened, exported); diff --git a/mx.py b/mx.py index 3117eaff..534aafd8 100755 --- a/mx.py +++ b/mx.py @@ -18559,7 +18559,7 @@ def alarm_handler(signum, frame): abort(1, killsig=signal.SIGINT) # The version must be updated for every PR (checked in CI) and the comment should reflect the PR's issue -version = VersionSpec("6.37.0") # Add meta-POM distribution for artefacts with pom packaging. +version = VersionSpec("6.38.0") # Allow loading extra modules in unit tests _mx_start_datetime = datetime.utcnow() _last_timestamp = _mx_start_datetime