Skip to content

Commit

Permalink
Merge pull request #210 from chali/Gradle7Compatibility
Browse files Browse the repository at this point in the history
Gradle 7.0 compatibility
  • Loading branch information
chali committed Jan 22, 2021
2 parents c3fd39d + d482515 commit 3f63553
Show file tree
Hide file tree
Showing 14 changed files with 69 additions and 52 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ dependencies {
testImplementation 'com.netflix.nebula:nebula-project-plugin:latest.release'
testImplementation 'com.netflix.nebula:nebula-test:latest.release'
testImplementation gradleTestKit()
testImplementation('org.ajoberstar.grgit:grgit-core:3.0.0-beta.1') {
testImplementation('org.ajoberstar.grgit:grgit-core:4.1.0') {
exclude group: 'org.codehaus.groovy', module: 'groovy'
}
testImplementation "com.github.tomakehurst:wiremock:2.17.0"
Expand Down
10 changes: 4 additions & 6 deletions gradle/dependency-locks/integTestCompileClasspath.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ com.github.jknack:handlebars-helpers:4.0.6
com.github.jknack:handlebars:4.0.6
com.github.tomakehurst:wiremock:2.17.0
com.google.guava:guava:20.0
com.googlecode.javaewah:JavaEWAH:1.1.6
com.googlecode.javaewah:JavaEWAH:1.1.7
com.jayway.jsonpath:json-path:2.4.0
com.jcraft:jsch:0.1.54
com.jcraft:jzlib:1.1.1
com.netflix.nebula:gradle-git-scm-plugin:4.2.0
com.netflix.nebula:gradle-scm-plugin:5.1.0
com.netflix.nebula:nebula-dependencies-comparison:0.1.8
Expand All @@ -32,7 +30,7 @@ junit:junit:4.12
net.minidev:accessors-smart:1.2
net.minidev:json-smart:2.3
net.sf.jopt-simple:jopt-simple:5.0.3
org.ajoberstar.grgit:grgit-core:3.0.0-beta.1
org.ajoberstar.grgit:grgit-core:4.1.0
org.antlr:antlr4-runtime:4.5.1-1
org.apache.commons:commons-lang3:3.7
org.apache.httpcomponents:httpclient:4.5.5
Expand All @@ -47,7 +45,7 @@ org.eclipse.jetty:jetty-servlets:9.2.24.v20180105
org.eclipse.jetty:jetty-util:9.2.24.v20180105
org.eclipse.jetty:jetty-webapp:9.2.24.v20180105
org.eclipse.jetty:jetty-xml:9.2.24.v20180105
org.eclipse.jgit:org.eclipse.jgit:5.0.1.201806211838-r
org.eclipse.jgit:org.eclipse.jgit:5.10.0.202012080955-r
org.hamcrest:hamcrest-core:1.3
org.jetbrains.kotlin:kotlin-stdlib-common:1.4.21
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.21
Expand All @@ -57,7 +55,7 @@ org.jetbrains:annotations:13.0
org.mozilla:rhino:1.7R4
org.objenesis:objenesis:2.4
org.ow2.asm:asm:5.0.4
org.slf4j:slf4j-api:1.7.25
org.slf4j:slf4j-api:1.7.30
org.spockframework:spock-core:1.3-groovy-2.4
org.xmlunit:xmlunit-core:2.5.1
org.xmlunit:xmlunit-legacy:2.5.1
10 changes: 3 additions & 7 deletions gradle/dependency-locks/integTestRuntimeClasspath.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ com.jcraft:jsch.agentproxy.sshagent:0.0.7
com.jcraft:jsch.agentproxy.svnkit-trilead-ssh2:0.0.7
com.jcraft:jsch.agentproxy.usocket-jna:0.0.7
com.jcraft:jsch.agentproxy.usocket-nc:0.0.7
com.jcraft:jsch:0.1.55
com.jcraft:jzlib:1.1.2
com.netflix.nebula:gradle-contacts-plugin:5.1.0
com.netflix.nebula:gradle-git-scm-plugin:4.2.0
Expand Down Expand Up @@ -48,15 +47,12 @@ net.java.dev.jna:platform:3.4.0
net.minidev:accessors-smart:1.2
net.minidev:json-smart:2.3
net.sf.jopt-simple:jopt-simple:5.0.3
org.ajoberstar.grgit:grgit-core:3.0.0-beta.1
org.ajoberstar.grgit:grgit-core:4.1.0
org.antlr:antlr-runtime:3.4
org.antlr:antlr4-runtime:4.5.1-1
org.apache.commons:commons-lang3:3.7
org.apache.httpcomponents:httpclient:4.5.5
org.apache.httpcomponents:httpcore:4.4.9
org.bouncycastle:bcpg-jdk15on:1.64
org.bouncycastle:bcpkix-jdk15on:1.64
org.bouncycastle:bcprov-jdk15on:1.64
org.eclipse.jetty:jetty-continuation:9.2.24.v20180105
org.eclipse.jetty:jetty-http:9.2.24.v20180105
org.eclipse.jetty:jetty-io:9.2.24.v20180105
Expand All @@ -67,7 +63,7 @@ org.eclipse.jetty:jetty-servlets:9.2.24.v20180105
org.eclipse.jetty:jetty-util:9.2.24.v20180105
org.eclipse.jetty:jetty-webapp:9.2.24.v20180105
org.eclipse.jetty:jetty-xml:9.2.24.v20180105
org.eclipse.jgit:org.eclipse.jgit:5.7.0.202003110725-r
org.eclipse.jgit:org.eclipse.jgit:5.10.0.202012080955-r
org.hamcrest:hamcrest-core:1.3
org.jetbrains.kotlin:kotlin-stdlib-common:1.4.21
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.21
Expand All @@ -77,7 +73,7 @@ org.jetbrains:annotations:13.0
org.mozilla:rhino:1.7R4
org.objenesis:objenesis:2.4
org.ow2.asm:asm:5.0.4
org.slf4j:slf4j-api:1.7.25
org.slf4j:slf4j-api:1.7.30
org.spockframework:spock-core:1.3-groovy-2.4
org.tmatesoft.sqljet:sqljet:1.1.10
org.tmatesoft.svnkit:svnkit:1.8.12
Expand Down
10 changes: 4 additions & 6 deletions gradle/dependency-locks/testCompileClasspath.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ com.github.jknack:handlebars-helpers:4.0.6
com.github.jknack:handlebars:4.0.6
com.github.tomakehurst:wiremock:2.17.0
com.google.guava:guava:20.0
com.googlecode.javaewah:JavaEWAH:1.1.6
com.googlecode.javaewah:JavaEWAH:1.1.7
com.jayway.jsonpath:json-path:2.4.0
com.jcraft:jsch:0.1.54
com.jcraft:jzlib:1.1.1
com.netflix.nebula:gradle-git-scm-plugin:4.2.0
com.netflix.nebula:gradle-scm-plugin:5.1.0
com.netflix.nebula:nebula-dependencies-comparison:0.1.8
Expand All @@ -32,7 +30,7 @@ junit:junit:4.12
net.minidev:accessors-smart:1.2
net.minidev:json-smart:2.3
net.sf.jopt-simple:jopt-simple:5.0.3
org.ajoberstar.grgit:grgit-core:3.0.0-beta.1
org.ajoberstar.grgit:grgit-core:4.1.0
org.antlr:antlr4-runtime:4.5.1-1
org.apache.commons:commons-lang3:3.7
org.apache.httpcomponents:httpclient:4.5.5
Expand All @@ -47,7 +45,7 @@ org.eclipse.jetty:jetty-servlets:9.2.24.v20180105
org.eclipse.jetty:jetty-util:9.2.24.v20180105
org.eclipse.jetty:jetty-webapp:9.2.24.v20180105
org.eclipse.jetty:jetty-xml:9.2.24.v20180105
org.eclipse.jgit:org.eclipse.jgit:5.0.1.201806211838-r
org.eclipse.jgit:org.eclipse.jgit:5.10.0.202012080955-r
org.hamcrest:hamcrest-core:1.3
org.jetbrains.kotlin:kotlin-stdlib-common:1.4.21
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.21
Expand All @@ -57,7 +55,7 @@ org.jetbrains:annotations:13.0
org.mozilla:rhino:1.7R4
org.objenesis:objenesis:2.4
org.ow2.asm:asm:5.0.4
org.slf4j:slf4j-api:1.7.25
org.slf4j:slf4j-api:1.7.30
org.spockframework:spock-core:1.3-groovy-2.4
org.xmlunit:xmlunit-core:2.5.1
org.xmlunit:xmlunit-legacy:2.5.1
10 changes: 3 additions & 7 deletions gradle/dependency-locks/testRuntimeClasspath.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ com.jcraft:jsch.agentproxy.sshagent:0.0.7
com.jcraft:jsch.agentproxy.svnkit-trilead-ssh2:0.0.7
com.jcraft:jsch.agentproxy.usocket-jna:0.0.7
com.jcraft:jsch.agentproxy.usocket-nc:0.0.7
com.jcraft:jsch:0.1.55
com.jcraft:jzlib:1.1.2
com.netflix.nebula:gradle-contacts-plugin:5.1.0
com.netflix.nebula:gradle-git-scm-plugin:4.2.0
Expand Down Expand Up @@ -48,15 +47,12 @@ net.java.dev.jna:platform:3.4.0
net.minidev:accessors-smart:1.2
net.minidev:json-smart:2.3
net.sf.jopt-simple:jopt-simple:5.0.3
org.ajoberstar.grgit:grgit-core:3.0.0-beta.1
org.ajoberstar.grgit:grgit-core:4.1.0
org.antlr:antlr-runtime:3.4
org.antlr:antlr4-runtime:4.5.1-1
org.apache.commons:commons-lang3:3.7
org.apache.httpcomponents:httpclient:4.5.5
org.apache.httpcomponents:httpcore:4.4.9
org.bouncycastle:bcpg-jdk15on:1.64
org.bouncycastle:bcpkix-jdk15on:1.64
org.bouncycastle:bcprov-jdk15on:1.64
org.eclipse.jetty:jetty-continuation:9.2.24.v20180105
org.eclipse.jetty:jetty-http:9.2.24.v20180105
org.eclipse.jetty:jetty-io:9.2.24.v20180105
Expand All @@ -67,7 +63,7 @@ org.eclipse.jetty:jetty-servlets:9.2.24.v20180105
org.eclipse.jetty:jetty-util:9.2.24.v20180105
org.eclipse.jetty:jetty-webapp:9.2.24.v20180105
org.eclipse.jetty:jetty-xml:9.2.24.v20180105
org.eclipse.jgit:org.eclipse.jgit:5.7.0.202003110725-r
org.eclipse.jgit:org.eclipse.jgit:5.10.0.202012080955-r
org.hamcrest:hamcrest-core:1.3
org.jetbrains.kotlin:kotlin-stdlib-common:1.4.21
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.21
Expand All @@ -77,7 +73,7 @@ org.jetbrains:annotations:13.0
org.mozilla:rhino:1.7R4
org.objenesis:objenesis:2.4
org.ow2.asm:asm:5.0.4
org.slf4j:slf4j-api:1.7.25
org.slf4j:slf4j-api:1.7.30
org.spockframework:spock-core:1.3-groovy-2.4
org.tmatesoft.sqljet:sqljet:1.1.10
org.tmatesoft.svnkit:svnkit:1.8.12
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,14 +269,17 @@ class DependencyLockTaskConfigurer {
if (ext != null) {
Collection<Configuration> lockableConfigurations = lockableConfigurations(project, subproject, ext.configurationNames, extension.skippedConfigurationNamesPrefixes)
Collection<Configuration> configurations = filterNonLockableConfigurationsAndProvideWarningsForGlobalLockSubproject(subproject, ext.configurationNames, lockableConfigurations)

Configuration aggregate = subproject.configurations.create("aggregateConfiguration")
aggregate.setCanBeConsumed(true)
aggregate.setCanBeResolved(true)
configurations
.findAll { configuration ->
!configurationsToSkipForGlobalLock.contains(configuration.name)
}
.collect { configuration ->
project.dependencies.create(project.dependencies.project(path: subproject.path, configuration: configuration.name))
.each { configuration ->
aggregate.extendsFrom(configuration)
}
[project.dependencies.create(project.dependencies.project(path: subproject.path, configuration: aggregate.name))]
} else {
[project.dependencies.create(subproject)]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ class GenerateLockTask extends AbstractLockTask {
if (taskProject == project) {
it.canBeResolved && !ConfigurationFilters.safelyHasAResolutionAlternative(it)
} else {
//TODO: we need a better approach for global locks because `default` is going away
it.canBeResolved && it.canBeConsumed && (!ConfigurationFilters.safelyHasAResolutionAlternative(it) || it.name == 'default')
it.canBeResolved && (!ConfigurationFilters.safelyHasAResolutionAlternative(it))
}
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,7 @@ class GradleVersionUtils {
GradleVersion.current().baseVersion < GradleVersion.version(version)
}

static boolean currentGradleVersionIsGreaterOrEqualThan(String version) {
GradleVersion.current().baseVersion >= GradleVersion.version(version)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ import nebula.test.IntegrationSpec
import nebula.test.dependencies.DependencyGraphBuilder
import nebula.test.dependencies.GradleDependencyGenerator
import nebula.test.dependencies.ModuleBuilder
import org.gradle.util.GradleVersion
import spock.lang.Ignore
import spock.lang.IgnoreIf
import spock.lang.Issue
import spock.lang.Unroll

Expand Down Expand Up @@ -881,7 +883,7 @@ class DependencyLockLauncherSpec extends IntegrationSpec {
implementation 'test.example:bar:1.1.0'
special 'test.example:foo:2.0.0'
}
dependencyLock.configurationNames = ['testRuntime', 'compile', 'special', 'compileClasspath']
dependencyLock.configurationNames = ['special', 'compileClasspath']
""".stripIndent())

buildFile << """\
Expand Down Expand Up @@ -918,9 +920,6 @@ class DependencyLockLauncherSpec extends IntegrationSpec {
assert globalLockFile.text.contains('test:sub1')

if (!GradleVersionUtils.currentGradleVersionIsLessThan("6.0")) {
assert result.standardOutput.contains('Global lock warning: project \'sub1\' requested locking a deprecated configuration \'compile\' which has resolution alternatives: [compileClasspath]')
assert result.standardOutput.contains('Global lock warning: project \'sub1\' requested locking a deprecated configuration \'testRuntime\' which has resolution alternatives: [testRuntimeClasspath]')

assert !globalLockFile.text.contains('test.example:bar')
}
}
Expand Down Expand Up @@ -1420,6 +1419,8 @@ class DependencyLockLauncherSpec extends IntegrationSpec {
noExceptionThrown()
}

//Spring boot plugin 1.x is using removed runtime configuration. Unless backported for Gradle 7.0 it cannot be used
@IgnoreIf({ GradleVersion.current().baseVersion >= GradleVersion.version("7.0")})
@Issue('#86')
def 'locks win over Spring dependency management'() {
System.setProperty("ignoreDeprecations", "true")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import nebula.plugin.dependencylock.util.LockGenerator
import nebula.plugin.dependencylock.utils.GradleVersionUtils
import nebula.test.dependencies.DependencyGraphBuilder
import nebula.test.dependencies.GradleDependencyGenerator
import org.gradle.util.GradleVersion
import spock.lang.IgnoreIf
import spock.lang.Unroll

class DependencyLockPluginWithCoreSpec extends AbstractDependencyLockPluginSpec {
Expand Down Expand Up @@ -369,6 +371,8 @@ class DependencyLockPluginWithCoreSpec extends AbstractDependencyLockPluginSpec
'implementation' | 'compileClasspath'
}

//kotlin plugin adds compile which causes unexpected results ignore until we know more https://youtrack.jetbrains.com/issue/KT-44462
@IgnoreIf({ GradleVersion.current().baseVersion >= GradleVersion.version("7.0")})
@Unroll
def 'generate core lock file with kotlin plugin - for configuration #configuration'() {
given:
Expand Down Expand Up @@ -420,6 +424,8 @@ class DependencyLockPluginWithCoreSpec extends AbstractDependencyLockPluginSpec
'implementation' | 'compileClasspath'
}

//kotlin plugin adds compile which causes unexpected results ignore until we know more https://youtrack.jetbrains.com/issue/KT-44462
@IgnoreIf({ GradleVersion.current().baseVersion >= GradleVersion.version("7.0")})
@Unroll
def 'generate core lock file with kotlin plugin with multiproject setup - for configuration #configuration'() {
given:
Expand Down Expand Up @@ -489,7 +495,7 @@ class DependencyLockPluginWithCoreSpec extends AbstractDependencyLockPluginSpec
buildFile << """\
plugins {
id 'nebula.dependency-lock'
id "nebula.clojure" version "8.1.4"
id "nebula.clojure" version "9.4.3"
}
repositories {
${mavenrepo.mavenRepositoryBlock}
Expand Down Expand Up @@ -565,7 +571,7 @@ class DependencyLockPluginWithCoreSpec extends AbstractDependencyLockPluginSpec
buildscript {
repositories { maven { url "https://plugins.gradle.org/m2/" } }
dependencies {
classpath "com.netflix.nebula:nebula-clojure-plugin:8.1.4"
classpath "com.netflix.nebula:nebula-clojure-plugin:9.4.3"
classpath "com.netflix.nebula:nebula-kotlin-plugin:1.3.40"
}
}
Expand Down Expand Up @@ -615,20 +621,21 @@ class DependencyLockPluginWithCoreSpec extends AbstractDependencyLockPluginSpec
System.setProperty("ignoreDeprecations", "false")
}

//TODO kotlin plugin adds compile which causes unexpected results ignore until we know more https://youtrack.jetbrains.com/issue/KT-44462
where:
languagePlugin | languagePluginFirst | notes
'groovy' | true | 'applied first'
'java' | true | 'applied first'
'java-library' | true | 'applied first'
'nebula.clojure' | true | 'applied first'
'nebula.kotlin' | true | 'applied first'
//'nebula.kotlin' | true | 'applied first'
'scala' | true | 'applied first'

'groovy' | false | 'applied last'
'java' | false | 'applied last'
'java-library' | false | 'applied last'
'nebula.clojure' | false | 'applied last'
'nebula.kotlin' | false | 'applied last'
//'nebula.kotlin' | false | 'applied last'
'scala' | false | 'applied last'
}

Expand Down Expand Up @@ -701,7 +708,7 @@ class DependencyLockPluginWithCoreSpec extends AbstractDependencyLockPluginSpec
}
}
dependencies {
classpath "gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:2.0.0"
classpath "gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.6.0"
}
}
apply plugin: 'test.wrapper-plugin'
Expand Down Expand Up @@ -908,7 +915,7 @@ class DependencyLockPluginWithCoreSpec extends AbstractDependencyLockPluginSpec
}
}
dependencies {
classpath "com.netflix.nebula:nebula-project-plugin:6.0.0"
classpath "com.netflix.nebula:nebula-project-plugin:7.0.9"
}
}
plugins {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import nebula.plugin.dependencyverifier.DependencyResolutionVerifierKt
import nebula.test.dependencies.DependencyGraphBuilder
import nebula.test.dependencies.GradleDependencyGenerator
import nebula.test.dependencies.ModuleBuilder
import org.gradle.util.GradleVersion
import spock.lang.IgnoreIf
import spock.lang.Subject
import spock.lang.Unroll

Expand Down Expand Up @@ -288,12 +290,9 @@ test.nebula:b:1.1.0

@Unroll
def 'scala: fail when dependency is unresolvable upon update via #lockArg (defining dependencies on base configuration "#conf")'() {
// the configurations `incrementalScalaAnalysisFor_x_` are resolvable only from a scala context, and extend from `compile` and `implementation`
// the configurations `incrementalScalaAnalysisFor_x_` are resolvable only from a scala context, and extend from `implementation`
// https://github.com/gradle/gradle/blob/master/subprojects/scala/src/main/java/org/gradle/api/plugins/scala/ScalaBasePlugin.java#L143
given:
if (conf == 'compile') {
System.setProperty("ignoreDeprecations", "true")
}
createSingleProjectBaseline('scala', conf)

when:
Expand All @@ -317,8 +316,6 @@ test.nebula:b:1.1.0

where:
conf | lockArg
'compile' | "write-locks"
'compile' | "update-locks"
'implementation' | "write-locks"
'implementation' | "update-locks"
}
Expand Down Expand Up @@ -359,6 +356,8 @@ test.nebula:b:1.1.0
lockArg << ['write-locks', 'update-locks']
}

//kotlin plugin adds compile which causes unexpected results ignore until we know more https://youtrack.jetbrains.com/issue/KT-44462
@IgnoreIf({ GradleVersion.current().baseVersion >= GradleVersion.version("7.0")})
@Unroll
def 'nebula.kotlin: fail when dependency is unresolvable upon update via #lockArg'() {
given:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ class MigrateToCoreLocksTaskSpec extends AbstractDependencyLockPluginSpec {
}
}
dependencies {
classpath "com.netflix.nebula:nebula-project-plugin:7.0.4"
classpath "com.netflix.nebula:nebula-project-plugin:7.0.9"
}
}
plugins {
Expand Down Expand Up @@ -644,7 +644,7 @@ class MigrateToCoreLocksTaskSpec extends AbstractDependencyLockPluginSpec {
}
}
dependencies {
classpath "com.netflix.nebula:nebula-project-plugin:7.0.4"
classpath "com.netflix.nebula:nebula-project-plugin:7.0.9"
}
}
plugins {
Expand Down

0 comments on commit 3f63553

Please sign in to comment.