Skip to content

Commit dec659d

Browse files
committed
Gradle 9.x support
1 parent c1efe29 commit dec659d

File tree

13 files changed

+54
-58
lines changed

13 files changed

+54
-58
lines changed

.github/workflows/nebula.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
strategy:
2323
matrix:
2424
# test against latest update of some major Java version(s), as well as specific LTS version(s)
25-
java: [8, 17, 21]
25+
java: [17, 21]
2626
name: Gradle Build without Publish
2727
steps:
2828
- uses: actions/checkout@v1
@@ -35,7 +35,7 @@ jobs:
3535
with:
3636
distribution: 'zulu'
3737
java-version: |
38-
8
38+
17
3939
${{ matrix.java }}
4040
java-package: jdk
4141
- uses: actions/cache@v4
@@ -75,7 +75,7 @@ jobs:
7575
with:
7676
distribution: 'zulu'
7777
java-version: |
78-
8
78+
17
7979
21
8080
java-package: jdk
8181
- uses: actions/cache@v4
@@ -120,7 +120,7 @@ jobs:
120120
with:
121121
distribution: 'zulu'
122122
java-version: |
123-
8
123+
17
124124
21
125125
java-package: jdk
126126
- uses: actions/cache@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ out/
66
*.iml
77
*.ipr
88
*.iws
9+
.kotlin/

build.gradle

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
import org.gradle.util.GradleVersion
1717

1818
plugins {
19-
id 'com.netflix.nebula.plugin-plugin' version '21.2.2'
19+
id 'com.netflix.nebula.plugin-plugin' version '22.0.2'
2020
id 'com.netflix.nebula.optional-base' version '9.0.0'
21-
id "org.jetbrains.kotlin.jvm" version "2.1.0"
21+
id "org.jetbrains.kotlin.jvm" version "2.2.0"
2222
id 'java-gradle-plugin'
2323
}
2424

@@ -106,24 +106,6 @@ tasks.withType(Test).configureEach {
106106
}
107107
}
108108

109-
java {
110-
sourceCompatibility = JavaVersion.VERSION_1_8
111-
targetCompatibility = JavaVersion.VERSION_1_8
112-
}
113-
114-
idea {
115-
project {
116-
jdkName = '1.8'
117-
languageLevel = '1.8'
118-
}
119-
}
120-
121-
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
122-
kotlinOptions {
123-
jvmTarget = '1.8'
124-
}
125-
}
126-
127109
tasks.withType(GenerateModuleMetadata).configureEach {
128110
suppressedValidationErrors.add('enforced-platform')
129111
}

