From 2792526b76db2a6852581aa827e5ac7e846ec8b4 Mon Sep 17 00:00:00 2001 From: Roberto Perez Alcolea Date: Fri, 10 Nov 2023 11:45:11 -0800 Subject: [PATCH] Gradle 8.5-rc-1 --- gradle/wrapper/gradle-wrapper.properties | 2 +- .../AbstractAlignAndMigrateSpec.groovy | 2 - .../AbstractAlignRulesSpec.groovy | 3 +- .../AbstractIntegrationTestKitSpec.groovy | 9 ++ ...stractRulesWithSpringBootPluginSpec.groovy | 5 +- ...owngradedTransitiveDependenciesSpec.groovy | 6 +- .../AlignAndSubstituteRulesSpec.groovy | 5 +- ...tuteRulesWithSpringBoot1xPluginSpec.groovy | 2 - ...pringBoot2xPluginAndManagedDepsSpec.groovy | 2 - ...gBoot2xPluginWithoutManagedDepsSpec.groovy | 2 - .../AlignRulesBasicWithCoreSpec.groovy | 4 +- .../AlignRulesForceSpec.groovy | 1 - ...esForceStrictlyWithSubstitutionSpec.groovy | 1 - .../AlignRulesMultiprojectSpec.groovy | 8 +- .../AlignRulesPluginInteractionSpec.groovy | 12 +- ...lignRulesTransitiveDependenciesSpec.groovy | 2 - .../AlignRulesVersionSuffixesSpec.groovy | 3 - .../IgnoredConfigurationsWithRulesSpec.groovy | 4 +- .../ResolutionRulesPluginSpec.groovy | 107 +++++++++--------- .../SubstituteRulesSpec.groovy | 35 +++--- .../SubstituteRulesWithRangesSpec.groovy | 5 +- 21 files changed, 98 insertions(+), 122 deletions(-) create mode 100644 src/integTest/groovy/nebula/plugin/resolutionrules/AbstractIntegrationTestKitSpec.groovy diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 3fa8f86..f6c2a4a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-rc-1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/integTest/groovy/nebula/plugin/resolutionrules/AbstractAlignAndMigrateSpec.groovy b/src/integTest/groovy/nebula/plugin/resolutionrules/AbstractAlignAndMigrateSpec.groovy index a5606ec..9867855 100644 --- a/src/integTest/groovy/nebula/plugin/resolutionrules/AbstractAlignAndMigrateSpec.groovy +++ b/src/integTest/groovy/nebula/plugin/resolutionrules/AbstractAlignAndMigrateSpec.groovy @@ -27,8 +27,6 @@ class AbstractAlignAndMigrateSpec extends AbstractAlignRulesSpec { implementation 'other:e:4.0.0' } """.stripIndent() - - debug = true } private void createTestDependencies() { diff --git a/src/integTest/groovy/nebula/plugin/resolutionrules/AbstractAlignRulesSpec.groovy b/src/integTest/groovy/nebula/plugin/resolutionrules/AbstractAlignRulesSpec.groovy index da6dc1e..c7fe83f 100644 --- a/src/integTest/groovy/nebula/plugin/resolutionrules/AbstractAlignRulesSpec.groovy +++ b/src/integTest/groovy/nebula/plugin/resolutionrules/AbstractAlignRulesSpec.groovy @@ -1,8 +1,7 @@ package nebula.plugin.resolutionrules -import nebula.test.IntegrationTestKitSpec -abstract class AbstractAlignRulesSpec extends IntegrationTestKitSpec { +abstract class AbstractAlignRulesSpec extends AbstractIntegrationTestKitSpec { def rulesJsonFile def setup() { diff --git a/src/integTest/groovy/nebula/plugin/resolutionrules/AbstractIntegrationTestKitSpec.groovy b/src/integTest/groovy/nebula/plugin/resolutionrules/AbstractIntegrationTestKitSpec.groovy new file mode 100644 index 0000000..eb84633 --- /dev/null +++ b/src/integTest/groovy/nebula/plugin/resolutionrules/AbstractIntegrationTestKitSpec.groovy @@ -0,0 +1,9 @@ +package nebula.plugin.resolutionrules + +import nebula.test.IntegrationTestKitSpec + +abstract class AbstractIntegrationTestKitSpec extends IntegrationTestKitSpec { + def setup() { + + } +} diff --git a/src/integTest/groovy/nebula/plugin/resolutionrules/AbstractRulesWithSpringBootPluginSpec.groovy b/src/integTest/groovy/nebula/plugin/resolutionrules/AbstractRulesWithSpringBootPluginSpec.groovy index b417c76..b82f7c2 100644 --- a/src/integTest/groovy/nebula/plugin/resolutionrules/AbstractRulesWithSpringBootPluginSpec.groovy +++ b/src/integTest/groovy/nebula/plugin/resolutionrules/AbstractRulesWithSpringBootPluginSpec.groovy @@ -1,14 +1,11 @@ package nebula.plugin.resolutionrules -import nebula.test.IntegrationTestKitSpec -class AbstractRulesWithSpringBootPluginSpec extends IntegrationTestKitSpec { +class AbstractRulesWithSpringBootPluginSpec extends AbstractIntegrationTestKitSpec { File rulesJsonFile def setup() { rulesJsonFile = new File(projectDir, "rules.json") - - debug = true keepFiles = true } diff --git a/src/integTest/groovy/nebula/plugin/resolutionrules/AlignAndLockWithDowngradedTransitiveDependenciesSpec.groovy b/src/integTest/groovy/nebula/plugin/resolutionrules/AlignAndLockWithDowngradedTransitiveDependenciesSpec.groovy index a4a060f..3813d81 100644 --- a/src/integTest/groovy/nebula/plugin/resolutionrules/AlignAndLockWithDowngradedTransitiveDependenciesSpec.groovy +++ b/src/integTest/groovy/nebula/plugin/resolutionrules/AlignAndLockWithDowngradedTransitiveDependenciesSpec.groovy @@ -1,13 +1,12 @@ package nebula.plugin.resolutionrules -import nebula.test.IntegrationTestKitSpec import nebula.test.dependencies.DependencyGraphBuilder import nebula.test.dependencies.GradleDependencyGenerator import nebula.test.dependencies.ModuleBuilder import spock.lang.Ignore import spock.lang.Unroll -class AlignAndLockWithDowngradedTransitiveDependenciesSpec extends IntegrationTestKitSpec { +class AlignAndLockWithDowngradedTransitiveDependenciesSpec extends AbstractIntegrationTestKitSpec { def rulesJsonFile static def STATIC_MAJOR_MINOR_PATCH_2_9_9 = "2.9.9" static def STATIC_MAJOR_MINOR_PATCH_MICRO_PATCH_2_9_9_3 = "2.9.9.3" @@ -36,9 +35,10 @@ class AlignAndLockWithDowngradedTransitiveDependenciesSpec extends IntegrationTe resolutionRules files('$rulesJsonFile') } """.stripIndent() + // TODO: enable once nebula lock is ready for config cache + new File(projectDir, 'gradle.properties').text = '''org.gradle.configuration-cache=false'''.stripIndent() keepFiles = true - debug = true rulesJsonFile << jacksonAlignmentAndSubstitutionRule() } diff --git a/src/integTest/groovy/nebula/plugin/resolutionrules/AlignAndSubstituteRulesSpec.groovy b/src/integTest/groovy/nebula/plugin/resolutionrules/AlignAndSubstituteRulesSpec.groovy index 1c53e74..cf96aff 100644 --- a/src/integTest/groovy/nebula/plugin/resolutionrules/AlignAndSubstituteRulesSpec.groovy +++ b/src/integTest/groovy/nebula/plugin/resolutionrules/AlignAndSubstituteRulesSpec.groovy @@ -1,6 +1,5 @@ package nebula.plugin.resolutionrules -import nebula.test.IntegrationTestKitSpec import nebula.test.dependencies.DependencyGraphBuilder import nebula.test.dependencies.GradleDependencyGenerator import nebula.test.dependencies.ModuleBuilder @@ -10,7 +9,7 @@ import nebula.test.dependencies.repositories.MavenRepo import spock.lang.Ignore import spock.lang.Issue -class AlignAndSubstituteRulesSpec extends IntegrationTestKitSpec { +class AlignAndSubstituteRulesSpec extends AbstractIntegrationTestKitSpec { File rulesJsonFile File mavenrepo String reason = "★ custom reason" @@ -75,8 +74,6 @@ class AlignAndSubstituteRulesSpec extends IntegrationTestKitSpec { mavenrepo = new GradleDependencyGenerator(graph, "${projectDir}/testrepogen").generateTestMavenRepo() buildFile << baseBuildGradleFile() - - debug = true keepFiles = true } diff --git a/src/integTest/groovy/nebula/plugin/resolutionrules/AlignAndSubstituteRulesWithSpringBoot1xPluginSpec.groovy b/src/integTest/groovy/nebula/plugin/resolutionrules/AlignAndSubstituteRulesWithSpringBoot1xPluginSpec.groovy index e6b60b9..afba4f8 100644 --- a/src/integTest/groovy/nebula/plugin/resolutionrules/AlignAndSubstituteRulesWithSpringBoot1xPluginSpec.groovy +++ b/src/integTest/groovy/nebula/plugin/resolutionrules/AlignAndSubstituteRulesWithSpringBoot1xPluginSpec.groovy @@ -12,8 +12,6 @@ class AlignAndSubstituteRulesWithSpringBoot1xPluginSpec extends AbstractRulesWit def setup() { System.setProperty('ignoreDeprecations', 'true') rulesJsonFile = new File(projectDir, "rules.json") - - debug = true keepFiles = true } diff --git a/src/integTest/groovy/nebula/plugin/resolutionrules/AlignAndSubstituteRulesWithSpringBoot2xPluginAndManagedDepsSpec.groovy b/src/integTest/groovy/nebula/plugin/resolutionrules/AlignAndSubstituteRulesWithSpringBoot2xPluginAndManagedDepsSpec.groovy index c781cfa..01fab7a 100644 --- a/src/integTest/groovy/nebula/plugin/resolutionrules/AlignAndSubstituteRulesWithSpringBoot2xPluginAndManagedDepsSpec.groovy +++ b/src/integTest/groovy/nebula/plugin/resolutionrules/AlignAndSubstituteRulesWithSpringBoot2xPluginAndManagedDepsSpec.groovy @@ -8,8 +8,6 @@ class AlignAndSubstituteRulesWithSpringBoot2xPluginAndManagedDepsSpec extends Ab def setup() { rulesJsonFile = new File(projectDir, "rules.json") - - debug = true keepFiles = true System.setProperty('ignoreDeprecations', 'true') } diff --git a/src/integTest/groovy/nebula/plugin/resolutionrules/AlignAndSubstituteRulesWithSpringBoot2xPluginWithoutManagedDepsSpec.groovy b/src/integTest/groovy/nebula/plugin/resolutionrules/AlignAndSubstituteRulesWithSpringBoot2xPluginWithoutManagedDepsSpec.groovy index d08c3c7..1f0d1e2 100644 --- a/src/integTest/groovy/nebula/plugin/resolutionrules/AlignAndSubstituteRulesWithSpringBoot2xPluginWithoutManagedDepsSpec.groovy +++ b/src/integTest/groovy/nebula/plugin/resolutionrules/AlignAndSubstituteRulesWithSpringBoot2xPluginWithoutManagedDepsSpec.groovy @@ -8,8 +8,6 @@ class AlignAndSubstituteRulesWithSpringBoot2xPluginWithoutManagedDepsSpec extend def setup() { rulesJsonFile = new File(projectDir, "rules.json") - - debug = true keepFiles = true System.setProperty('ignoreDeprecations', 'true') } diff --git a/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesBasicWithCoreSpec.groovy b/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesBasicWithCoreSpec.groovy index 7a0353e..e6a3cd2 100644 --- a/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesBasicWithCoreSpec.groovy +++ b/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesBasicWithCoreSpec.groovy @@ -1,6 +1,5 @@ package nebula.plugin.resolutionrules -import nebula.test.IntegrationTestKitSpec import nebula.test.dependencies.DependencyGraphBuilder import nebula.test.dependencies.GradleDependencyGenerator import nebula.test.dependencies.ModuleBuilder @@ -8,11 +7,10 @@ import org.gradle.api.logging.LogLevel import org.gradle.util.GradleVersion import spock.lang.Unroll -class AlignRulesBasicWithCoreSpec extends IntegrationTestKitSpec { +class AlignRulesBasicWithCoreSpec extends AbstractIntegrationTestKitSpec { private def rulesJsonFile def setup() { - debug = true keepFiles = true if (GradleVersion.current().baseVersion < GradleVersion.version("6.0")) { settingsFile << '''\ diff --git a/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesForceSpec.groovy b/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesForceSpec.groovy index 9712e71..5fad7c3 100644 --- a/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesForceSpec.groovy +++ b/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesForceSpec.groovy @@ -7,7 +7,6 @@ import spock.lang.Unroll class AlignRulesForceSpec extends AbstractAlignRulesSpec { def setup() { keepFiles = true - debug = true } @Unroll diff --git a/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesForceStrictlyWithSubstitutionSpec.groovy b/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesForceStrictlyWithSubstitutionSpec.groovy index 5a4839e..c7b9564 100644 --- a/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesForceStrictlyWithSubstitutionSpec.groovy +++ b/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesForceStrictlyWithSubstitutionSpec.groovy @@ -23,7 +23,6 @@ import spock.lang.Unroll class AlignRulesForceStrictlyWithSubstitutionSpec extends AbstractAlignRulesSpec { def setup() { setupProjectAndDependencies() - debug = true } @Unroll diff --git a/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesMultiprojectSpec.groovy b/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesMultiprojectSpec.groovy index 285e3d0..6fd96d1 100644 --- a/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesMultiprojectSpec.groovy +++ b/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesMultiprojectSpec.groovy @@ -112,7 +112,7 @@ class AlignRulesMultiprojectSpec extends IntegrationSpec { if (parallel) { tasks += "--parallel" } - def results = runTasksSuccessfully(*tasks) + def results = runTasks(*tasks) then: results.standardOutput.contains('\\--- project :a\n') @@ -155,7 +155,7 @@ class AlignRulesMultiprojectSpec extends IntegrationSpec { if (parallel) { tasks += "--parallel" } - runTasksSuccessfully(*tasks) + runTasks(*tasks) then: noExceptionThrown() @@ -221,7 +221,7 @@ class AlignRulesMultiprojectSpec extends IntegrationSpec { if (parallel) { tasks += "--parallel" } - def result = runTasksSuccessfully(*tasks) + def result = runTasks(*tasks) then: result.standardOutput.contains '+--- other.nebula:a:1.0.0 -> 1.1.0' @@ -296,7 +296,7 @@ class AlignRulesMultiprojectSpec extends IntegrationSpec { if (parallel) { tasks += "--parallel" } - def result = runTasksSuccessfully(*tasks) + def result = runTasks(*tasks) then: result.standardOutput.contains '+--- other.nebula:a:1.0.0 -> 1.1.0' diff --git a/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesPluginInteractionSpec.groovy b/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesPluginInteractionSpec.groovy index 8973e87..a50e2eb 100644 --- a/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesPluginInteractionSpec.groovy +++ b/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesPluginInteractionSpec.groovy @@ -29,10 +29,9 @@ import java.util.jar.JarEntry import java.util.jar.JarOutputStream import java.util.jar.Manifest -class AlignRulesPluginInteractionSpec extends IntegrationTestKitSpec { +class AlignRulesPluginInteractionSpec extends AbstractIntegrationTestKitSpec { def setup() { definePluginOutsideOfPluginBlock = true - debug = true keepFiles = true } @@ -539,6 +538,7 @@ class AlignRulesPluginInteractionSpec extends IntegrationTestKitSpec { @Unroll def 'able to lock rules'() { + System.setProperty('ignoreDeprecations', 'true') def graph = new DependencyGraphBuilder() .addModule('test.nebula:a:1.41.5') .addModule('test.nebula:a:1.42.2') @@ -598,12 +598,12 @@ class AlignRulesPluginInteractionSpec extends IntegrationTestKitSpec { buildscript { repositories { mavenCentral() } dependencies { - classpath 'com.netflix.nebula:gradle-dependency-lock-plugin:11.+' + classpath 'com.netflix.nebula:gradle-dependency-lock-plugin:14.+' } } apply plugin: 'com.netflix.nebula.resolution-rules' - apply plugin: 'nebula.dependency-lock' + apply plugin: 'com.netflix.nebula.dependency-lock' apply plugin: 'java' repositories { @@ -687,11 +687,11 @@ class AlignRulesPluginInteractionSpec extends IntegrationTestKitSpec { buildscript { repositories { mavenCentral() } dependencies { - classpath 'com.netflix.nebula:gradle-dependency-lock-plugin:11.+' + classpath 'com.netflix.nebula:gradle-dependency-lock-plugin:14.+' } } apply plugin: 'com.netflix.nebula.resolution-rules' - apply plugin: 'nebula.dependency-lock' + apply plugin: 'com.netflix.nebula.dependency-lock' apply plugin: 'java' repositories { ${mavenrepo.mavenRepositoryBlock} diff --git a/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesTransitiveDependenciesSpec.groovy b/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesTransitiveDependenciesSpec.groovy index c5c3c6f..712edc3 100644 --- a/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesTransitiveDependenciesSpec.groovy +++ b/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesTransitiveDependenciesSpec.groovy @@ -371,7 +371,6 @@ class AlignRulesTransitiveDependenciesSpec extends AbstractAlignRulesSpec { @Unroll def 'alignment of group 1 upgrades and introduces a new dependencies contributing to alignment of group 2'() { given: - debug = true def graph = new DependencyGraphBuilder() .addModule(new ModuleBuilder("test.another:newlyIntroducedParentModule:1.0.0") .addDependency("test.group2:module1:3.0.0").build()) @@ -442,7 +441,6 @@ class AlignRulesTransitiveDependenciesSpec extends AbstractAlignRulesSpec { @Unroll def 'alignment of group 1 upgrades and introduces a new dependencies contributing to alignment of group 2 and substitution still takes effect'() { given: - debug = true def graph = new DependencyGraphBuilder() .addModule(new ModuleBuilder("test.another:newlyIntroducedParentModule:1.0.0") .addDependency("test.group2:module1:3.0.0").build()) diff --git a/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesVersionSuffixesSpec.groovy b/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesVersionSuffixesSpec.groovy index 8581fb4..7d7c873 100644 --- a/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesVersionSuffixesSpec.groovy +++ b/src/integTest/groovy/nebula/plugin/resolutionrules/AlignRulesVersionSuffixesSpec.groovy @@ -6,9 +6,6 @@ import nebula.test.dependencies.ModuleBuilder import spock.lang.Unroll class AlignRulesVersionSuffixesSpec extends AbstractAlignRulesSpec { - def setup() { - debug = true - } @Unroll def 'requesting a specific version with no release version available'() { diff --git a/src/integTest/groovy/nebula/plugin/resolutionrules/IgnoredConfigurationsWithRulesSpec.groovy b/src/integTest/groovy/nebula/plugin/resolutionrules/IgnoredConfigurationsWithRulesSpec.groovy index 3800eab..bf380ea 100644 --- a/src/integTest/groovy/nebula/plugin/resolutionrules/IgnoredConfigurationsWithRulesSpec.groovy +++ b/src/integTest/groovy/nebula/plugin/resolutionrules/IgnoredConfigurationsWithRulesSpec.groovy @@ -1,8 +1,7 @@ package nebula.plugin.resolutionrules -import nebula.test.IntegrationTestKitSpec -class IgnoredConfigurationsWithRulesSpec extends IntegrationTestKitSpec { +class IgnoredConfigurationsWithRulesSpec extends AbstractIntegrationTestKitSpec { File rulesJsonFile def setup() { @@ -118,6 +117,7 @@ class IgnoredConfigurationsWithRulesSpec extends IntegrationTestKitSpec { System.out.println("Hello World"); } }""".stripIndent()) + new File(projectDir, 'gradle.properties').text = '''org.gradle.configuration-cache=false'''.stripIndent() when: def result = runTasks( 'bootJar', 'assemble') diff --git a/src/integTest/groovy/nebula/plugin/resolutionrules/ResolutionRulesPluginSpec.groovy b/src/integTest/groovy/nebula/plugin/resolutionrules/ResolutionRulesPluginSpec.groovy index 45b0479..4bdaa86 100644 --- a/src/integTest/groovy/nebula/plugin/resolutionrules/ResolutionRulesPluginSpec.groovy +++ b/src/integTest/groovy/nebula/plugin/resolutionrules/ResolutionRulesPluginSpec.groovy @@ -31,11 +31,12 @@ import spock.lang.Unroll /** * Functional test for {@link ResolutionRulesPlugin}. */ -class ResolutionRulesPluginSpec extends IntegrationSpec { +class ResolutionRulesPluginSpec extends AbstractIntegrationTestKitSpec { File rulesJsonFile File optionalRulesJsonFile def setup() { + definePluginOutsideOfPluginBlock = true rulesJsonFile = new File(projectDir, "${moduleName}.json") optionalRulesJsonFile = new File(projectDir, "optional-${moduleName}.json") @@ -138,16 +139,13 @@ class ResolutionRulesPluginSpec extends IntegrationSpec { } def 'plugin applies'() { - when: - def result = runTasksSuccessfully('help') - - then: - result.standardError.isEmpty() + expect: + runTasks('help') } def 'empty configuration'() { expect: - runTasksSuccessfully() + runTasks() } def 'duplicate rules sources'() { @@ -167,10 +165,10 @@ class ResolutionRulesPluginSpec extends IntegrationSpec { when: logLevel = logLevel.DEBUG - def result = runTasksSuccessfully('dependencies') + def result = runTasks('dependencies') then: - def output = result.standardOutput + def output = result.output output.contains 'Using duplicate-rules-sources (duplicate-rules-sources.json) a dependency rules source' output.contains 'Found rules with the same name. Overriding existing ruleset duplicate-rules-sources' output.contains "Using duplicate-rules-sources ($projectDir/rules.jar) a dependency rules source" @@ -190,10 +188,10 @@ class ResolutionRulesPluginSpec extends IntegrationSpec { """.stripIndent() when: - def result = runTasksSuccessfully('dependencies', '--debug') + def result = runTasks('dependencies', '--debug') then: - def output = result.standardOutput + def output = result.output output.contains 'nebula.resolution-rules is using ruleset: rules.jar' } @@ -205,10 +203,10 @@ class ResolutionRulesPluginSpec extends IntegrationSpec { """.stripIndent() when: - def result = runTasksSuccessfully(':subprojectA:dependencies', '--configuration', 'compileClasspath', '-Dorg.gradle.configureondemand=true') + def result = runTasks(':subprojectA:dependencies', '--configuration', 'compileClasspath', '-Dorg.gradle.configureondemand=true') then: - result.standardOutput.contains("Configuration on demand is an incubating feature.") + result.output.contains("Configuration on demand is an incubating feature.") } def 'replace module'() { @@ -221,10 +219,10 @@ class ResolutionRulesPluginSpec extends IntegrationSpec { """.stripIndent() when: - def result = runTasksSuccessfully('dependencies', '--configuration', 'compileClasspath') + def result = runTasks('dependencies', '--configuration', 'compileClasspath') then: - result.standardOutput.contains('asm:asm:3.3.1 -> org.ow2.asm:asm:5.0.4') + result.output.contains('asm:asm:3.3.1 -> org.ow2.asm:asm:5.0.4') } def 'replaced module is shown by dependencyInsight'() { @@ -237,15 +235,15 @@ class ResolutionRulesPluginSpec extends IntegrationSpec { """.stripIndent() when: - def result = runTasksSuccessfully('dependencyInsight', '--dependency', 'asm') + def result = runTasks('dependencyInsight', '--dependency', 'asm') then: // reasons - result.standardOutput.contains("replaced asm:asm -> org.ow2.asm:asm because 'The asm group id changed for 4.0 and later' by rule replaced-module-is-shown-by-dependencyInsight") - result.standardOutput.contains('asm:asm:3.3.1 -> org.ow2.asm:asm:5.0.4') + result.output.contains("replaced asm:asm -> org.ow2.asm:asm because 'The asm group id changed for 4.0 and later' by rule replaced-module-is-shown-by-dependencyInsight") + result.output.contains('asm:asm:3.3.1 -> org.ow2.asm:asm:5.0.4') // final result - result.standardOutput.findAll('Task.*\n.*org.ow2.asm:asm:5.0.4').size() > 0 + result.output.findAll('Task.*\n.*org.ow2.asm:asm:5.0.4').size() > 0 } def "module is not replaced if the replacement isn't in the configuration"() { @@ -257,11 +255,11 @@ class ResolutionRulesPluginSpec extends IntegrationSpec { """.stripIndent() when: - def result = runTasksSuccessfully('dependencies', '--configuration', 'compileClasspath') + def result = runTasks('dependencies', '--configuration', 'compileClasspath') then: - result.standardOutput.contains('asm:asm:3.3.1') - !result.standardOutput.contains('asm:asm:3.3.1 -> org.ow2.asm:asm:5.0.4') + result.output.contains('asm:asm:3.3.1') + !result.output.contains('asm:asm:3.3.1 -> org.ow2.asm:asm:5.0.4') } @@ -274,20 +272,20 @@ class ResolutionRulesPluginSpec extends IntegrationSpec { """.stripIndent() when: - def result = runTasksSuccessfully('dependencies', '--configuration', 'compileClasspath') + def result = runTasks('dependencies', '--configuration', 'compileClasspath') then: - result.standardOutput.contains('No dependencies') + result.output.contains('No dependencies') } @Issue('#33') def 'excludes apply without configuration warnings'() { when: - def result = runTasksSuccessfully('dependencies') + def result = runTasks('dependencies') then: - !result.standardOutput.contains("Changed dependencies of configuration ':compileOnly' after it has been included in dependency resolution. This behaviour has been deprecated and is scheduled to be removed in Gradle 3.0. Use 'defaultDependencies' instead of 'befo reResolve' to specify default dependencies for a configuration.") - !result.standardOutput.contains("Changed dependencies of parent of configuration ':compileClasspath' after it has been resolved. This behaviour has been deprecated and is scheduled to be removed in Gradle 3.0')") + !result.output.contains("Changed dependencies of configuration ':compileOnly' after it has been included in dependency resolution. This behaviour has been deprecated and is scheduled to be removed in Gradle 3.0. Use 'defaultDependencies' instead of 'befo reResolve' to specify default dependencies for a configuration.") + !result.output.contains("Changed dependencies of parent of configuration ':compileClasspath' after it has been resolved. This behaviour has been deprecated and is scheduled to be removed in Gradle 3.0')") } @@ -301,10 +299,10 @@ class ResolutionRulesPluginSpec extends IntegrationSpec { when: - def result = runTasksSuccessfully('dependencies', '--configuration', 'compileClasspath') + def result = runTasks('dependencies', '--configuration', 'compileClasspath') then: - result.standardOutput.contains('\\--- log4j:log4j:1.2.17\n') + result.output.contains('\\--- log4j:log4j:1.2.17\n') } def 'optional rules are applied when specified'() { @@ -324,13 +322,13 @@ class ResolutionRulesPluginSpec extends IntegrationSpec { when: - def result = runTasksSuccessfully('dependencies', '--configuration', 'compileClasspath') + def result = runTasks('dependencies', '--configuration', 'compileClasspath') then: - result.standardOutput.contains '+--- log4j:log4j:1.2.17 -> org.slf4j:log4j-over-slf4j:1.7.21\n' - result.standardOutput.contains '| \\--- org.slf4j:slf4j-api:1.7.21\n' - result.standardOutput.contains '\\--- org.slf4j:jcl-over-slf4j:1.7.0 -> 1.7.21\n' - result.standardOutput.contains '\\--- org.slf4j:slf4j-api:1.7.21\n' + result.output.contains '+--- log4j:log4j:1.2.17 -> org.slf4j:log4j-over-slf4j:1.7.21\n' + result.output.contains '| \\--- org.slf4j:slf4j-api:1.7.21\n' + result.output.contains '\\--- org.slf4j:jcl-over-slf4j:1.7.0 -> 1.7.21\n' + result.output.contains '\\--- org.slf4j:slf4j-api:1.7.21\n' } def 'only included rules are applied'() { @@ -365,11 +363,11 @@ class ResolutionRulesPluginSpec extends IntegrationSpec { when: - def result = runTasksSuccessfully('dependencies', '--configuration', 'compileClasspath') + def result = runTasks('dependencies', '--configuration', 'compileClasspath') then: - result.standardOutput.contains('log4j:log4j:1.2.17 -> org.slf4j:log4j-over-slf4j:1.7.21') - !result.standardOutput.contains('asm:asm:3.3.1 -> org.ow2.asm:asm:5.0.4') + result.output.contains('log4j:log4j:1.2.17 -> org.slf4j:log4j-over-slf4j:1.7.21') + !result.output.contains('asm:asm:3.3.1 -> org.ow2.asm:asm:5.0.4') } @Unroll @@ -382,12 +380,10 @@ class ResolutionRulesPluginSpec extends IntegrationSpec { """.stripIndent() when: - def result = runTasks('dependencies', '--configuration', 'compileClasspath') + def result = runTasksAndFail('dependencies', '--configuration', 'compileClasspath') then: - def rootCause = StackTraceUtils.extractRootCause(result.failure) - rootCause.class.simpleName == 'DependencyDeniedException' - rootCause.message.contains("Dependency com.google.guava:guava:19.0-rc2 denied by rule deny-dependency") + result.output.contains("Dependency com.google.guava:guava:19.0-rc2 denied by rule deny-dependency") } @Unroll @@ -400,12 +396,10 @@ class ResolutionRulesPluginSpec extends IntegrationSpec { """.stripIndent() when: - def result = runTasks('dependencies', '--configuration', 'compileClasspath') + def result = runTasksAndFail('dependencies', '--configuration', 'compileClasspath') then: - def rootCause = StackTraceUtils.extractRootCause(result.failure) - rootCause.class.simpleName == 'DependencyDeniedException' - rootCause.message.contains("Dependency com.sun.jersey:jersey-bundle: denied by rule deny-dependency-without-version") + result.output.contains("Dependency com.sun.jersey:jersey-bundle: denied by rule deny-dependency-without-version") } def 'reject dependency'() { @@ -417,10 +411,10 @@ class ResolutionRulesPluginSpec extends IntegrationSpec { """.stripIndent() when: - def result = runTasksSuccessfully('dependencies', '--configuration', 'compileClasspath') + def result = runTasks('dI', '--configuration', 'compileClasspath', '--dependency', 'com.google.guava:guava') then: - result.standardOutput.contains("rejected by component selection rule: rejected by rule reject-dependency because 'Guava 12.0 significantly regressed LocalCache performance'") + result.output.contains("Could not find com.google.guava:guava:12.0") } def 'reject dependency with selector'() { @@ -446,10 +440,10 @@ class ResolutionRulesPluginSpec extends IntegrationSpec { """.stripIndent() when: - def result = runTasksSuccessfully('dependencies', '--configuration', 'compileClasspath') + def result = runTasks('dependencies', '--configuration', 'compileClasspath') then: - result.standardOutput.contains("rejected by rule reject-dependency-with-selector because 'Just a Guava release that happens to have a patch release'") + result.output.contains("com.google.guava:guava:16.0.1 FAILED") } def 'rules apply to detached configurations that have been added to the configurations container'() { @@ -463,12 +457,13 @@ class ResolutionRulesPluginSpec extends IntegrationSpec { } } """ + new File(projectDir, 'gradle.properties').text = '''org.gradle.configuration-cache=false'''.stripIndent() when: - def result = runTasksSuccessfully('testDetached') + def result = runTasks('testDetached') then: - result.standardOutput.contains('FILES: 1') + result.output.contains('FILES: 1') } def 'warning logged when configuration has been resolved'() { @@ -489,10 +484,10 @@ class ResolutionRulesPluginSpec extends IntegrationSpec { """.stripIndent() when: - def result = runTasksSuccessfully() + def result = runTasks() then: - result.standardOutput.contains("Dependency resolution rules will not be applied to configuration ':compileClasspath', it was resolved before the project was executed") + result.output.contains("Dependency resolution rules will not be applied to configuration ':compileClasspath', it was resolved before the project was executed") } def 'warning should not be logged when using nebulaRecommenderBom'() { @@ -559,10 +554,10 @@ class ResolutionRulesPluginSpec extends IntegrationSpec { """.stripIndent() when: - def result = runTasksSuccessfully() + def result = runTasks() then: - !result.standardOutput.contains("Dependency resolution rules will not be applied to configuration ':nebulaRecommenderBom', it was resolved before the project was executed") + !result.output.contains("Dependency resolution rules will not be applied to configuration ':nebulaRecommenderBom', it was resolved before the project was executed") } def 'do not reject dependency if version is not part of the selector in rule'() { @@ -577,7 +572,7 @@ class ResolutionRulesPluginSpec extends IntegrationSpec { def result = runTasks('dependencies', '--configuration', 'compileClasspath') then: - !result.standardError.contains("Resolution rules could not resolve all dependencies to align configuration ':compileClasspath':\n" + + !result.output.contains("Resolution rules could not resolve all dependencies to align configuration ':compileClasspath':\n" + " - com.google.guava:guava:19.0 -> com.google.guava:guava:19.0 - Could not find com.google.guava:guava:19.0") } } diff --git a/src/integTest/groovy/nebula/plugin/resolutionrules/SubstituteRulesSpec.groovy b/src/integTest/groovy/nebula/plugin/resolutionrules/SubstituteRulesSpec.groovy index 3cf4c51..02eb3e6 100644 --- a/src/integTest/groovy/nebula/plugin/resolutionrules/SubstituteRulesSpec.groovy +++ b/src/integTest/groovy/nebula/plugin/resolutionrules/SubstituteRulesSpec.groovy @@ -1,13 +1,12 @@ package nebula.plugin.resolutionrules -import nebula.test.IntegrationSpec -import org.codehaus.groovy.runtime.StackTraceUtils -class SubstituteRulesSpec extends IntegrationSpec { +class SubstituteRulesSpec extends AbstractIntegrationTestKitSpec { File rulesJsonFile def setup() { rulesJsonFile = new File(projectDir, "${moduleName}.json") + definePluginOutsideOfPluginBlock = true buildFile << """ apply plugin: 'java' @@ -60,10 +59,10 @@ class SubstituteRulesSpec extends IntegrationSpec { """.stripIndent() when: - def result = runTasksSuccessfully('dependencies', '--configuration', 'compileClasspath') + def result = runTasks('dependencies', '--configuration', 'compileClasspath') then: - result.standardOutput.contains('bouncycastle:bcmail-jdk16:1.40 -> org.bouncycastle:bcmail-jdk16:') + result.output.contains('bouncycastle:bcmail-jdk16:1.40 -> org.bouncycastle:bcmail-jdk16:') } def 'substitute details are shown by dependencyInsight'() { @@ -75,12 +74,12 @@ class SubstituteRulesSpec extends IntegrationSpec { """.stripIndent() when: - def result = runTasksSuccessfully('dependencyInsight', '--configuration', 'compileClasspath', '--dependency', 'bcmail-jdk16') + def result = runTasks('dependencyInsight', '--configuration', 'compileClasspath', '--dependency', 'bcmail-jdk16') then: - !result.standardOutput.contains('org.bouncycastle:bcmail-jdk16:1.40') - result.standardOutput.contains('org.bouncycastle:bcmail-jdk16:') - result.standardOutput.contains('The latest version of BC is required, using the new coordinate') + !result.output.contains('org.bouncycastle:bcmail-jdk16:1.40') + result.output.contains('org.bouncycastle:bcmail-jdk16:') + result.output.contains('The latest version of BC is required, using the new coordinate') } def 'substitute dependency with version'() { @@ -92,10 +91,10 @@ class SubstituteRulesSpec extends IntegrationSpec { """.stripIndent() when: - def result = runTasksSuccessfully('dependencies', '--configuration', 'compileClasspath') + def result = runTasks('dependencies', '--configuration', 'compileClasspath') then: - result.standardOutput.contains('com.google.guava:guava:19.0-rc2 -> 19.0-rc1') + result.output.contains('com.google.guava:guava:19.0-rc2 -> 19.0-rc1') } def 'substitute dependency outside allowed range'() { @@ -107,10 +106,10 @@ class SubstituteRulesSpec extends IntegrationSpec { """.stripIndent() when: - def result = runTasksSuccessfully('dependencies', '--configuration', 'compileClasspath') + def result = runTasks('dependencies', '--configuration', 'compileClasspath') then: - result.standardOutput.contains('om.sun.jersey:jersey-bundle:1.17 -> 1.18') + result.output.contains('om.sun.jersey:jersey-bundle:1.17 -> 1.18') } def 'do not substitute dependency above allowed range'() { @@ -122,10 +121,10 @@ class SubstituteRulesSpec extends IntegrationSpec { """.stripIndent() when: - def result = runTasksSuccessfully('dependencies', '--configuration', 'compileClasspath') + def result = runTasks('dependencies', '--configuration', 'compileClasspath') then: - result.standardOutput.contains('om.sun.jersey:jersey-bundle:1.18\n') + result.output.contains('om.sun.jersey:jersey-bundle:1.18\n') } def 'missing version in substitution rule'() { @@ -152,11 +151,9 @@ class SubstituteRulesSpec extends IntegrationSpec { """.stripIndent() when: - def result = runTasks('dependencies', '--configuration', 'compileClasspath') + def result = runTasksAndFail('dependencies', '--configuration', 'compileClasspath') then: - def rootCause = StackTraceUtils.extractRootCause(result.failure) - rootCause.class.simpleName == 'SubstituteRuleMissingVersionException' - rootCause.message.contains("The dependency to be substituted (org.ow2.asm:asm) must have a version. Rule missing-version-in-substitution-rule is invalid") + result.output.contains("The dependency to be substituted (org.ow2.asm:asm) must have a version. Rule missing-version-in-substitution-rule is invalid") } } diff --git a/src/integTest/groovy/nebula/plugin/resolutionrules/SubstituteRulesWithRangesSpec.groovy b/src/integTest/groovy/nebula/plugin/resolutionrules/SubstituteRulesWithRangesSpec.groovy index fa1c841..7e07b27 100644 --- a/src/integTest/groovy/nebula/plugin/resolutionrules/SubstituteRulesWithRangesSpec.groovy +++ b/src/integTest/groovy/nebula/plugin/resolutionrules/SubstituteRulesWithRangesSpec.groovy @@ -1,7 +1,6 @@ package nebula.plugin.resolutionrules -import nebula.test.IntegrationTestKitSpec import nebula.test.dependencies.DependencyGraphBuilder import nebula.test.dependencies.GradleDependencyGenerator import nebula.test.dependencies.ModuleBuilder @@ -11,10 +10,11 @@ import spock.lang.Unroll * Substitutions apply to declared dependencies, not resolved ones * See: https://github.com/nebula-plugins/gradle-nebula-integration/issues/50#issuecomment-433934842 */ -class SubstituteRulesWithRangesSpec extends IntegrationTestKitSpec { +class SubstituteRulesWithRangesSpec extends AbstractIntegrationTestKitSpec { File rulesJsonFile def setup() { + definePluginOutsideOfPluginBlock = true rulesJsonFile = new File(projectDir, "${moduleName}.json") def graph = new DependencyGraphBuilder() @@ -45,7 +45,6 @@ class SubstituteRulesWithRangesSpec extends IntegrationTestKitSpec { """.stripIndent() definePluginOutsideOfPluginBlock = true - debug = true keepFiles = true }