Skip to content

Commit

Permalink
Fix thirdPartyAudit task when running on Java 24 (elastic#121712)
Browse files Browse the repository at this point in the history
We need to explicitly add the incubating vector API module to the third
party audit task on Java 24.

(cherry picked from commit 0c667ec)

# Conflicts:
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/ThirdPartyAuditTask.java
  • Loading branch information
mark-vieira committed Feb 5, 2025
1 parent b2fb600 commit f81019e
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import static org.gradle.api.JavaVersion.VERSION_21;
import static org.gradle.api.JavaVersion.VERSION_22;
import static org.gradle.api.JavaVersion.VERSION_23;
import static org.gradle.api.JavaVersion.VERSION_24;

@CacheableTask
public abstract class ThirdPartyAuditTask extends DefaultTask {
Expand Down Expand Up @@ -346,8 +347,12 @@ private String runForbiddenAPIsCli() throws IOException {
spec.setExecutable(javaHome.get() + "/bin/java");
}
spec.classpath(getForbiddenAPIsClasspath(), classpath);
// Enable explicitly for each release as appropriate. Just JDK 20/21/22/23 for now, and just the vector module.
if (isJavaVersion(VERSION_20) || isJavaVersion(VERSION_21) || isJavaVersion(VERSION_22) || isJavaVersion(VERSION_23)) {
// Enable explicitly for each release as appropriate. Just JDK 20/21/22/23/24 for now, and just the vector module.
if (isJavaVersion(VERSION_20)
|| isJavaVersion(VERSION_21)
|| isJavaVersion(VERSION_22)
|| isJavaVersion(VERSION_23)
|| isJavaVersion(VERSION_24)) {
spec.jvmArgs("--add-modules", "jdk.incubator.vector");
}
spec.jvmArgs("-Xmx1g");
Expand Down

0 comments on commit f81019e

Please sign in to comment.