gradle.lockfile

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ com.google.guava:guava:20.0=integTestCompileClasspath,integTestRuntimeClasspath,
1515
com.googlecode.javaewah:JavaEWAH:1.1.12=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
1616
com.jayway.jsonpath:json-path:2.4.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
1717
com.jcraft:jzlib:1.1.2=integTestRuntimeClasspath,testRuntimeClasspath
18-
com.netflix.nebula:gradle-contacts-plugin:7.0.1=integTestRuntimeClasspath,testRuntimeClasspath
19-
com.netflix.nebula:gradle-info-plugin:13.1.0=integTestRuntimeClasspath,testRuntimeClasspath
18+
com.netflix.nebula:gradle-contacts-plugin:7.0.2=integTestRuntimeClasspath,testRuntimeClasspath
19+
com.netflix.nebula:gradle-info-plugin:14.0.0=integTestRuntimeClasspath,testRuntimeClasspath
2020
com.netflix.nebula:nebula-dependencies-comparison:0.2.1=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
21-
com.netflix.nebula:nebula-gradle-interop:2.3.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
22-
com.netflix.nebula:nebula-project-plugin:11.0.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
23-
com.netflix.nebula:nebula-publishing-plugin:21.0.0=integTestRuntimeClasspath,testRuntimeClasspath
24-
com.netflix.nebula:nebula-test:10.6.2=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
21+
com.netflix.nebula:nebula-gradle-interop:3.0.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
22+
com.netflix.nebula:nebula-project-plugin:12.0.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
23+
com.netflix.nebula:nebula-publishing-plugin:21.2.0=integTestRuntimeClasspath,testRuntimeClasspath
24+
com.netflix.nebula:nebula-test:11.0.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
2525
com.perforce:p4java:2015.2.1365273=integTestRuntimeClasspath,testRuntimeClasspath
2626
com.squareup.moshi:moshi:1.12.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
2727
com.squareup.okio:okio:2.10.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
@@ -31,18 +31,18 @@ javax.servlet:javax.servlet-api:3.1.0=integTestCompileClasspath,integTestRuntime
3131
joda-time:joda-time:2.10=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
3232
junit:junit-dep:4.11=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
3333
junit:junit:4.13.2=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
34-
net.java.dev.jna:jna-platform:5.7.0=integTestRuntimeClasspath,testRuntimeClasspath
35-
net.java.dev.jna:jna:5.7.0=integTestRuntimeClasspath,testRuntimeClasspath
34+
net.java.dev.jna:jna-platform:5.16.0=integTestRuntimeClasspath,testRuntimeClasspath
35+
net.java.dev.jna:jna:5.16.0=integTestRuntimeClasspath,testRuntimeClasspath
3636
net.minidev:accessors-smart:1.2=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
3737
net.minidev:json-smart:2.3=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
3838
net.sf.jopt-simple:jopt-simple:5.0.3=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
3939
org.ajoberstar.grgit:grgit-core:4.1.1=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
4040
org.antlr:antlr4-runtime:4.5.1-1=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
4141
org.apache.commons:commons-lang3:3.12.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
42+
org.apache.groovy:groovy:4.0.4=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
4243
org.apache.httpcomponents:httpclient:4.5.5=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
4344
org.apache.httpcomponents:httpcore:4.4.9=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
4445
org.apiguardian:apiguardian-api:1.1.2=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
45-
org.codehaus.groovy:groovy:3.0.12=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
4646
org.eclipse.jetty:jetty-continuation:9.2.24.v20180105=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
4747
org.eclipse.jetty:jetty-http:9.2.24.v20180105=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
4848
org.eclipse.jetty:jetty-io:9.2.24.v20180105=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
@@ -57,17 +57,18 @@ org.eclipse.jgit:org.eclipse.jgit:5.13.0.202109080827-r=integTestCompileClasspat
5757
org.hamcrest:hamcrest-core:1.3=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
5858
org.hamcrest:hamcrest:2.2=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
5959
org.jetbrains.kotlin:kotlin-stdlib-common:1.4.20=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
60-
org.jetbrains.kotlin:kotlin-stdlib:2.1.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
60+
org.jetbrains.kotlin:kotlin-stdlib:2.2.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
6161
org.jetbrains:annotations:13.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
62-
org.junit.platform:junit-platform-commons:1.9.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
63-
org.junit.platform:junit-platform-engine:1.9.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
62+
org.junit.platform:junit-platform-commons:1.13.1=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
63+
org.junit.platform:junit-platform-engine:1.13.1=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
64+
org.junit.platform:junit-platform-launcher:1.13.1=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
6465
org.mozilla:rhino:1.7R4=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
6566
org.objenesis:objenesis:2.4=integTestRuntimeClasspath,testRuntimeClasspath
66-
org.opentest4j:opentest4j:1.2.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
67+
org.opentest4j:opentest4j:1.3.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
6768
org.ow2.asm:asm:5.0.4=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
6869
org.slf4j:slf4j-api:1.7.30=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
69-
org.spockframework:spock-core:2.3-groovy-3.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
70-
org.spockframework:spock-junit4:2.3-groovy-3.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
70+
org.spockframework:spock-core:2.3-groovy-4.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
71+
org.spockframework:spock-junit4:2.3-groovy-4.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
7172
org.xmlunit:xmlunit-core:2.5.1=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
7273
org.xmlunit:xmlunit-legacy:2.5.1=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
7374
empty=annotationProcessor,integTestAnnotationProcessor,testAnnotationProcessor

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionSha256Sum=7197a12f450794931532469d4ff21a59ea2c1cd59a3ec3f89c035c3c420a6999
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-rc-1-bin.zip
54
networkTimeout=10000
65
validateDistributionUrl=true
76
zipStoreBase=GRADLE_USER_HOME

