From 6ff69c576fc466e1e1eb1d0193a08ad021f4c939 Mon Sep 17 00:00:00 2001 From: Thomas Tresansky Date: Fri, 16 Sep 2022 15:30:14 -0400 Subject: [PATCH] Don't add repository to buildscript for base class tests - The base class tests depend upon CC's eager resolution failing due to a lack of repositories definied. So if we define them in the setup method, those builds succeed, when expected to fail, thus failing tests. - Need to specific repo in every new test then. --- .../CheckstylePluginIntegrationTest.groovy | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/subprojects/code-quality/src/integTest/groovy/org/gradle/api/plugins/quality/checkstyle/CheckstylePluginIntegrationTest.groovy b/subprojects/code-quality/src/integTest/groovy/org/gradle/api/plugins/quality/checkstyle/CheckstylePluginIntegrationTest.groovy index cef3c2a6afee..a1d2706bd44b 100644 --- a/subprojects/code-quality/src/integTest/groovy/org/gradle/api/plugins/quality/checkstyle/CheckstylePluginIntegrationTest.groovy +++ b/subprojects/code-quality/src/integTest/groovy/org/gradle/api/plugins/quality/checkstyle/CheckstylePluginIntegrationTest.groovy @@ -30,20 +30,26 @@ class CheckstylePluginIntegrationTest extends WellBehavedPluginTest { return "check" } + /** + * To ensure the plugins fails (as expected) with configuration cache, do NOT add a repository to the build here, + * the tests in the base class are relying on a failure during eager dependency resolution with CC. + */ def setup() { buildFile << """ apply plugin: 'groovy' - - ${mavenCentralRepository()} """ } + @Issue("https://github.com/gradle/gradle/issues/21301") def "can pass a URL in configProperties"() { given: buildFile """ apply plugin: 'checkstyle' + dependencies { implementation localGroovy() } + ${mavenCentralRepository()} + dependencies { implementation localGroovy() } checkstyle { @@ -69,6 +75,8 @@ class CheckstylePluginIntegrationTest extends WellBehavedPluginTest { buildFile """ apply plugin: 'checkstyle' + ${mavenCentralRepository()} + checkstyle { enableExternalDtdLoad = true } @@ -95,6 +103,8 @@ class CheckstylePluginIntegrationTest extends WellBehavedPluginTest { buildFile """ apply plugin: 'checkstyle' + ${mavenCentralRepository()} + tasks.withType(Checkstyle).configureEach { enableExternalDtdLoad = true } @@ -121,6 +131,8 @@ class CheckstylePluginIntegrationTest extends WellBehavedPluginTest { buildFile """ apply plugin: 'checkstyle' + ${mavenCentralRepository()} + checkstyle { enableExternalDtdLoad = false } @@ -151,6 +163,8 @@ class CheckstylePluginIntegrationTest extends WellBehavedPluginTest { buildFile """ apply plugin: 'checkstyle' + ${mavenCentralRepository()} + checkstyle { enableExternalDtdLoad = false } @@ -172,6 +186,8 @@ class CheckstylePluginIntegrationTest extends WellBehavedPluginTest { def "enable_external_dtd_load feature NOT enabled by default"() { given:buildFile """ apply plugin: 'checkstyle' + + ${mavenCentralRepository()} """ file('src/main/java/org/sample/MyClass.java') << multilineJavaClass()