Skip to content

Commit e9941c2

Browse files
authored
Run build-tools test with Gradle jdk (#49459)
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 796cd00 commit e9941c2

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
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 {
@@ -226,8 +227,13 @@ if (project != rootProject) {
226227
}
227228
check.dependsOn(integTest)
228229

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

gradle/runtime-jdk-provision.gradle

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

15-
allprojects {
15+
configure(allprojects - project(':build-tools')) {
1616
project.tasks.withType(Test).configureEach { Test test ->
1717
if (BuildParams.getIsRuntimeJavaHomeSet()) {
1818
test.executable = "${BuildParams.runtimeJavaHome}/bin/java"
@@ -21,4 +21,4 @@ allprojects {
2121
test.executable = rootProject.jdks.provisioned_runtime.getBinJavaPath()
2222
}
2323
}
24-
}
24+
}

0 commit comments

Comments
 (0)