Skip to content

Commit

Permalink
Run build-tools test with Gradle jdk (#49459) (#49497)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jaymode authored Nov 22, 2019
1 parent 0c44919 commit 1431c2b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
8 changes: 7 additions & 1 deletion buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* under the License.
*/

import org.gradle.internal.jvm.Jvm
import org.gradle.util.GradleVersion

plugins {
Expand Down Expand Up @@ -225,8 +226,13 @@ if (project != rootProject) {
}
check.dependsOn(integTest)

// for now we hardcode the tests for our build to use the gradle jvm.
tasks.withType(Test).configureEach {
it.executable = Jvm.current().getJavaExecutable()
}

/*
* We alread configure publication and we don't need or want this one that
* We already configure publication and we don't need or want this one that
* comes from the java-gradle-plugin.
*/
afterEvaluate {
Expand Down
17 changes: 7 additions & 10 deletions gradle/runtime-jdk-provision.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@ jdks {
}
}

allprojects {
if (project.path != ":build-tools") {
// Build tools doesn't support java 8 still used in CI
project.tasks.withType(Test).configureEach { Test test ->
if (BuildParams.getIsRuntimeJavaHomeSet()) {
test.executable = "${BuildParams.runtimeJavaHome}/bin/java"
} else {
test.dependsOn(rootProject.jdks.provisioned_runtime)
test.executable = rootProject.jdks.provisioned_runtime.getBinJavaPath()
}
configure(allprojects - project(':build-tools')) {
project.tasks.withType(Test).configureEach { Test test ->
if (BuildParams.getIsRuntimeJavaHomeSet()) {
test.executable = "${BuildParams.runtimeJavaHome}/bin/java"
} else {
test.dependsOn(rootProject.jdks.provisioned_runtime)
test.executable = rootProject.jdks.provisioned_runtime.getBinJavaPath()
}
}
}

0 comments on commit 1431c2b

Please sign in to comment.