Update build scripts to Gradle 9.4.1 from 8.14.4#11272
Update build scripts to Gradle 9.4.1 from 8.14.4#11272AlexeyKuznetsov-DD wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
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.
| testJvmConstraints { | ||
| minJavaVersion = JavaVersion.VERSION_21 | ||
| } | ||
| failOnNoDiscoveredTests = false |
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
question: What was the problem with testCompile ?
| // 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) | ||
| } | ||
| } |
| // 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}" |
There was a problem hiding this comment.
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.
|
|
||
| project.configurations.api.allDependencies.each { | ||
| if ((it instanceof ProjectDependency) || !(it instanceof SelfResolvingDependency)) { | ||
| if (it instanceof ModuleDependency) { |
There was a problem hiding this comment.
suggestion:
| if (it instanceof ModuleDependency) { | |
| if (it instanceof ProjectDependency || it instanceof ExternalModuleDependency) { |
There was a problem hiding this comment.
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.
| 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()}") |
|
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 |
# 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
Debugger benchmarksParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 9 metrics, 6 unstable metrics. See unchanged results
Request duration reports for reportsgantt
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,
|
Kafka / producer-benchmarkParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 3 metrics, 0 unstable metrics. See unchanged results
|
Kafka / consumer-benchmarkParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 3 metrics, 0 unstable metrics. See unchanged results
|
DO NOT MERGE, experimenting
What Does This Do
Motivation
Additional Notes
Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issueJira ticket: [PROJ-IDENT]
Note: Once your PR is ready to merge, add it to the merge queue by commenting
/merge./merge -ccancels 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.