Skip to content

Convert wildfly earBuild tasks to the smoke-test plugin#11417

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 5 commits into
masterfrom
bdu/smoke-test-pattern-e-wildfly
May 20, 2026
Merged

Convert wildfly earBuild tasks to the smoke-test plugin#11417
gh-worker-dd-mergequeue-cf854d[bot] merged 5 commits into
masterfrom
bdu/smoke-test-pattern-e-wildfly

Conversation

@bric3
Copy link
Copy Markdown
Contributor

@bric3 bric3 commented May 19, 2026

What Does This Do

Converts the two earBuild tasks in the wildfly smoke tests to use the NestedGradleBuild task type from the smoke-test plugin added in #11405:

  • dd-smoke-tests/wildfly/build.gradle (spring-ear EAR)
  • dd-smoke-tests/rum/wildfly-15/build.gradle (rum-ear EAR)

Before, each module used an Exec task that invoked the root gradlew with JAVA_HOME=8 (or the parent shell's JAVA_HOME) to run the nested EAR build.

After, the nested EAR build runs through the Gradle Tooling API pinned to Gradle 8.14.5 on a Java 8 toolchain daemon, with dd-trace-api.jar forwarded via the plugin's projectJar(...) helper. Surrounding orchestration (wildfly server unzip, EAR copy into standalone/deployments, Test.dependsOn 'deploy') is unchanged.

Motivation

Once the root build moves to Gradle 9 (which requires a JDK 17 daemon), the existing Exec-based pattern can't run the EAR build on Java 8 anymore — the root gradlew is the root Gradle's wrapper, not the nested project's.

Same problem and shape as PR #11379 "Pattern B" (existing application/ subprojects with a root-gradlew Exec), but pointed at the smoke-test plugin's NestedGradleBuild task instead of a committed Gradle 8 wrapper inside each application/ subdir. The plugin uses the Tooling API to download/cache Gradle 8.14.5 once per host, so nothing new is committed to source control.

Note

NestedGradleBuild has a convention of running Gradle 8.14.5, with a daemon running on Java 21, so it's not explicitly set. It's configurable if needed.

Additional Notes

  • Stacked on #11405 (smoke-test plugin infrastructure). Merge target is the infrastructure branch; rebase to master after Add smoke-test plugin for nested Gradle builds #11405 lands.
  • The inner spring-ear/ and rum-ear/ subprojects are untouched.
  • Verified locally on Gradle 9.5.1: both earBuild tasks succeed; the previously-failing ./gradlew assemble now passes end-to-end.

Contributor Checklist

🤖 Generated with Claude Code

Adds a new included build `build-logic/` hosting a single subproject
`smoke-test` that exposes the `dd-trace-java.smoke-test-app` plugin.

The plugin contributes:
- `NestedGradleBuild` task type that runs a nested Gradle build via the
  Gradle Tooling API. It pins the nested Gradle version (no committed
  per-application wrappers), uses the configured Java toolchain for the
  nested daemon, forwards artifact paths from the root build as
  `-P<name>=<path>`, and redirects the nested `buildDir` via
  `-PappBuildDir=<path>` so outputs land under the outer project's build
  directory.
- `smokeTestApp` project extension with an `application { ... }` block
  that registers the `NestedGradleBuild` task, wires it into every `Test`
  task via `dependsOn` + a `jvmArgumentProvider` for the produced
  artifact's system property. Consumers can also register
  `NestedGradleBuild` directly when they need more control; the plugin
  is a no-op until `application` or a manual registration is done.
- `projectJar(name, project)` helper that forwards a sibling project's
  jar to the nested build through a resolvable `Configuration` (avoids
  `evaluationDependsOn` and the cross-project access ordering issues).

The plugin is verified with JUnit 5 unit tests (`ProjectBuilder`) and
end-to-end tests that drive the Tooling API path through the Gradle Test
Kit with a temporary Kotlin-DSL test project.

`build-logic/settings.gradle.kts` references the existing
`gradle/libs.versions.toml` catalog (mirroring `buildSrc/`) so the
plugin can use the same library coordinates as the rest of the repo.
The Gradle libs Maven repository (`https://repo.gradle.org/gradle/libs-releases`,
scoped to `org.gradle:`) is added to the root build's `pluginManagement`
and to `gradle/repositories.gradle` so the Tooling API jar resolves.

Smoke-test modules with Spring Boot plugin versions incompatible with
Gradle 9 will use this plugin in follow-up PRs instead of a committed
Gradle 8 wrapper.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bric3 bric3 changed the title chore(smoke-tests): convert wildfly earBuild tasks to the smoke-test plugin Convert wildfly earBuild tasks to the smoke-test plugin May 19, 2026
@bric3 bric3 added tag: no release notes Changes to exclude from release notes comp: tooling Build & Tooling tag: ai generated Largely based on code generated by an AI or LLM labels May 19, 2026
@datadog-datadog-prod-us1

This comment has been minimized.

…14.5

Set conventions on `smokeTestApp`:
- `gradleVersion` defaults to `"8.14.5"` (Gradle 8 last release; pinned because
  Spring Boot plugin pre-3.5 calls `Configuration.getUploadTaskName()`, removed
  in Gradle 9).
- `javaLauncher` defaults to a JDK 21 toolchain (the version the root build
  requires for its own Gradle 9 migration; standardising the nested daemon on
  the same JDK avoids requiring an extra toolchain on dev machines and CI
  runners).

Consumers that need a different JDK or Gradle version still override
explicitly. The inner build script is responsible for pinning the produced
bytecode level (`java { sourceCompatibility = JavaVersion.VERSION_1_8 }` or
similar) — Gradle adds `--release N` automatically when source/target differs
from the daemon JVM.

`JavaToolchainService` is now injected into the extension; this works in any
project where a `java*` (or related) plugin is applied. Smoke-test modules
already apply `gradle/java.gradle`, which applies `java`, so the convention
resolves on first read.

Public defaults exposed as `DEFAULT_NESTED_GRADLE_VERSION` and
`DEFAULT_NESTED_JAVA_VERSION` constants so the values are discoverable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bric3 bric3 force-pushed the bdu/smoke-test-pattern-e-wildfly branch 2 times, most recently from 4186dc2 to ca93810 Compare May 19, 2026 16:32
@bric3 bric3 marked this pull request as ready for review May 19, 2026 16:43
@bric3 bric3 requested review from a team as code owners May 19, 2026 16:43
@bric3 bric3 requested review from ValentinZakharov and removed request for a team May 19, 2026 16:43
@bric3 bric3 changed the title Convert wildfly earBuild tasks to the smoke-test plugin Convert wildfly earBuild tasks to the smoke-test plugin May 19, 2026
@bric3 bric3 force-pushed the bdu/smoke-test-pattern-e-wildfly branch from ca93810 to e5f138f Compare May 19, 2026 16:49
bric3 and others added 2 commits May 19, 2026 18:59
…ugin

Switch the plugin sources and unit tests over to the typed
`org.gradle.kotlin.dsl` extension functions where they replace
`::class.java` boilerplate:

- `tasks.register(name, Type::class.java) { … }` → `tasks.register<Type>(name) { … }`
- `tasks.withType(Type::class.java).configureEach { … }` → `tasks.withType<Type>().configureEach { … }`
- `extensions.create("name", Type::class.java)` → `extensions.create<Type>("name")`
- `extensions.getByType(Type::class.java)` → `extensions.getByType<Type>()`
- `extensions.findByName("name")` (followed by `isInstanceOf`) → `extensions.findByType<Type>()`
- `project.plugins.apply(Plugin::class.java)` → `project.apply<Plugin>()` (PluginAware)
- `objects.newInstance(Type::class.java)` → `objects.newInstance<Type>()`

Also drop the six `captured*` local variables in `SmokeTestAppExtension.application` —
inside `tasks.register<NestedGradleBuild>(taskName) { … }` the outer extension's
properties are now reached via `this@SmokeTestAppExtension.<prop>` directly.

No behavioural change; the 9 plugin tests still pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…plugin

The wildfly and rum:wildfly-15 smoke tests built their EAR via an `Exec`
task invoking the root `gradlew` with `JAVA_HOME=8` (or whatever the
parent shell had). Once the root wrapper moved to Gradle 9, that pattern
broke — Gradle 9 requires a JDK 17 daemon, which then can't load the
JDK 8-targeted application.

Swap both `earBuild` tasks for the `NestedGradleBuild` task type from
the `build-logic:smoke-test` plugin so the nested EAR build runs on a
Gradle 8.14.5 daemon with the Java 8 toolchain. `dd-trace-api.jar` is
forwarded through the plugin's `projectJar(...)` helper.

The surrounding wildfly orchestration (unzip the server zip, copy the
EAR into `standalone/deployments`, `Test.dependsOn 'deploy'`) is
unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bric3 bric3 force-pushed the bdu/smoke-test-pattern-e-wildfly branch from e5f138f to 2a63725 Compare May 19, 2026 17:00
Base automatically changed from bdu/smoke-test-plugin-infrastructure to master May 19, 2026 20:48
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot requested a review from a team as a code owner May 19, 2026 20:48
@bric3 bric3 added this pull request to the merge queue May 20, 2026
@dd-octo-sts
Copy link
Copy Markdown
Contributor

dd-octo-sts Bot commented May 20, 2026

/merge

@gh-worker-devflow-routing-ef8351
Copy link
Copy Markdown

gh-worker-devflow-routing-ef8351 Bot commented May 20, 2026

View all feedbacks in Devflow UI.

2026-05-20 06:28:10 UTC ℹ️ Start processing command /merge


2026-05-20 06:28:15 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 1h (p90).


2026-05-20 07:39:36 UTC ℹ️ MergeQueue: This merge request was merged

@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 20, 2026
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot merged commit 4f1ea4e into master May 20, 2026
571 checks passed
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot deleted the bdu/smoke-test-pattern-e-wildfly branch May 20, 2026 07:39
@github-actions github-actions Bot added this to the 1.63.0 milestone May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: tooling Build & Tooling tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants