Skip to content

Update build scripts to Gradle 9.4.1 from 8.14.4 - #11272

Closed
AlexeyKuznetsov-DD wants to merge 5 commits into
masterfrom
alexeyk/gradle-9
Closed

Update build scripts to Gradle 9.4.1 from 8.14.4#11272
AlexeyKuznetsov-DD wants to merge 5 commits into
masterfrom
alexeyk/gradle-9

Conversation

@AlexeyKuznetsov-DD

Copy link
Copy Markdown
Contributor

DO NOT MERGE, experimenting

What Does This Do

Motivation

Additional Notes

Contributor Checklist

Jira ticket: [PROJ-IDENT]

Note:Once your PR is ready to merge, add it to the merge queue by commenting /merge./merge -c cancels the queue request. /merge -f --reason "reason" skips all merge queue checks; please use this judiciously, as some checks do not run at the PR-level. For more information, see this doc.

@bric3bric3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only reviewed commit 1274a6f, there's some nice fixes, and ideas that align with previous work in #10402, there's also fixes that I don't think are useful for Gradle 9 migration like:

- def javaDir = buildDir.toPath().resolve("generated/sources/tries/java/${sourceSetName}")+ def javaDir = project.layout.buildDirectory.dir("generated/sources/tries/java/${sourceSetName}")

This commit alone touches a lot of files. Some changes can be split to smaller PRs.

I'm weighing on toggling off failOnNoDiscoveredTests, maybe there's some "file" detection to add in the addTestSuite methods.

Comment threaddd-java-agent/agent-iast/build.gradle Outdated
Comment threaddd-java-agent/agent-jmxfetch/build.gradle
testJvmConstraints {
minJavaVersion = JavaVersion.VERSION_21
}
failOnNoDiscoveredTests = false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: I've seen this as well albeit not when trying Gradle 9.3 on dd-trace-java, IIRC... I think a better solution is to add that flag within the logic of addTestSuiteExtendingForDir, addTestSuiteForDir, this could prevent adding this every time these test suite methods are used.

// dependency 'log4j-over-slf4j' brought in by :dd-java-agent:testing which would shadow
// the log4j module under test using a proxy to slf4j instead.
testCompile.exclude group: 'org.slf4j', module: 'log4j-over-slf4j'
testImplementation.exclude group: 'org.slf4j', module: 'log4j-over-slf4j'

@bric3bric3May 5, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: What was the problem with testCompile ?

Comment on lines +4 to +11
// Gradle 9 daemon JVM is JDK 17, but this WAR is deployed to a WildFly server
// that may run on Java 8 (testJvmConstraints maxJavaVersion=11). Pin a Java 8
// toolchain so the produced bytecode loads on the lowest supported test JVM.
java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: interesting 🤔

