Skip to content

Commit 1431c2b

Browse files
authored
Run build-tools test with Gradle jdk (#49459) (#49497)
The test task is configured to use the runtime java version, but there are issues with the version of groovy used by gradle pre 6.0. In order to workaround this, we use the Gradle JDK to execute the build-tools tests. Closes #49404 Closes #49253
1 parent 0c44919 commit 1431c2b

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

buildSrc/build.gradle

+7-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* under the License.
1818
*/
1919

20+
import org.gradle.internal.jvm.Jvm
2021
import org.gradle.util.GradleVersion
2122

2223
plugins {
@@ -225,8 +226,13 @@ if (project != rootProject) {
225226
}
226227
check.dependsOn(integTest)
227228

229+
// for now we hardcode the tests for our build to use the gradle jvm.
230+
tasks.withType(Test).configureEach {
231+
it.executable = Jvm.current().getJavaExecutable()
232+
}
233+
228234
/*
229-
* We alread configure publication and we don't need or want this one that
235+
* We already configure publication and we don't need or want this one that
230236
* comes from the java-gradle-plugin.
231237
*/
232238
afterEvaluate {

gradle/runtime-jdk-provision.gradle

+7-10
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,13 @@ jdks {
1212
}
1313
}
1414

15-
allprojects {
16-
if (project.path != ":build-tools") {
17-
// Build tools doesn't support java 8 still used in CI
18-
project.tasks.withType(Test).configureEach { Test test ->
19-
if (BuildParams.getIsRuntimeJavaHomeSet()) {
20-
test.executable = "${BuildParams.runtimeJavaHome}/bin/java"
21-
} else {
22-
test.dependsOn(rootProject.jdks.provisioned_runtime)
23-
test.executable = rootProject.jdks.provisioned_runtime.getBinJavaPath()
24-
}
15+
configure(allprojects - project(':build-tools')) {
16+
project.tasks.withType(Test).configureEach { Test test ->
17+
if (BuildParams.getIsRuntimeJavaHomeSet()) {
18+
test.executable = "${BuildParams.runtimeJavaHome}/bin/java"
19+
} else {
20+
test.dependsOn(rootProject.jdks.provisioned_runtime)
21+
test.executable = rootProject.jdks.provisioned_runtime.getBinJavaPath()
2522
}
2623
}
2724
}

0 commit comments

Comments
 (0)