Skip to content

Commit 4451f34

Browse files
Upgrade to Gradle 9.2.1, add JDK 25 build, upgrade plugins (#6829)
Upgrades to the current latest version of Gradle, which required upgrading a number of Gradle plugin versions and some build configuration. This unlocks building with JDK 25 but the Gradle JVM itself now requires at least 17. Introduces the `toolchainVersion` property to control what version of the JVM toolchain we use to compile and run tests, separate from the version of the JVM used to run Gradle. Consistently uses JDK 21 to run Gradle because the current Kotlin plugin version does not support running the Gradle JVM with 25. --------- Signed-off-by: Tommy Ludwig <8924140+shakuzen@users.noreply.github.com> Co-authored-by: Jonatan Ivanov <jonatan.ivanov@gmail.com>
1 parent f90c728 commit 4451f34

File tree

21 files changed

+130
-132
lines changed

21 files changed

+130
-132
lines changed

.circleci/config.yml

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,28 @@
11
version: 2.1
22

33
executors:
4-
jdk24-executor:
5-
working_directory: ~/micrometer
6-
environment:
7-
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
8-
resource_class: medium+
9-
docker:
10-
- image: cimg/openjdk:24.0.2
11-
circle-jdk-executor:
12-
working_directory: ~/micrometer
13-
environment:
14-
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx1g -XX:+HeapDumpOnOutOfMemoryError"'
15-
resource_class: medium+
16-
docker:
17-
- image: cimg/openjdk:21.0.8
18-
circle-jdk17-executor:
4+
# TODO: add and use JDK 25 executor when upgrading to a version of the Kotlin plugin that's compatible
5+
# jdk25-executor:
6+
# working_directory: ~/micrometer
7+
# environment:
8+
# GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
9+
# resource_class: medium+
10+
# docker:
11+
# - image: cimg/openjdk:25.0
12+
jdk21-executor:
1913
working_directory: ~/micrometer
2014
environment:
2115
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx1g -XX:+HeapDumpOnOutOfMemoryError"'
2216
resource_class: medium+
2317
docker:
24-
- image: cimg/openjdk:17.0.16
25-
circle-jdk11-executor:
18+
- image: cimg/openjdk:21.0.9
19+
jdk17-executor:
2620
working_directory: ~/micrometer
2721
environment:
2822
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx1g -XX:+HeapDumpOnOutOfMemoryError"'
2923
resource_class: medium+
3024
docker:
31-
- image: cimg/openjdk:11.0.28
25+
- image: cimg/openjdk:17.0.17
3226
machine-executor:
3327
working_directory: ~/micrometer
3428
machine:
@@ -41,6 +35,9 @@ commands:
4135
command:
4236
type: string
4337
default: 'build'
38+
toolchainVersion:
39+
type: string
40+
default: ''
4441
steps:
4542
- checkout
4643
- restore_cache:
@@ -54,7 +51,7 @@ commands:
5451
- ~/.gradle
5552
- run:
5653
name: run gradle command
57-
command: ./gradlew << parameters.command >>
54+
command: ./gradlew << parameters.command >> -PtoolchainVersion=<< parameters.toolchainVersion >>
5855
- run:
5956
name: collect test reports
6057
when: always
@@ -67,32 +64,36 @@ commands:
6764
path: ~/micrometer/test-results/
6865

6966
jobs:
70-
build-jdk24:
71-
executor: jdk24-executor
67+
build-jdk25:
68+
executor: jdk21-executor
7269
steps:
73-
- gradlew-build
74-
- run: ./gradlew generationalShenandoahTest
70+
- gradlew-build:
71+
toolchainVersion: '25'
72+
- run: ./gradlew generationalShenandoahTest -PtoolchainVersion=25
7573

76-
build:
77-
executor: circle-jdk-executor
74+
build-jdk21:
75+
executor: jdk21-executor
7876
steps:
79-
- gradlew-build
80-
- run: ./gradlew shenandoahTest
81-
- run: ./gradlew zgcTest
82-
- run: ./gradlew zgcGenerationalTest
77+
- gradlew-build:
78+
toolchainVersion: '21'
79+
- run: ./gradlew shenandoahTest -PtoolchainVersion=21
80+
- run: ./gradlew zgcTest -PtoolchainVersion=21
81+
- run: ./gradlew zgcGenerationalTest -PtoolchainVersion=21
8382

8483
build-jdk11:
85-
executor: circle-jdk11-executor
84+
executor: jdk21-executor
8685
steps:
87-
- gradlew-build
86+
- gradlew-build:
87+
toolchainVersion: '11'
8888

8989
build-jdk17:
90-
executor: circle-jdk17-executor
90+
executor: jdk17-executor
9191
steps:
92-
- gradlew-build
92+
- gradlew-build:
93+
toolchainVersion: '17'
9394

9495
concurrency-tests:
95-
executor: circle-jdk-executor
96+
executor: jdk21-executor
9697
steps:
9798
- gradlew-build:
9899
command: jcstress
@@ -104,7 +105,7 @@ jobs:
104105
command: dockerTest
105106

106107
deploy:
107-
executor: circle-jdk-executor
108+
executor: jdk21-executor
108109
steps:
109110
- checkout
110111
- restore_cache:
@@ -114,7 +115,7 @@ jobs:
114115
command: sh ./gradle/deploy.sh
115116

116117
stackdriver-it:
117-
executor: circle-jdk-executor
118+
executor: jdk21-executor
118119
steps:
119120
- run:
120121
name: Setup Google Cloud auth
@@ -128,10 +129,10 @@ workflows:
128129
version: 2
129130
build_prs_deploy_snapshots:
130131
jobs:
131-
- build
132132
- build-jdk11
133133
- build-jdk17
134-
- build-jdk24
134+
- build-jdk21
135+
- build-jdk25
135136
- concurrency-tests
136137
- docker-tests
137138
- stackdriver-it:
@@ -146,10 +147,10 @@ workflows:
146147
context:
147148
- deploy
148149
requires:
149-
- build
150150
- build-jdk11
151151
- build-jdk17
152-
- build-jdk24
152+
- build-jdk21
153+
- build-jdk25
153154
- concurrency-tests
154155
- docker-tests
155156
filters:
@@ -159,7 +160,7 @@ workflows:
159160
- /\d+\.\d+\.x/
160161
build_deploy_releases:
161162
jobs:
162-
- build:
163+
- build-jdk21:
163164
filters:
164165
branches:
165166
ignore: /.*/
@@ -177,7 +178,7 @@ workflows:
177178
ignore: /.*/
178179
tags:
179180
only: /^v\d+\.\d+\.\d+(-(RC|M)\d+)?$/
180-
- build-jdk24:
181+
- build-jdk25:
181182
filters:
182183
branches:
183184
ignore: /.*/
@@ -207,10 +208,10 @@ workflows:
207208
context:
208209
- deploy
209210
requires:
210-
- build
211211
- build-jdk11
212212
- build-jdk17
213-
- build-jdk24
213+
- build-jdk21
214+
- build-jdk25
214215
- concurrency-tests
215216
- docker-tests
216217
filters:

benchmarks/benchmarks-core/build.gradle

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,6 @@ compileJava {
1818
options.release = 17
1919
}
2020

21-
// Uncomment as needed for benchmarking against released versions of Micrometer
22-
//repositories {
23-
// mavenCentral()
24-
// maven {
25-
// url "https://repo.spring.io/milestone"
26-
// }
27-
//}
28-
2921
dependencies {
3022
jmh project(':micrometer-core')
3123
// jmh 'io.micrometer:micrometer-core:1.16.0-M2'

build.gradle

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
buildscript {
2-
ext.javaLanguageVersion = JavaLanguageVersion.of(JavaVersion.current().isJava11Compatible() ? JavaVersion.current().getMajorVersion() : 17)
2+
ext.gradleJvmVersion = JavaLanguageVersion.of(JavaVersion.current().getMajorVersion())
3+
ext.javaLanguageVersion = project.hasProperty('toolchainVersion') && project.property('toolchainVersion') != '' ? JavaLanguageVersion.of(project.property('toolchainVersion') as int) : gradleJvmVersion
34
ext.javaTargetVersion = JavaVersion.VERSION_1_8
45

56
repositories {
67
mavenCentral()
78
gradlePluginPortal()
9+
maven {
10+
url = uri("https://bndtools.jfrog.io/bndtools/libs-release")
11+
}
812
}
913

1014
dependencies {
@@ -20,12 +24,7 @@ buildscript {
2024
classpath libs.plugin.japicmp
2125
classpath libs.plugin.downloadTask
2226
classpath libs.plugin.spotless
23-
24-
if (javaLanguageVersion.asInt() < 17) {
25-
classpath libs.plugin.bnd
26-
} else {
27-
classpath libs.plugin.bndForJava17
28-
}
27+
classpath libs.plugin.bnd
2928

3029
constraints {
3130
classpath(libs.asmForPlugins) {
@@ -37,6 +36,10 @@ buildscript {
3736
configurations.classpath.resolutionStrategy.cacheDynamicVersionsFor 0, 'minutes'
3837
}
3938

39+
plugins {
40+
alias(libs.plugins.kotlin) apply false
41+
}
42+
4043
// Hacks because of Antora's clone/checkout/worktrees behavior
4144
// Antora uses shallow-clone and worktrees to check out branches/tags.
4245
if (project.hasProperty('antora')) {
@@ -57,6 +60,8 @@ apply plugin: 'com.netflix.nebula.release'
5760
release.defaultVersionStrategy = nebula.plugin.release.git.opinion.Strategies.SNAPSHOT
5861

5962
apply plugin: 'io.github.gradle-nexus.publish-plugin'
63+
apply plugin: 'com.netflix.nebula.info'
64+
apply plugin: 'com.netflix.nebula.project'
6065

6166
allprojects {
6267
group = 'io.micrometer'
@@ -135,7 +140,7 @@ subprojects {
135140
}
136141
}
137142
}
138-
if ((project.name.contains('samples') && !project.name.contains('kotlin')) || project.name.contains('benchmarks')) {
143+
if ((project.name.contains('samples') && !project.name.contains('kotlin')) || project.name.contains('benchmarks') || project.name.contains('osgi-test')) {
139144
apply plugin: 'java'
140145
} else {
141146
apply plugin: 'java-library'
@@ -164,9 +169,9 @@ subprojects {
164169

165170
toolchain {
166171
languageVersion = javaLanguageVersion
167-
sourceCompatibility = javaTargetVersion
168-
targetCompatibility = javaTargetVersion
169172
}
173+
sourceCompatibility = javaTargetVersion
174+
targetCompatibility = javaTargetVersion
170175
}
171176

172177
// Dependencies for all projects that are not transitive to consumers of our modules
@@ -399,7 +404,7 @@ subprojects {
399404
tasks.register("testModules", Exec) {
400405
dependsOn jar
401406
String executablePath = javaToolchains.launcherFor { languageVersion = javaLanguageVersion }.get().executablePath
402-
commandLine "$executablePath", '-p', "$jar.archivePath", '--list-modules'
407+
commandLine "$executablePath", '-p', "$jar.archiveFile", '--list-modules'
403408
standardOutput = new ByteArrayOutputStream()
404409
ignoreExitValue = true
405410

@@ -477,6 +482,10 @@ subprojects {
477482
moniker 'Tommy Ludwig'
478483
github 'shakuzen'
479484
}
485+
'jivanov@vmware.com' {
486+
moniker 'Jonatan Ivanov'
487+
github 'jonatan-ivanov'
488+
}
480489
}
481490
}
482491

@@ -502,7 +511,7 @@ nexusPublishing {
502511
}
503512

504513
wrapper {
505-
gradleVersion = '8.14.3'
514+
gradleVersion = '9.2.1'
506515
}
507516

508517
defaultTasks 'build'

docs/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ tasks.named('generateAntoraYml') {
9393
}
9494
}
9595

96-
tasks.create('generateAntoraResources') {
96+
tasks.register('generateAntoraResources') {
9797
dependsOn 'generateAntoraYml'
9898
}
9999

gradle/libs.versions.toml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ mongo = "4.11.5"
5959
netty = "4.2.7.Final"
6060
newrelic-api = "5.14.0"
6161
# Kotlin 1.7 sample will fail from OkHttp 4.12.0 due to okio dependency being a Kotlin 1.9 module
62-
okhttp = "4.11.0"
62+
okhttp = "4.12.0"
6363
postgre = "42.7.8"
6464
prometheus = "1.4.3"
6565
prometheusSimpleClient = "0.16.0"
@@ -216,21 +216,19 @@ wiremockJunit5 = { module = "ru.lanwen.wiremock:wiremock-junit5", version.ref =
216216
# plugin dependencies
217217
plugin-errorprone = { module = "net.ltgt.errorprone:net.ltgt.errorprone.gradle.plugin", version = "4.3.0" }
218218
plugin-license = { module = "gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin", version = "0.16.1" }
219-
plugin-nebulaRelease = { module = "com.netflix.nebula:nebula-release-plugin", version = "18.0.8" }
220-
plugin-nebulaPublishing = { module = "com.netflix.nebula:nebula-publishing-plugin", version = "20.3.0" }
221-
plugin-nebulaProject = { module = "com.netflix.nebula:nebula-project-plugin", version = "10.1.5" }
222-
plugin-nebulaInfo = { module = "com.netflix.nebula:gradle-info-plugin", version = "12.1.6" }
219+
plugin-nebulaRelease = { module = "com.netflix.nebula:nebula-release-plugin", version = "21.0.0" }
220+
plugin-nebulaPublishing = { module = "com.netflix.nebula:nebula-publishing-plugin", version = "23.0.0" }
221+
plugin-nebulaProject = { module = "com.netflix.nebula:nebula-project-plugin", version = "13.0.0" }
222+
plugin-nebulaInfo = { module = "com.netflix.nebula:gradle-info-plugin", version = "16.0.0" }
223223
plugin-noHttp = { module = "io.spring.nohttp:nohttp-gradle", version = "0.0.11" }
224-
plugin-nexusPublish = { module = "io.github.gradle-nexus:publish-plugin", version = "1.3.0" }
224+
plugin-nexusPublish = { module = "io.github.gradle-nexus:publish-plugin", version = "2.0.0" }
225225
plugin-javaformat = { module = "io.spring.javaformat:spring-javaformat-gradle-plugin", version.ref = "spring-javaformat" }
226226
plugin-japicmp = { module = "me.champeau.gradle:japicmp-gradle-plugin", version = "0.4.6" }
227227
plugin-downloadTask = { module = "de.undercouch:gradle-download-task", version = "5.6.0" }
228228
plugin-spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", version = "6.25.0" }
229-
plugin-bnd = "biz.aQute.bnd:biz.aQute.bnd.gradle:6.4.0"
230-
plugin-bndForJava17 = "biz.aQute.bnd:biz.aQute.bnd.gradle:7.1.0"
229+
plugin-bnd = "biz.aQute.bnd:biz.aQute.bnd.gradle:7.2.0-RC3"
231230

232231
[plugins]
233-
kotlin19 = { id = "org.jetbrains.kotlin.jvm", version = "1.9.25" }
234-
kotlin17 = { id = "org.jetbrains.kotlin.jvm", version = "1.7.22" }
232+
kotlin = { id = "org.jetbrains.kotlin.jvm", version = "2.2.21" }
235233
jcstress = { id = "io.github.reyerizo.gradle.jcstress", version = "0.9.0" }
236234
aspectj = { id = 'io.freefair.aspectj.post-compile-weaving', version = '8.14.3' }

gradle/wrapper/gradle-wrapper.jar

1.83 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 1 addition & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)