Comment on lines +56 to +70
// define the task that builds the EAR via a sub-Gradle invocation.
//
// The sub-build inherits this project's wrapper (Gradle 9.4.1), whose daemon
// requires JDK 17 — that's why JAVA_HOME is 17, not the test runtime version.
// The deployed WAR's compile target is pinned separately in
// spring-ear/war/build.gradle via a Java toolchain.
tasks.register('earBuild', Exec) {
workingDir "$appDir"
environment += [
"GRADLE_OPTS": "-Dorg.gradle.jvmargs='-Xmx512M'",
"JAVA_HOME": getLazyJavaHomeFor(8)
"JAVA_HOME": getLazyJavaHomeFor(17)
]
commandLine "$rootDir/${gradlewCommand}", "assemble", "--no-daemon", "--max-workers=4", "-PappBuildDir=$appBuildDir", "-PapiJar=${project(':dd-trace-api').tasks.jar.archiveFile.get()}"
commandLine "$rootDir/${gradlewCommand}", "assemble", "--no-daemon", "--max-workers=4",
"-PappBuildDir=${appBuildDir.get().asFile.absolutePath}",
"-PapiJar=${project(':dd-trace-api').tasks.jar.archiveFile.get().asFile.absolutePath}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: We may need a more general way to invoke Gradle for sub projects. Actually, even relying on an older Gradle distribution is on the table.

Comment threadgradle/publish.gradle Outdated

project.configurations.api.allDependencies.each {
if ((it instanceof ProjectDependency) || !(it instanceof SelfResolvingDependency)) {
if (it instanceof ModuleDependency) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion:

Suggested change
if (it instanceofModuleDependency) {
if (it instanceofProjectDependency||it instanceofExternalModuleDependency) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handled in #11340

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Let's avoid again another script plugin, this could be a correct convention plugin dedicated for smoke tests.

Also, spring-boot-plugin.gradle and this can be "merged" as a single plugin.

Comment threadgradle/version.gradle Outdated
Comment on lines +16 to +20
def stderr = new ByteArrayOutputStream()
def process = new ProcessBuilder('git', 'rev-parse', '--short', 'HEAD').start()
process.waitForProcessOutput(stdout, stderr)
if (process.exitValue() != 0) {
throw new GradleException("Unable to determine git hash: ${stderr.toString().trim()}")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: this is the wrong fix

@bric3

bric3 commented May 5, 2026

Copy link
Copy Markdown
Contributor

Also, did bumping to Groovy 4 was needed to make everything work ?

@AlexeyKuznetsov-DD

Copy link
Copy Markdown
ContributorAuthor

Also, did bumping to Groovy 4 was needed to make everything work ?

@bric3 If I recall correctly I have to bump codenark and also smoke tests for gradle are using gradleTestKit()
But probably we can keep Groovy 3 with manual override where needed.

# Conflicts:
#	buildSrc/src/main/kotlin/datadog/gradle/plugin/testJvmConstraints/TestJvmSpec.kt
#	dd-java-agent/agent-iast/build.gradle
#	dd-java-agent/ddprof-lib/gradle.lockfile
#	dd-java-agent/instrumentation/armeria/armeria-grpc-0.84/build.gradle
#	dd-java-agent/instrumentation/aws-java/aws-java-dynamodb-2.0/gradle.lockfile
#	dd-java-agent/instrumentation/aws-java/aws-java-eventbridge-2.0/gradle.lockfile
#	dd-java-agent/instrumentation/aws-java/aws-java-s3-2.0/gradle.lockfile
#	dd-java-agent/instrumentation/aws-java/aws-java-sdk-2.2/gradle.lockfile
#	dd-java-agent/instrumentation/aws-java/aws-java-sfn-2.0/gradle.lockfile
#	dd-java-agent/instrumentation/aws-java/aws-java-sns-2.0/gradle.lockfile
#	dd-java-agent/instrumentation/drools/drools-6.0/gradle.lockfile
#	dd-java-agent/instrumentation/google-pubsub-1.116/gradle.lockfile
#	dd-java-agent/instrumentation/grizzly/grizzly-client-1.9/gradle.lockfile
#	dd-java-agent/instrumentation/grpc-1.5/build.gradle
#	dd-java-agent/instrumentation/grpc-1.5/gradle.lockfile
#	dd-java-agent/instrumentation/ignite-2.0/gradle.lockfile
#	dd-java-agent/instrumentation/jackson-core/jackson-core-2.16/gradle.lockfile
#	dd-java-agent/instrumentation/jackson-core/jackson-core-common/gradle.lockfile
#	dd-java-agent/instrumentation/jetty/jetty-client/jetty-client-12.0/gradle.lockfile
#	dd-java-agent/instrumentation/jetty/jetty-server/jetty-server-12.0/gradle.lockfile
#	dd-java-agent/instrumentation/junit/junit-5/junit-5.3/gradle.lockfile
#	dd-java-agent/instrumentation/karate-1.0/gradle.lockfile
#	dd-java-agent/instrumentation/micronaut/micronaut-http-server-netty/micronaut-http-server-netty-4.0/gradle.lockfile
#	dd-java-agent/instrumentation/mule-4.5/gradle.lockfile
#	dd-java-agent/instrumentation/openai-java/openai-java-3.0/gradle.lockfile
#	dd-java-agent/instrumentation/protobuf-3.0/build.gradle
#	dd-smoke-tests/armeria-grpc/application/build.gradle
#	dd-smoke-tests/armeria-grpc/build.gradle
#	dd-smoke-tests/grpc-1.5/build.gradle
#	dd-smoke-tests/log-injection/gradle.lockfile
#	dd-smoke-tests/osgi/build.gradle
#	dd-smoke-tests/springboot-grpc/build.gradle
#	dd-trace-core/src/test/groovy/datadog/trace/core/DDSpanTest.groovy
#	gradle/publish.gradle
#	gradle/version.gradle
#	gradle/wrapper/gradle-wrapper.properties
@pr-commenter

Copy link
Copy Markdown

Debugger benchmarks

Parameters

BaselineCandidate
baseline_or_candidatebaselinecandidate
ci_job_date17788154591778815808
end_time2026-05-15T03:25:492026-05-15T03:31:38
git_branchmasteralexeyk/gradle-9
git_commit_sha4d1d5b2f1b4fc8c70
start_time2026-05-15T03:24:202026-05-15T03:30:09
See matching parameters
BaselineCandidate
ci_job_id16849806561684980656
ci_pipeline_id113317592113317592
cpu_modelIntel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHzIntel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz
git_commit_date17788145601778814560

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 9 metrics, 6 unstable metrics.

See unchanged results
scenarioΔ mean agg_http_req_duration_minΔ mean agg_http_req_duration_p50Δ mean agg_http_req_duration_p75Δ mean agg_http_req_duration_p99Δ mean throughput
scenario:noprobeunstable
[-30.422µs; +18.851µs] or [-9.669%; +5.991%]
unstable
[-42.384µs; +29.226µs] or [-11.720%; +8.082%]
unstable
[-56.388µs; +39.612µs] or [-14.850%; +10.432%]
unstable
[-70.049µs; +147.891µs] or [-5.683%; +11.999%]
same
scenario:basicsamesamesameunstable
[-133.127µs; +8.306µs] or [-11.735%; +0.732%]
unstable
[-139.919op/s; +139.919op/s] or [-5.877%; +5.877%]
scenario:loopunsure
[-7.810µs; -0.828µs] or [-0.088%; -0.009%]
unsure
[-18.661µs; -3.379µs] or [-0.207%; -0.037%]
unsure
[-22.217µs; -8.416µs] or [-0.242%; -0.092%]
samesame
Request duration reports for reports
gantt
title reports - request duration [CI 0.99] : candidate=None, baseline=None
dateFormat X
axisFormat %s
section baseline
noprobe (361.646 µs) : 322, 401
. : milestone, 362,
basic (311.549 µs) : 303, 321
. : milestone, 312,
loop (9.011 ms) : 9003, 9018
. : milestone, 9011,
section candidate
noprobe (355.067 µs) : 328, 382
. : milestone, 355,
basic (310.045 µs) : 302, 318
. : milestone, 310,
loop (9.0 ms) : 8993, 9007
. : milestone, 9000,
Loading
  • baseline results
ScenarioRequest median duration [CI 0.99]
noprobe361.646 µs [321.812 µs, 401.48 µs]
basic311.549 µs [302.594 µs, 320.503 µs]
loop9.011 ms [9.003 ms, 9.018 ms]
  • candidate results
ScenarioRequest median duration [CI 0.99]
noprobe355.067 µs [328.131 µs, 382.003 µs]
basic310.045 µs [302.009 µs, 318.08 µs]
loop9.0 ms [8.993 ms, 9.007 ms]

@pr-commenter

Copy link
Copy Markdown

Kafka / producer-benchmark

Parameters

BaselineCandidate
baseline_or_candidatebaselinecandidate
git_branchmasteralexeyk/gradle-9
git_commit_date17787895951778814560
git_commit_shab4d1d5b4fc8c70
See matching parameters
BaselineCandidate
ci_job_date17788157691778815769
ci_job_id16849806541684980654
ci_pipeline_id113317592113317592
cpu_modelIntel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHzIntel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
jdkVersion11.0.2511.0.25
jmhVersion1.361.36
jvm/usr/lib/jvm/java-11-openjdk-amd64/bin/java/usr/lib/jvm/java-11-openjdk-amd64/bin/java
jvmArgs-Dfile.encoding=UTF-8 -Djava.io.tmpdir=/go/src/github.com/DataDog/apm-reliability/dd-trace-java/platform/src/producer-benchmark/build/tmp/jmh -Duser.country=US -Duser.language=en -Duser.variant-Dfile.encoding=UTF-8 -Djava.io.tmpdir=/go/src/github.com/DataDog/apm-reliability/dd-trace-java/platform/src/producer-benchmark/build/tmp/jmh -Duser.country=US -Duser.language=en -Duser.variant
vmNameOpenJDK 64-Bit Server VMOpenJDK 64-Bit Server VM
vmVersion11.0.25+9-post-Ubuntu-1ubuntu122.0411.0.25+9-post-Ubuntu-1ubuntu122.04

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 3 metrics, 0 unstable metrics.

See unchanged results
scenarioΔ mean throughput
scenario:not-instrumented/KafkaProduceBenchmark.benchProducesame
scenario:only-tracing-dsm-disabled-benchmarks/KafkaProduceBenchmark.benchProducesame
scenario:only-tracing-dsm-enabled-benchmarks/KafkaProduceBenchmark.benchProducesame

@pr-commenter

Copy link
Copy Markdown

Kafka / consumer-benchmark

Parameters

BaselineCandidate
baseline_or_candidatebaselinecandidate
git_branchmasteralexeyk/gradle-9
git_commit_date17787895951778814560
git_commit_shab4d1d5b4fc8c70
See matching parameters
BaselineCandidate
ci_job_date17788158191778815819
ci_job_id16849806551684980655
ci_pipeline_id113317592113317592
cpu_modelIntel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHzIntel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
jdkVersion11.0.2511.0.25
jmhVersion1.361.36
jvm/usr/lib/jvm/java-11-openjdk-amd64/bin/java/usr/lib/jvm/java-11-openjdk-amd64/bin/java
jvmArgs-Dfile.encoding=UTF-8 -Djava.io.tmpdir=/go/src/github.com/DataDog/apm-reliability/dd-trace-java/platform/src/consumer-benchmark/build/tmp/jmh -Duser.country=US -Duser.language=en -Duser.variant-Dfile.encoding=UTF-8 -Djava.io.tmpdir=/go/src/github.com/DataDog/apm-reliability/dd-trace-java/platform/src/consumer-benchmark/build/tmp/jmh -Duser.country=US -Duser.language=en -Duser.variant
vmNameOpenJDK 64-Bit Server VMOpenJDK 64-Bit Server VM
vmVersion11.0.25+9-post-Ubuntu-1ubuntu122.0411.0.25+9-post-Ubuntu-1ubuntu122.04

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 3 metrics, 0 unstable metrics.

See unchanged results
scenarioΔ mean throughput
scenario:not-instrumented/KafkaConsumerBenchmark.benchConsumesame
scenario:only-tracing-dsm-disabled-benchmarks/KafkaConsumerBenchmark.benchConsumesame
scenario:only-tracing-dsm-enabled-benchmarks/KafkaConsumerBenchmark.benchConsumeunsure
[+1203.774op/s; +8237.043op/s] or [+0.644%; +4.404%]

@AlexeyKuznetsov-DD

Copy link
Copy Markdown
ContributorAuthor

Correctly implemented by PRs from @bric3. No need in this prototype any more.

@bric3bric3 mentioned this pull request May 21, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: toolingBuild & Toolingtag: do not mergeDo not merge changestype: refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@AlexeyKuznetsov-DD@bric3