Skip to content

Commit 19e04e8

Browse files
authored
Migrate to Gradle 9.x (#432)
1 parent aae945b commit 19e04e8

26 files changed

+137
-675
lines changed

build.gradle

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ buildscript {
2525
}
2626

2727
plugins {
28-
id 'com.netflix.nebula.plugin-plugin' version '21.3.3'
29-
id "org.jetbrains.kotlin.jvm" version '2.1.0'
30-
id("com.gradleup.shadow") version "9.0.0-beta1"
28+
id 'com.netflix.nebula.plugin-plugin' version '22.0.2'
29+
id "org.jetbrains.kotlin.jvm" version '2.2.0'
30+
id("com.gradleup.shadow") version "9.0.0-beta7"
3131
id 'java-gradle-plugin'
3232
}
3333

@@ -61,11 +61,10 @@ configurations.all {
6161
}
6262

6363
dependencies {
64-
compileOnly 'dev.gradleplugins:gradle-api:7.6'
6564
shadow 'com.netflix.nebula:nebula-gradle-interop:latest.release'
6665
shadow 'org.apache.maven:maven-model-builder:3.8.3'
6766
shadow 'org.codehaus.gpars:gpars:1.2.1'
68-
plugin 'com.google.guava:guava:33.4.8-jre'
67+
plugin 'com.google.guava:guava:33.4.8-jre'
6968
plugin('org.ow2.asm:asm:9.+') {
7069
version {
7170
reject '7.2-beta'
@@ -78,19 +77,19 @@ dependencies {
7877
because 'avoid getting prerelease versions'
7978
}
8079
}
81-
plugin('org.codenarc:CodeNarc:2.0.0') {
80+
plugin('org.codenarc:CodeNarc:3.6.0-groovy-4.0') {
8281
transitive = false
8382
}
8483
plugin 'commons-lang:commons-lang:2.6'
8584

86-
plugin ("org.eclipse.jgit:org.eclipse.jgit:$jgitVersion") {
85+
plugin("org.eclipse.jgit:org.eclipse.jgit:$jgitVersion") {
8786
transitive = false
8887
}
8988
plugin 'org.eclipse.jdt:core:3.3.0-v_771'
9089

91-
compileOnly "com.netflix.nebula:nebula-test:10.+"
90+
compileOnly "com.netflix.nebula:nebula-test:11.+"
9291

93-
testImplementation 'org.ow2.asm:asm-util:9.7.1'
92+
testImplementation 'org.ow2.asm:asm-util:9.8'
9493
testImplementation 'joda-time:joda-time:latest.release'
9594
testImplementation 'com.netflix.nebula:gradle-info-plugin:latest.release'
9695
}
@@ -153,7 +152,7 @@ jar.dependsOn shadowJar
153152

154153
java {
155154
toolchain {
156-
languageVersion.set(JavaLanguageVersion.of(8))
155+
languageVersion.set(JavaLanguageVersion.of(17))
157156
}
158157
}
159158

gradle.lockfile

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,28 @@ com.google.j2objc:j2objc-annotations:3.0.0=compileClasspath,runtimeClasspath,tes
1010
com.jcraft:jzlib:1.1.2=integTestRuntimeClasspath,testRuntimeClasspath
1111
com.netflix.nebula:gradle-contacts-plugin:7.0.1=integTestRuntimeClasspath,testRuntimeClasspath
1212
com.netflix.nebula:gradle-info-plugin:14.0.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
13-
com.netflix.nebula:nebula-gradle-interop:2.3.0=compileClasspath,integTestRuntimeClasspath,runtimeClasspath,shadow,testCompileClasspath,testRuntimeClasspath
14-
com.netflix.nebula:nebula-test:10.6.2=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
13+
com.netflix.nebula:nebula-gradle-interop:2.3.0=integTestRuntimeClasspath
14+
com.netflix.nebula:nebula-gradle-interop:3.0.0=compileClasspath,runtimeClasspath,shadow,testCompileClasspath,testRuntimeClasspath
15+
com.netflix.nebula:nebula-test:11.0.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
1516
com.perforce:p4java:2015.2.1365273=integTestRuntimeClasspath,testRuntimeClasspath
1617
commons-lang:commons-lang:2.6=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
17-
dev.gradleplugins:gradle-api:7.6=compileClasspath
1818
javax.inject:javax.inject:1=compileClasspath,runtimeClasspath,shadow,testCompileClasspath,testRuntimeClasspath
1919
joda-time:joda-time:2.14.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
2020
junit:junit:4.13.2=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
2121
net.java.dev.jna:jna-platform:5.16.0=integTestRuntimeClasspath,testRuntimeClasspath
2222
net.java.dev.jna:jna:5.16.0=integTestRuntimeClasspath,testRuntimeClasspath
2323
org.apache.commons:commons-lang3:3.8.1=compileClasspath,runtimeClasspath,shadow,testCompileClasspath,testRuntimeClasspath
24+
org.apache.groovy:groovy:4.0.4=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
2425
org.apache.maven:maven-artifact:3.8.3=compileClasspath,runtimeClasspath,shadow,testCompileClasspath,testRuntimeClasspath
2526
org.apache.maven:maven-builder-support:3.8.3=compileClasspath,runtimeClasspath,shadow,testCompileClasspath,testRuntimeClasspath
2627
org.apache.maven:maven-model-builder:3.8.3=compileClasspath,runtimeClasspath,shadow,testCompileClasspath,testRuntimeClasspath
2728
org.apache.maven:maven-model:3.8.3=compileClasspath,runtimeClasspath,shadow,testCompileClasspath,testRuntimeClasspath
2829
org.apiguardian:apiguardian-api:1.1.2=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
2930
org.codehaus.gpars:gpars:1.2.1=compileClasspath,runtimeClasspath,shadow,testCompileClasspath,testRuntimeClasspath
30-
org.codehaus.groovy:groovy:3.0.12=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
31-
org.codehaus.groovy:groovy:3.0.13=compileClasspath
3231
org.codehaus.jsr166-mirror:jsr166y:1.7.0=compileClasspath,runtimeClasspath,shadow,testCompileClasspath,testRuntimeClasspath
3332
org.codehaus.plexus:plexus-interpolation:1.26=compileClasspath,runtimeClasspath,shadow,testCompileClasspath,testRuntimeClasspath
3433
org.codehaus.plexus:plexus-utils:3.3.0=compileClasspath,runtimeClasspath,shadow,testCompileClasspath,testRuntimeClasspath
35-
org.codenarc:CodeNarc:2.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
34+
org.codenarc:CodeNarc:3.6.0-groovy-4.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
3635
org.eclipse.core:commands:3.3.0-I20070605-0010=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
3736
org.eclipse.core:contenttype:3.4.200-v20140207-1251=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
3837
org.eclipse.core:expressions:3.3.0-v20070606-0010=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
@@ -51,21 +50,20 @@ org.eclipse:osgi:3.10.0-v20140606-1445=compileClasspath,runtimeClasspath,testCom
5150
org.eclipse:text:3.3.0-v20070606-0010=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
5251
org.hamcrest:hamcrest-core:1.3=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
5352
org.hamcrest:hamcrest:2.2=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
54-
org.jetbrains.kotlin:kotlin-stdlib:2.1.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,shadow,testCompileClasspath,testRuntimeClasspath
53+
org.jetbrains.kotlin:kotlin-stdlib:2.2.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,shadow,testCompileClasspath,testRuntimeClasspath
5554
org.jetbrains:annotations:13.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,shadow,testCompileClasspath,testRuntimeClasspath
5655
org.jspecify:jspecify:1.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
57-
org.junit.platform:junit-platform-commons:1.9.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
58-
org.junit.platform:junit-platform-engine:1.9.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
56+
org.junit.platform:junit-platform-commons:1.13.1=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
57+
org.junit.platform:junit-platform-engine:1.13.1=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
58+
org.junit.platform:junit-platform-launcher:1.13.1=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
5959
org.multiverse:multiverse-core:0.7.0=compileClasspath,runtimeClasspath,shadow,testCompileClasspath,testRuntimeClasspath
6060
org.objenesis:objenesis:2.4=integTestRuntimeClasspath,testRuntimeClasspath
61-
org.opentest4j:opentest4j:1.2.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
62-
org.ow2.asm:asm-analysis:9.7.1=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
61+
org.opentest4j:opentest4j:1.3.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
62+
org.ow2.asm:asm-analysis:9.8=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
6363
org.ow2.asm:asm-commons:9.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
64-
org.ow2.asm:asm-tree:9.7.1=integTestCompileClasspath,integTestRuntimeClasspath
65-
org.ow2.asm:asm-tree:9.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
66-
org.ow2.asm:asm-util:9.7.1=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
67-
org.ow2.asm:asm:9.7.1=integTestCompileClasspath,integTestRuntimeClasspath
68-
org.ow2.asm:asm:9.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
69-
org.spockframework:spock-core:2.3-groovy-3.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
70-
org.spockframework:spock-junit4:2.3-groovy-3.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
64+
org.ow2.asm:asm-tree:9.8=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
65+
org.ow2.asm:asm-util:9.8=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
66+
org.ow2.asm:asm:9.8=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
67+
org.spockframework:spock-core:2.3-groovy-4.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
68+
org.spockframework:spock-junit4:2.3-groovy-4.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
7169
empty=annotationProcessor,compile,integTestAnnotationProcessor,integTestCompile,integTestCompileOnly,integTestRuntime,runtime,testAnnotationProcessor,testCompile,testCompileOnly,testRuntime

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

settings.gradle

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
plugins {
2-
id 'com.gradle.enterprise' version '3.8.1'
2+
id "com.gradle.develocity" version "4.0.2"
33
}
44

5-
gradleEnterprise {
5+
develocity {
66
buildScan {
7-
publishAlways()
8-
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
9-
termsOfServiceAgree = 'yes'
7+
termsOfUseUrl = 'https://gradle.com/terms-of-service'
8+
termsOfUseAgree = 'yes'
109
}
1110
}
1211

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,15 @@
11
package com.netflix.nebula.lint
22

33
import org.gradle.api.Project
4-
import org.gradle.api.plugins.JavaPluginConvention
54
import org.gradle.api.plugins.JavaPluginExtension
65
import org.gradle.api.tasks.SourceSetContainer
7-
import org.gradle.util.GradleVersion
86

97
class SourceSetUtils {
108
static boolean hasSourceSets(Project project) {
11-
if (isOlderThanGradle7_1(project)) {
12-
return project.convention.findPlugin(JavaPluginConvention)
13-
} else {
14-
return project.extensions.findByType(JavaPluginExtension)
15-
}
9+
return project.extensions.findByType(JavaPluginExtension)
1610
}
1711

1812
static SourceSetContainer getSourceSets(Project project) {
19-
return isOlderThanGradle7_1(project) ? project.convention.getPlugin(JavaPluginConvention).sourceSets : project.extensions.getByType(JavaPluginExtension).sourceSets
20-
}
21-
22-
private static boolean isOlderThanGradle7_1(Project project) {
23-
return GradleVersion.version(project.gradle.gradleVersion).compareTo(GradleVersion.version("7.1")) < 0
13+
return project.extensions.getByType(JavaPluginExtension).sourceSets
2414
}
2515
}

src/main/groovy/com/netflix/nebula/lint/plugin/AppliedFilesAstVisitor.groovy

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@ class AppliedFilesAstVisitor extends ClassCodeVisitorSupport {
2020
this.project = project
2121
projectVariablesMapping = [
2222
"\$projectDir" : project.projectDir.toString(),
23+
"\${projectDir}" : project.projectDir.toString(),
2324
"\$project.projectDir" : project.projectDir.toString(),
25+
"\${project.projectDir}" : project.projectDir.toString(),
2426
"\$rootDir" : project.rootDir.toString(),
27+
"\${rootDir}" : project.rootDir.toString(),
2528
"\$project.rootDir" : project.rootDir.toString(),
29+
"\${project.rootDir}" : project.rootDir.toString(),
2630
]
2731
}
2832

@@ -31,7 +35,7 @@ class AppliedFilesAstVisitor extends ClassCodeVisitorSupport {
3135
//handle if path contains ${rootDir} ${project.rootDir} ${projectDir} ${project.projectDir}
3236
def projectVariable = projectVariablesMapping.find {from.contains(it.key) }
3337
if (projectVariable) {
34-
def absolutePath = from.replaceAll("\\$projectVariable.key", projectVariable.value)
38+
def absolutePath = from.replace(projectVariable.key, projectVariable.value)
3539
appliedFiles.addAll(SourceCollector.getAllFiles(new File(absolutePath), project))
3640
} else {
3741
appliedFiles.addAll(SourceCollector.getAllFiles(new File(project.projectDir, from), project))

src/main/groovy/com/netflix/nebula/lint/plugin/LintService.groovy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ class LintService {
5959

6060
violations.groupBy { it.file }.each { file, fileViolations ->
6161
results.addChild(new FileResults(file.absolutePath, fileViolations))
62-
results.numberOfFilesInThisDirectory++
6362
}
6463

6564
resultsForRootProject

src/main/groovy/com/netflix/nebula/lint/plugin/report/LintReport.groovy

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import org.gradle.util.internal.ClosureBackedAction
2020

2121
import javax.annotation.Nullable
2222
import javax.inject.Inject
23+
import java.lang.reflect.InvocationTargetException
2324

2425
abstract class LintReport implements SingleFileReport,
2526
CustomizableHtmlReport {
@@ -140,7 +141,16 @@ abstract class LintReport implements SingleFileReport,
140141
abstract AbstractReportWriter getWriter()
141142

142143
void write(AnalysisContext analysisContext, Results results) {
143-
writer.writeReport(analysisContext, results)
144+
def writer = getWriter()
145+
def outputFile = outputLocation.get().asFile
146+
147+
// Ensure parent directory exists
148+
outputFile.parentFile.mkdirs()
149+
150+
// Use the 3-parameter writeReport method that takes a Writer
151+
outputFile.withWriter { fileWriter ->
152+
writer.writeReport(fileWriter, analysisContext, results)
153+
}
144154
}
145155

146156
/**

src/main/groovy/com/netflix/nebula/lint/plugin/report/internal/LintHtmlReport.groovy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ abstract class LintHtmlReport extends LintReport {
2222

2323
@Override
2424
AbstractReportWriter getWriter() {
25-
return new HtmlReportWriter(outputFile: outputLocation.get().asFile)
25+
def writer = new HtmlReportWriter()
26+
writer.outputFile = outputLocation.get().asFile
27+
return writer
2628
}
2729
}

src/main/groovy/com/netflix/nebula/lint/plugin/report/internal/LintTextReport.groovy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ abstract class LintTextReport extends LintReport {
2222

2323
@Override
2424
AbstractReportWriter getWriter() {
25-
return new TextReportWriter(outputFile: outputLocation.get().asFile)
25+
def writer = new TextReportWriter()
26+
writer.outputFile = outputLocation.get().asFile
27+
return writer
2628
}
2729
}

0 commit comments

Comments
 (0)