From 3aa33a99c7ccf0080555f6e29351e8bee79d41be Mon Sep 17 00:00:00 2001 From: Tony Robalik Date: Tue, 12 Dec 2023 12:40:02 -0800 Subject: [PATCH] Enable configuration cache in functional tests. (#1063) Co-authored-by: Jendrik Johannes --- .../groovy/com/autonomousapps/AbstractFunctionalSpec.groovy | 5 +++++ .../groovy/com/autonomousapps/AbstractProject.groovy | 2 +- .../groovy/com/autonomousapps/jvm/ClassifiersSpec.groovy | 2 +- .../groovy/com/autonomousapps/jvm/CustomSourceSetSpec.groovy | 4 ++-- .../kotlin/com/autonomousapps/internal/GradleVersions.kt | 1 - 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/functionalTest/groovy/com/autonomousapps/AbstractFunctionalSpec.groovy b/src/functionalTest/groovy/com/autonomousapps/AbstractFunctionalSpec.groovy index 2545e934a..aa9551fa8 100644 --- a/src/functionalTest/groovy/com/autonomousapps/AbstractFunctionalSpec.groovy +++ b/src/functionalTest/groovy/com/autonomousapps/AbstractFunctionalSpec.groovy @@ -83,6 +83,11 @@ abstract class AbstractFunctionalSpec extends Specification { } } + // TODO only needed due to some CC issues in 7.4, remove an replace with above, once 7.5 becomes the minimum. + protected static List gradleVersionsCC() { + return gradleVersions().collect { it == GradleVersions.minGradleVersion ? GRADLE_7_5 : it } + } + /** * For example, given: * 1. [GradleVersion(5.6.4), GradleVersion(6.0.1), GradleVersion(6.1.1)] (size=3) diff --git a/src/functionalTest/groovy/com/autonomousapps/AbstractProject.groovy b/src/functionalTest/groovy/com/autonomousapps/AbstractProject.groovy index ab9537ef1..9a3b1055a 100644 --- a/src/functionalTest/groovy/com/autonomousapps/AbstractProject.groovy +++ b/src/functionalTest/groovy/com/autonomousapps/AbstractProject.groovy @@ -15,7 +15,7 @@ abstract class AbstractProject extends AbstractGradleProject { protected GradleProject.Builder newGradleProjectBuilder() { return super.newGradleProjectBuilder() .withRootProject { r -> - r.gradleProperties += PRINT_ADVICE + r.gradleProperties += GradleProperties.enableConfigurationCache() + PRINT_ADVICE r.withBuildScript { bs -> bs.plugins(Plugins.dependencyAnalysis, Plugins.kotlinNoApply) } diff --git a/src/functionalTest/groovy/com/autonomousapps/jvm/ClassifiersSpec.groovy b/src/functionalTest/groovy/com/autonomousapps/jvm/ClassifiersSpec.groovy index a1d05803d..6485e65c6 100644 --- a/src/functionalTest/groovy/com/autonomousapps/jvm/ClassifiersSpec.groovy +++ b/src/functionalTest/groovy/com/autonomousapps/jvm/ClassifiersSpec.groovy @@ -37,6 +37,6 @@ final class ClassifiersSpec extends AbstractJvmSpec { where: [gradleVersion, variant] << multivariableDataPipe( - gradleVersions(), TransitiveClassifierTestProject.TestProjectVariant.values().toList()) + gradleVersionsCC(), TransitiveClassifierTestProject.TestProjectVariant.values().toList()) } } diff --git a/src/functionalTest/groovy/com/autonomousapps/jvm/CustomSourceSetSpec.groovy b/src/functionalTest/groovy/com/autonomousapps/jvm/CustomSourceSetSpec.groovy index bfa21632f..42c399ff9 100644 --- a/src/functionalTest/groovy/com/autonomousapps/jvm/CustomSourceSetSpec.groovy +++ b/src/functionalTest/groovy/com/autonomousapps/jvm/CustomSourceSetSpec.groovy @@ -54,7 +54,7 @@ final class CustomSourceSetSpec extends AbstractJvmSpec { where: [gradleVersion, producerCodeInFeature, additionalCapabilities] << multivariableDataPipe( - gradleVersions(), [true, false], [true, false]) + gradleVersionsCC(), [true, false], [true, false]) } def "dependencies to test fixtures (#gradleVersion)"() { @@ -129,7 +129,7 @@ final class CustomSourceSetSpec extends AbstractJvmSpec { assertThat(project.actualBuildHealth()).containsExactlyElementsIn(project.expectedBuildHealth()) where: - gradleVersion << gradleVersions() + gradleVersion << gradleVersionsCC() } def "custom source set analysis can be fine-filtered for severity=#severity (#gradleVersion)"() { diff --git a/src/main/kotlin/com/autonomousapps/internal/GradleVersions.kt b/src/main/kotlin/com/autonomousapps/internal/GradleVersions.kt index 2a876e142..c82f61c88 100644 --- a/src/main/kotlin/com/autonomousapps/internal/GradleVersions.kt +++ b/src/main/kotlin/com/autonomousapps/internal/GradleVersions.kt @@ -16,7 +16,6 @@ internal object GradleVersions { val current: GradleVersion = GradleVersion.current() val isAtLeastMinimum: Boolean = current >= minGradleVersion - val isAtLeastGradle74: Boolean = current >= gradle74 val isAtLeastGradle75: Boolean = current >= gradle75 val isAtLeastGradle82: Boolean = current >= gradle82 val isAtLeastGradle84: Boolean = current >= gradle84