From 6095a76664413da4c8c134ee32e8a8ae900f0f1f Mon Sep 17 00:00:00 2001 From: Daz DeBoer Date: Sat, 18 Feb 2023 13:25:58 -0700 Subject: [PATCH] Update tests for Gradle 8 --- .../build-result-capture.init.gradle | 3 +- .../BaseInitScriptTest.groovy | 34 ++++++++----------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/resources/init-scripts/build-result-capture.init.gradle b/src/resources/init-scripts/build-result-capture.init.gradle index c8eb8db..d44d2e8 100644 --- a/src/resources/init-scripts/build-result-capture.init.gradle +++ b/src/resources/init-scripts/build-result-capture.init.gradle @@ -21,6 +21,7 @@ if (isTopLevelBuild) { captureUsingBuildScanPublished(settings.extensions["gradleEnterprise"].buildScan, settings.rootProject, invocationId) } // We also need to add hooks in case the plugin is applied but no build scan is published + // The `buildScanPublished` results will NOT be overwritten by these calls if (useBuildService) { captureUsingBuildService(settings, invocationId) } else { @@ -71,9 +72,7 @@ def captureUsingBuildFinished(gradle, invocationId) { gradle.buildFinished { result -> def buildResults = new BuildResults(invocationId, gradle, gradle.rootProject) buildResults.setBuildResult(result) - buildResults.writeToResultsFile(false) - } } diff --git a/test/init-scripts/src/test/groovy/com/gradle/gradlebuildaction/BaseInitScriptTest.groovy b/test/init-scripts/src/test/groovy/com/gradle/gradlebuildaction/BaseInitScriptTest.groovy index 567fddf..08779e1 100644 --- a/test/init-scripts/src/test/groovy/com/gradle/gradlebuildaction/BaseInitScriptTest.groovy +++ b/test/init-scripts/src/test/groovy/com/gradle/gradlebuildaction/BaseInitScriptTest.groovy @@ -17,30 +17,26 @@ import java.util.zip.GZIPOutputStream class BaseInitScriptTest extends Specification { - static final TestGradleVersion GRADLE_3_5 = new TestGradleVersion(GradleVersion.version('3.5.1'), 7, 9) - static final TestGradleVersion GRADLE_4_0 = new TestGradleVersion(GradleVersion.version('4.0.2'), 7, 9) - static final TestGradleVersion GRADLE_4_10 = new TestGradleVersion(GradleVersion.version('4.10.3'), 7, 10) - static final TestGradleVersion GRADLE_5_0 = new TestGradleVersion(GradleVersion.version('5.0'), 8, 11) - static final TestGradleVersion GRADLE_5_6 = new TestGradleVersion(GradleVersion.version('5.6.4'), 8, 12) - static final TestGradleVersion GRADLE_6_0 = new TestGradleVersion(GradleVersion.version('6.0.1'), 8, 13) - static final TestGradleVersion GRADLE_6_7 = new TestGradleVersion(GradleVersion.version('6.7'), 8, 15) - static final TestGradleVersion GRADLE_7_0 = new TestGradleVersion(GradleVersion.version('7.0.2'), 8, 16) - static final TestGradleVersion GRADLE_7_4 = new TestGradleVersion(GradleVersion.version('7.4.2'), 8, 17) + static final TestGradleVersion GRADLE_3_X = new TestGradleVersion(GradleVersion.version('3.5.1'), 7, 9) + static final TestGradleVersion GRADLE_4_X = new TestGradleVersion(GradleVersion.version('4.10.3'), 7, 10) + static final TestGradleVersion GRADLE_5_X = new TestGradleVersion(GradleVersion.version('5.6.4'), 8, 12) + static final TestGradleVersion GRADLE_6_NO_BUILD_SERVICE = new TestGradleVersion(GradleVersion.version('6.5.1'), 8, 14) + static final TestGradleVersion GRADLE_6_X = new TestGradleVersion(GradleVersion.version('6.9.3'), 8, 15) + static final TestGradleVersion GRADLE_7_X = new TestGradleVersion(GradleVersion.version('7.6'), 8, 19) + static final TestGradleVersion GRADLE_8_X = new TestGradleVersion(GradleVersion.version('8.0.1'), 8, 19) static final List ALL_VERSIONS = [ - GRADLE_3_5, // First version where TestKit supports environment variables - GRADLE_4_0, - GRADLE_4_10, - GRADLE_5_0, - GRADLE_5_6, - GRADLE_6_0, - GRADLE_6_7, - GRADLE_7_0, - GRADLE_7_4, + GRADLE_3_X, // First version where TestKit supports environment variables + GRADLE_4_X, + GRADLE_5_X, + GRADLE_6_NO_BUILD_SERVICE, // Last version without build service support + GRADLE_6_X, + GRADLE_7_X, + GRADLE_8_X, ] static final List CONFIGURATION_CACHE_VERSIONS = - [GRADLE_7_0, GRADLE_7_4] + [GRADLE_7_X, GRADLE_8_X] static final String PUBLIC_BUILD_SCAN_ID = 'i2wepy2gr7ovw' static final String DEFAULT_SCAN_UPLOAD_TOKEN = 'scan-upload-token'