-
Notifications
You must be signed in to change notification settings - Fork 1.1k
WIP Gradle 9 upgrade #6829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
WIP Gradle 9 upgrade #6829
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| buildscript { | ||
| ext.javaLanguageVersion = JavaLanguageVersion.of(JavaVersion.current().isJava11Compatible() ? JavaVersion.current().getMajorVersion() : 17) | ||
| ext.gradleJvmVersion = JavaLanguageVersion.of(JavaVersion.current().getMajorVersion()) | ||
| ext.javaLanguageVersion = project.hasProperty('toolchainVersion') && project.property('toolchainVersion') != '' ? JavaLanguageVersion.of(project.property('toolchainVersion') as int) : gradleJvmVersion | ||
| ext.javaTargetVersion = JavaVersion.VERSION_1_8 | ||
|
|
||
| repositories { | ||
|
|
@@ -20,12 +21,7 @@ buildscript { | |
| classpath libs.plugin.japicmp | ||
| classpath libs.plugin.downloadTask | ||
| classpath libs.plugin.spotless | ||
|
|
||
| if (javaLanguageVersion.asInt() < 17) { | ||
| classpath libs.plugin.bnd | ||
| } else { | ||
| classpath libs.plugin.bndForJava17 | ||
| } | ||
| classpath libs.plugin.bnd | ||
|
|
||
| constraints { | ||
| classpath(libs.asmForPlugins) { | ||
|
|
@@ -164,9 +160,9 @@ subprojects { | |
|
|
||
| toolchain { | ||
| languageVersion = javaLanguageVersion | ||
| sourceCompatibility = javaTargetVersion | ||
| targetCompatibility = javaTargetVersion | ||
| } | ||
| sourceCompatibility = javaTargetVersion | ||
| targetCompatibility = javaTargetVersion | ||
| } | ||
|
|
||
| // Dependencies for all projects that are not transitive to consumers of our modules | ||
|
|
@@ -373,11 +369,9 @@ subprojects { | |
| apply plugin: 'com.netflix.nebula.maven-apache-license' | ||
| apply plugin: 'com.netflix.nebula.publish-verification' | ||
| apply plugin: 'com.netflix.nebula.contacts' | ||
| apply plugin: 'com.netflix.nebula.info' | ||
| apply plugin: 'com.netflix.nebula.project' | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I stopped applying these because I would get an error like the following, which occurred at the line applying either of these plugins: I could not find anything in the release notes for the plugins about this, but I did find this https://github.com/palantir/gradle-external-publish-plugin/pull/641/files, which seems to indicate we don't need to apply these anymore when applying the maven-publish plugin, which we do before this. We should confirm we are not missing any functionality we had before. |
||
|
|
||
| if (project.name != 'micrometer-bom') { | ||
| apply plugin: 'biz.aQute.bnd.builder' | ||
| // apply plugin: 'biz.aQute.bnd.builder' | ||
|
|
||
| jar { | ||
| manifest.attributes.put('Automatic-Module-Name', project.name.replace('-', '.')) | ||
|
|
@@ -386,20 +380,20 @@ subprojects { | |
| from "$rootDir/NOTICE" | ||
| } | ||
|
|
||
| bundle { | ||
| // workaround for multi-version JARs | ||
| // see https://github.com/bndtools/bnd/issues/2227 | ||
| bnd '''\ | ||
| -fixupmessages: '^Classes found in the wrong directory: .*' | ||
| -exportcontents: io.micrometer.* | ||
| '''.stripIndent() | ||
| } | ||
| // bundle { | ||
| // // workaround for multi-version JARs | ||
| // // see https://github.com/bndtools/bnd/issues/2227 | ||
| // bnd '''\ | ||
| // -fixupmessages: '^Classes found in the wrong directory: .*' | ||
| // -exportcontents: io.micrometer.* | ||
| // '''.stripIndent() | ||
| // } | ||
| } | ||
|
|
||
| tasks.register("testModules", Exec) { | ||
| dependsOn jar | ||
| String executablePath = javaToolchains.launcherFor { languageVersion = javaLanguageVersion }.get().executablePath | ||
| commandLine "$executablePath", '-p', "$jar.archivePath", '--list-modules' | ||
| commandLine "$executablePath", '-p', "$jar.archiveFile", '--list-modules' | ||
| standardOutput = new ByteArrayOutputStream() | ||
| ignoreExitValue = true | ||
|
|
||
|
|
@@ -502,7 +496,7 @@ nexusPublishing { | |
| } | ||
|
|
||
| wrapper { | ||
| gradleVersion = '8.14.3' | ||
| gradleVersion = '9.1.0' | ||
| } | ||
|
|
||
| defaultTasks 'build' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| plugins { | ||
| id 'com.gradleup.shadow' version '8.3.6' | ||
| id 'com.gradleup.shadow' version '8.3.9' | ||
| } | ||
|
|
||
| dependencies { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume the condition here is about the version of the JVM used to run Gradle since this is a dependency for the buildscript (Gradle plugin), and since Gradle 9 requires 17, we don't need such conditionals anymore. I think there may be other places we can simplify things as well. I've also added a
gradleJvmVersionvariable we can use if we do need to do something conditional on the version of the JVM that Gradle is using.