src/main/groovy/nebula/plugin/dependencylock/DependencyLockTaskConfigurer.groovy

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class DependencyLockTaskConfigurer {
158158
//TODO: address Invocation of Task.project at execution time has been deprecated.
159159
DeprecationLogger.whileDisabled {
160160
SaveLockTask globalSave = project.rootProject.tasks.findByName(SAVE_GLOBAL_LOCK_TASK_NAME) as SaveLockTask
161-
if (globalSave?.outputLock?.exists()) {
161+
if (globalSave && globalSave.outputLock && globalSave.outputLock.exists()) {
162162
throw new GradleException('Cannot save individual locks when global lock is in place, run deleteGlobalLock task')
163163
}
164164
}
@@ -276,11 +276,24 @@ class DependencyLockTaskConfigurer {
276276
[project.dependencies.create(subproject)]
277277
}
278278
}.flatten()
279+
280+
281+
// Create a regular configuration instead of a detached one for Gradle 9.x compatibility
282+
// Use a unique name that doesn't conflict with Gradle's reserved names
279283
def subprojectsArray = subprojects.toArray(new Dependency[subprojects.size()])
280-
def conf = project.configurations.detachedConfiguration(subprojectsArray)
281-
project.allprojects.each { it.configurations.add(conf) }
282284

283-
[conf] + lockableConfigurations(project, project, extension.configurationNames, extension.skippedConfigurationNamesPrefixes)
285+
List<Configuration> configurations = []
286+
project.allprojects.each { p->
287+
def conf = p.configurations.create("globalLockConfig${System.currentTimeMillis()}") {
288+
canBeConsumed = true
289+
canBeResolved = true
290+
transitive = true
291+
}
292+
conf.dependencies.addAll(subprojectsArray)
293+
configurations.add(conf)
294+
}
295+
296+
configurations + lockableConfigurations(project, project, extension.configurationNames, extension.skippedConfigurationNamesPrefixes)
284297
}
285298
}
286299
}

src/main/groovy/nebula/plugin/dependencylock/DependencyLockWriter.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class DependencyLockWriter {
3636
}
3737

3838
filteredSkippedDeps.each { key, lock ->
39-
def configuration = key.configuration.startsWith('detachedConfiguration') ? GLOBAL_LOCK_CONFIG : key.configuration
39+
def configuration = key.configuration.startsWith('globalLockConfig') ? GLOBAL_LOCK_CONFIG : key.configuration
4040
def depMap = result[configuration]["${key.group}:${key.artifact}"]
4141
if (lock.locked) {
4242
depMap['locked'] = lock.locked

src/main/groovy/nebula/plugin/dependencylock/tasks/DiffLockTask.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class DiffLockTask extends AbstractLockTask {
3737
@OutputFile
3838
File diffFile = new File(outputDir, "lockdiff.${this.diffFileExtension()}")
3939

40-
private String diffFileExtension() {
40+
String diffFileExtension() {
4141
DependencyLockingFeatureFlags.isPathAwareDependencyDiffEnabled() ? "json" : "txt"
4242
}
4343

@@ -68,7 +68,7 @@ class DiffLockTask extends AbstractLockTask {
6868
}
6969

7070
ConfigurationsSet readLocks(File file) {
71-
if (!(file?.exists())) {
71+
if (!file || !file.exists()) {
7272
return new ConfigurationsSet([:])
7373
}
7474
def contents = new JsonSlurper().parse(file)

src/main/kotlin/nebula/plugin/dependencylock/DependencyLockPlugin.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ class DependencyLockPlugin @Inject constructor(val buildFeatures: BuildFeatures)
153153

154154
// We do this twice to catch resolves that happen during build evaluation, and ensure that we clobber configurations made during evaluation
155155
disableCachingForGenerateLock()
156-
project.gradle.taskGraph.whenReady(groovyClosure {
156+
project.gradle.taskGraph.whenReady {
157157
disableCachingForGenerateLock()
158-
})
158+
}
159159

160160
project.configurations.all({ conf ->
161161
if (lockAfterEvaluating) {

src/main/kotlin/nebula/plugin/dependencylock/gradleInterop.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ inline fun <T> T.groovyClosure(crossinline call: () -> Unit) = object : Closure<
1111
}
1212
}
1313

14-
inline fun <U> Any.action(crossinline call: U.() -> Unit) = Action<U> { call(it) }
14+
inline fun <U : Any> Any.action(crossinline call: U.() -> Unit) = Action<U> { call(it) }
1515

1616
fun Project.findStringProperty(name: String): String? = if (hasProperty(name)) property(name) as String? else null

0 commit comments

Comments
 (0)