Skip to content

Update build scripts to Gradle 9.4.1 from 8.14.4#11272

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

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.

Copy link
Copy Markdown
Contributor

@bric3 bric3 left a comment

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 thread buildSrc/src/main/kotlin/datadog/gradle/plugin/testJvmConstraints/TestJvmSpec.kt Outdated
Comment thread dd-java-agent/agent-iast/build.gradle Outdated
Comment thread dd-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'
Copy link
Copy Markdown
Contributor

@bric3 bric3 May 5, 2026

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 thread gradle/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 instanceof ModuleDependency) {
if (it instanceof ProjectDependency || it instanceof ExternalModuleDependency) {

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 thread gradle/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
Copy link
Copy Markdown
Contributor

bric3 commented May 5, 2026

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

@AlexeyKuznetsov-DD
Copy link
Copy Markdown
Contributor Author

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

pr-commenter Bot commented May 15, 2026

Debugger benchmarks

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
ci_job_date 1778815459 1778815808
end_time 2026-05-15T03:25:49 2026-05-15T03:31:38
git_branch master alexeyk/gradle-9
git_commit_sha 4d1d5b2f1b 4fc8c70
start_time 2026-05-15T03:24:20 2026-05-15T03:30:09
See matching parameters
Baseline Candidate
ci_job_id 1684980656 1684980656
ci_pipeline_id 113317592 113317592
cpu_model Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz
git_commit_date 1778814560 1778814560

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:noprobe unstable
[-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:basic same same same unstable
[-133.127µs; +8.306µs] or [-11.735%; +0.732%]
unstable
[-139.919op/s; +139.919op/s] or [-5.877%; +5.877%]
scenario:loop unsure
[-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%]
same same
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
Scenario Request median duration [CI 0.99]
noprobe 361.646 µs [321.812 µs, 401.48 µs]
basic 311.549 µs [302.594 µs, 320.503 µs]
loop 9.011 ms [9.003 ms, 9.018 ms]
  • candidate results
Scenario Request median duration [CI 0.99]
noprobe 355.067 µs [328.131 µs, 382.003 µs]
basic 310.045 µs [302.009 µs, 318.08 µs]
loop 9.0 ms [8.993 ms, 9.007 ms]

@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented May 15, 2026

Kafka / producer-benchmark

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master alexeyk/gradle-9
git_commit_date 1778789595 1778814560
git_commit_sha b4d1d5b 4fc8c70
See matching parameters
Baseline Candidate
ci_job_date 1778815769 1778815769
ci_job_id 1684980654 1684980654
ci_pipeline_id 113317592 113317592
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
jdkVersion 11.0.25 11.0.25
jmhVersion 1.36 1.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
vmName OpenJDK 64-Bit Server VM OpenJDK 64-Bit Server VM
vmVersion 11.0.25+9-post-Ubuntu-1ubuntu122.04 11.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.benchProduce same
scenario:only-tracing-dsm-disabled-benchmarks/KafkaProduceBenchmark.benchProduce same
scenario:only-tracing-dsm-enabled-benchmarks/KafkaProduceBenchmark.benchProduce same

@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented May 15, 2026

Kafka / consumer-benchmark

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master alexeyk/gradle-9
git_commit_date 1778789595 1778814560
git_commit_sha b4d1d5b 4fc8c70
See matching parameters
Baseline Candidate
ci_job_date 1778815819 1778815819
ci_job_id 1684980655 1684980655
ci_pipeline_id 113317592 113317592
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
jdkVersion 11.0.25 11.0.25
jmhVersion 1.36 1.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
vmName OpenJDK 64-Bit Server VM OpenJDK 64-Bit Server VM
vmVersion 11.0.25+9-post-Ubuntu-1ubuntu122.04 11.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.benchConsume same
scenario:only-tracing-dsm-disabled-benchmarks/KafkaConsumerBenchmark.benchConsume same
scenario:only-tracing-dsm-enabled-benchmarks/KafkaConsumerBenchmark.benchConsume unsure
[+1203.774op/s; +8237.043op/s] or [+0.644%; +4.404%]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants