|
@@ -18,19 +18,15 @@ import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
|
|
|
// gradle has an open issue of failing applying plugins in
|
|
|
// precompiled script plugins (see https://github.com/gradle/gradle/issues/17004)
|
|
|
|
|
|
-
|
|
|
configure(allprojects) {
|
|
|
- apply plugin: 'elasticsearch.jdk-download'
|
|
|
-
|
|
|
- jdks {
|
|
|
- provisioned_runtime {
|
|
|
- vendor = VersionProperties.bundledJdkVendor
|
|
|
- version = VersionProperties.bundledJdkVersion
|
|
|
- platform = OS.current().name().toLowerCase()
|
|
|
- architecture = Architecture.current().name().toLowerCase()
|
|
|
- }
|
|
|
+ def launcher = javaToolchains.launcherFor {
|
|
|
+ languageVersion = JavaLanguageVersion.of(VersionProperties.bundledJdkMajorVersion)
|
|
|
+ vendor = VersionProperties.bundledJdkVendor == "openjdk" ?
|
|
|
+ JvmVendorSpec.ORACLE :
|
|
|
+ JvmVendorSpec.matching(VersionProperties.bundledJdkVendor)
|
|
|
}
|
|
|
- project.tasks.withType(Test).configureEach { Test test ->
|
|
|
+
|
|
|
+ project.tasks.withType(Test).configureEach { Test test ->
|
|
|
if (BuildParams.getIsRuntimeJavaHomeSet()) {
|
|
|
test.executable = "${BuildParams.runtimeJavaHome}/bin/java" +
|
|
|
(OS.current() == OS.WINDOWS ? '.exe' : '')
|
|
@@ -47,7 +43,7 @@ configure(allprojects) {
|
|
|
project.plugins.withId("elasticsearch.internal-testclusters") { internalPlugin ->
|
|
|
if (BuildParams.getIsRuntimeJavaHomeSet() == false) {
|
|
|
// If no runtime java home is set, use the bundled JDK for test clusters
|
|
|
- testClustersPlugin.setRuntimeJava(providers.provider(() -> file("${project.jdks.provisioned_runtime.javaHomePath}")))
|
|
|
+ testClustersPlugin.setRuntimeJava(launcher.map { it.metadata.installationPath.asFile })
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -55,8 +51,7 @@ configure(allprojects) {
|
|
|
project.plugins.withType(RestTestBasePlugin) {
|
|
|
tasks.withType(StandaloneRestIntegTestTask).configureEach {
|
|
|
if (BuildParams.getIsRuntimeJavaHomeSet() == false) {
|
|
|
- dependsOn(project.jdks.provisioned_runtime)
|
|
|
- nonInputProperties.systemProperty("tests.runtime.java", "${-> project.jdks.provisioned_runtime.javaHomePath}")
|
|
|
+ nonInputProperties.systemProperty("tests.runtime.java", "${-> launcher.map { it.metadata.installationPath.asFile.path }.get()}")
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -64,8 +59,8 @@ configure(allprojects) {
|
|
|
project.plugins.withType(ThirdPartyAuditPrecommitPlugin) {
|
|
|
project.getTasks().withType(ThirdPartyAuditTask.class).configureEach {
|
|
|
if (BuildParams.getIsRuntimeJavaHomeSet() == false) {
|
|
|
- javaHome.set(providers.provider(() -> "${project.jdks.provisioned_runtime.javaHomePath}"))
|
|
|
- targetCompatibility.set(providers.provider(() -> JavaVersion.toVersion(project.jdks.provisioned_runtime.major)))
|
|
|
+ javaHome.set(launcher.map { it.metadata.installationPath.asFile.path })
|
|
|
+ targetCompatibility.set(providers.provider(() -> JavaVersion.toVersion(launcher.map { it.metadata.javaRuntimeVersion }.get())))
|
|
|
}
|
|
|
}
|
|
|
}
|