diff --git a/src/main/groovy/com/netflix/nebula/lint/plugin/GradleLintPluginTaskConfigurer.groovy b/src/main/groovy/com/netflix/nebula/lint/plugin/GradleLintPluginTaskConfigurer.groovy index 1f2d2bca..09343d1f 100644 --- a/src/main/groovy/com/netflix/nebula/lint/plugin/GradleLintPluginTaskConfigurer.groovy +++ b/src/main/groovy/com/netflix/nebula/lint/plugin/GradleLintPluginTaskConfigurer.groovy @@ -20,6 +20,7 @@ abstract class GradleLintPluginTaskConfigurer extends AbstractLintPluginTaskConf group = LINT_GROUP listeners.set(lintExt.listeners) projectRootDir.set(project.rootDir) + notCompatibleWithConfigurationCache("Gradle Lint Plugin is not compatible with configuration cache because ir requires project model") } def manualLintTask = project.tasks.register(LINT_GRADLE, LintGradleTask) @@ -27,6 +28,7 @@ abstract class GradleLintPluginTaskConfigurer extends AbstractLintPluginTaskConf group = LINT_GROUP failOnWarning.set(true) projectRootDir.set(project.rootDir) + notCompatibleWithConfigurationCache("Gradle Lint Plugin is not compatible with configuration cache because ir requires project model") } @@ -35,17 +37,20 @@ abstract class GradleLintPluginTaskConfigurer extends AbstractLintPluginTaskConf group = LINT_GROUP onlyCriticalRules.set(true) projectRootDir.set(project.rootDir) + notCompatibleWithConfigurationCache("Gradle Lint Plugin is not compatible with configuration cache because ir requires project model") } def fixTask = project.tasks.register(FIX_GRADLE_LINT, FixGradleLintTask) fixTask.configure { userDefinedListeners.set(lintExt.listeners) + notCompatibleWithConfigurationCache("Gradle Lint Plugin is not compatible with configuration cache because ir requires project model") } def fixTask2 = project.tasks.register(FIX_LINT_GRADLE, FixGradleLintTask) fixTask2.configure { userDefinedListeners.set(lintExt.listeners) + notCompatibleWithConfigurationCache("Gradle Lint Plugin is not compatible with configuration cache because ir requires project model") } List lintTasks = [fixTask, fixTask2, manualLintTask] diff --git a/src/main/groovy/com/netflix/nebula/lint/plugin/GradleSevenOneAndHigherLintPluginTaskConfigurer.groovy b/src/main/groovy/com/netflix/nebula/lint/plugin/GradleSevenOneAndHigherLintPluginTaskConfigurer.groovy index defc91df..c268b6c2 100644 --- a/src/main/groovy/com/netflix/nebula/lint/plugin/GradleSevenOneAndHigherLintPluginTaskConfigurer.groovy +++ b/src/main/groovy/com/netflix/nebula/lint/plugin/GradleSevenOneAndHigherLintPluginTaskConfigurer.groovy @@ -10,6 +10,8 @@ class GradleSevenOneAndHigherLintPluginTaskConfigurer extends GradleSevenZeroLin @Override void execute(GradleLintReportTask gradleLintReportTask) { gradleLintReportTask.reportOnlyFixableViolations = getReportOnlyFixableViolations(project, extension) + gradleLintReportTask.notCompatibleWithConfigurationCache("Gradle Lint Plugin is not compatible with configuration cache because ir requires project model") + gradleLintReportTask.reports.all { report -> def fileSuffix = report.name == 'text' ? 'txt' : report.name report.conventionMapping.with { diff --git a/src/test/groovy/com/netflix/nebula/lint/BaseIntegrationTestKitSpec.groovy b/src/test/groovy/com/netflix/nebula/lint/BaseIntegrationTestKitSpec.groovy index 3627ab14..5913a897 100644 --- a/src/test/groovy/com/netflix/nebula/lint/BaseIntegrationTestKitSpec.groovy +++ b/src/test/groovy/com/netflix/nebula/lint/BaseIntegrationTestKitSpec.groovy @@ -5,7 +5,7 @@ import nebula.test.IntegrationTestKitSpec abstract class BaseIntegrationTestKitSpec extends IntegrationTestKitSpec { def setup() { // Enable configuration cache :) - //new File(projectDir, 'gradle.properties') << '''org.gradle.configuration-cache=true'''.stripIndent() + new File(projectDir, 'gradle.properties') << '''org.gradle.configuration-cache=true'''.stripIndent() } diff --git a/src/test/groovy/com/netflix/nebula/lint/plugin/GradleLintPluginSpec.groovy b/src/test/groovy/com/netflix/nebula/lint/plugin/GradleLintPluginSpec.groovy index ba0478c8..418e2966 100644 --- a/src/test/groovy/com/netflix/nebula/lint/plugin/GradleLintPluginSpec.groovy +++ b/src/test/groovy/com/netflix/nebula/lint/plugin/GradleLintPluginSpec.groovy @@ -22,9 +22,6 @@ import spock.lang.Issue import spock.lang.Unroll class GradleLintPluginSpec extends BaseIntegrationTestKitSpec { - def setup() { - debug = true - } def 'run multiple rules on a single module project'() { when: @@ -33,7 +30,9 @@ class GradleLintPluginSpec extends BaseIntegrationTestKitSpec { id 'nebula.lint' id 'java' } - + repositories { + mavenCentral() + } gradleLint.rules = ['dependency-parentheses', 'dependency-tuple'] dependencies { @@ -64,6 +63,9 @@ class GradleLintPluginSpec extends BaseIntegrationTestKitSpec { id 'java' } + repositories { + mavenCentral() + } gradleLint.rules = ['dependency-parentheses', 'dependency-tuple'] dependencies { @@ -129,6 +131,9 @@ class GradleLintPluginSpec extends BaseIntegrationTestKitSpec { subprojects { apply plugin: 'java' apply plugin: 'nebula.lint' + repositories { + mavenCentral() + } } gradleLint.rules = ['dependency-parentheses', 'dependency-tuple'] @@ -136,7 +141,7 @@ class GradleLintPluginSpec extends BaseIntegrationTestKitSpec { addSubproject('sub', """ dependencies { - implementation('a:a:1') + implementation('com.google.guava:guava:19.0') } """) @@ -286,6 +291,9 @@ class GradleLintPluginSpec extends BaseIntegrationTestKitSpec { subprojects { apply plugin: 'java' + repositories { + mavenCentral() + } dependencies { implementation('com.google.guava:guava:18.0') } @@ -373,6 +381,10 @@ class GradleLintPluginSpec extends BaseIntegrationTestKitSpec { gradleLint.rules = ['dependency-parentheses', 'dependency-tuple'] + repositories { + mavenCentral() + } + dependencies { implementation('com.google.guava:guava:18.0') } @@ -389,6 +401,10 @@ class GradleLintPluginSpec extends BaseIntegrationTestKitSpec { gradleLint.rules = ['dependency-parentheses', 'dependency-tuple'] + repositories { + mavenCentral() + } + dependencies { implementation 'com.google.guava:guava:18.0' } @@ -413,6 +429,9 @@ class GradleLintPluginSpec extends BaseIntegrationTestKitSpec { subprojects { apply plugin: 'java' + repositories { + mavenCentral() + } dependencies { implementation('com.google.guava:guava:18.0') } @@ -454,9 +473,11 @@ class GradleLintPluginSpec extends BaseIntegrationTestKitSpec { addSubproject('sub', """ apply plugin: 'java' apply plugin: 'nebula.lint' - + repositories { + mavenCentral() + } dependencies { - implementation('a:a:1') + implementation('com.google.guava:guava:19.0') } """) @@ -573,6 +594,9 @@ class GradleLintPluginSpec extends BaseIntegrationTestKitSpec { id 'java' } gradleLint.rules = ['dependency-parentheses'] + repositories { + mavenCentral() + } dependencies { implementation('commons-logging:commons-logging:latest.release') } @@ -599,6 +623,9 @@ class GradleLintPluginSpec extends BaseIntegrationTestKitSpec { rules = ['dependency-parentheses'] alwaysRun = false } + repositories { + mavenCentral() + } dependencies { implementation('commons-logging:commons-logging:latest.release') } @@ -674,6 +701,9 @@ class GradleLintPluginSpec extends BaseIntegrationTestKitSpec { id 'java' } gradleLint.rules = ['dependency-parentheses'] + repositories { + mavenCentral() + } dependencies { implementation('commons-logging:commons-logging:latest.release') } @@ -698,6 +728,9 @@ class GradleLintPluginSpec extends BaseIntegrationTestKitSpec { id 'java' } gradleLint.rules = ['dependency-parentheses'] + repositories { + mavenCentral() + } dependencies { implementation('commons-logging:commons-logging:latest.release') } @@ -717,12 +750,16 @@ class GradleLintPluginSpec extends BaseIntegrationTestKitSpec { @Unroll def 'lint task does not run for task #taskName'() { when: + disableConfigurationCache() // component and model report are not config cache compatible anyway buildFile << """ plugins { id 'nebula.lint' id 'java' } gradleLint.rules = ['dependency-parentheses'] + repositories { + mavenCentral() + } dependencies { implementation('commons-logging:commons-logging:latest.release') } @@ -754,6 +791,9 @@ class GradleLintPluginSpec extends BaseIntegrationTestKitSpec { id 'java' } gradleLint.rules = ['dependency-parentheses'] + repositories { + mavenCentral() + } dependencies { implementation('commons-logging:commons-logging:latest.release') } diff --git a/src/test/groovy/com/netflix/nebula/lint/rule/dependency/DependencyServiceSpec.groovy b/src/test/groovy/com/netflix/nebula/lint/rule/dependency/DependencyServiceSpec.groovy index 1775b47e..b0a038e1 100644 --- a/src/test/groovy/com/netflix/nebula/lint/rule/dependency/DependencyServiceSpec.groovy +++ b/src/test/groovy/com/netflix/nebula/lint/rule/dependency/DependencyServiceSpec.groovy @@ -22,6 +22,7 @@ class DependencyServiceSpec extends BaseIntegrationTestKitSpec { apply plugin: 'java' repositories { mavenCentral() } } + disableConfigurationCache() } def 'check if configuration is resolved'() { diff --git a/src/test/groovy/com/netflix/nebula/lint/rule/dependency/FindMethodReferencesSpec.groovy b/src/test/groovy/com/netflix/nebula/lint/rule/dependency/FindMethodReferencesSpec.groovy index f1ffe437..57eab89b 100644 --- a/src/test/groovy/com/netflix/nebula/lint/rule/dependency/FindMethodReferencesSpec.groovy +++ b/src/test/groovy/com/netflix/nebula/lint/rule/dependency/FindMethodReferencesSpec.groovy @@ -6,6 +6,10 @@ import spock.lang.Subject @Subject(DependencyService) class FindMethodReferencesSpec extends BaseIntegrationTestKitSpec { + def setup(){ + disableConfigurationCache() + } + def 'find method references no exclusion'() { buildFile.text = """\ import com.netflix.nebula.lint.rule.dependency.*