Skip to content

Convert test-published-dependencies to Gradle Kotlin DSL#11445

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
masterfrom
bdu/migrate-test-published-artifacts-to-kotlin-dsl
May 25, 2026
Merged

Convert test-published-dependencies to Gradle Kotlin DSL#11445
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
masterfrom
bdu/migrate-test-published-artifacts-to-kotlin-dsl

Conversation

@bric3
Copy link
Copy Markdown
Contributor

@bric3 bric3 commented May 22, 2026

What Does This Do

Convert the test-published-dependencies/ build scripts from Groovy to Kotlin DSL.

Motivation

Dropping Groovy. Also fix an issue preventing the upgrade to Gradle 9.5.1.

See #10402, #11272

Additional Notes

Verified locally by reproducing the GitLab test_published_artifacts job: publishToMavenLocal then ./gradlew check in the subproject. All modules pass; the Java 7 sub-test of agent-logs-on-java-7 is skipped locally only because no JDK 7 build exists for arm64 macOS.

… DSL

Convert the test-published-dependencies build scripts from Groovy to
Kotlin DSL: root settings/build, plus the four subprojects
(all-deps-exist, ot-pulls-in-api, ot-is-shaded, agent-logs-on-java-7).

In ot-is-shaded, the CheckJarContentsTask is rewritten with managed
Property/ListProperty inputs and idiomatic Kotlin.

Verified locally by reproducing the GitLab `test_published_artifacts`
job: publishToMavenLocal then `./gradlew check` in the subproject. All
modules pass; the Java 7 sub-test of agent-logs-on-java-7 is skipped
locally only because no JDK 7 build exists for arm64 macOS.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@bric3 bric3 added tag: no release notes Changes to exclude from release notes type: refactoring comp: tooling Build & Tooling labels May 22, 2026
@datadog-official

This comment has been minimized.

@bric3 bric3 marked this pull request as ready for review May 22, 2026 13:02
@bric3 bric3 requested a review from a team as a code owner May 22, 2026 13:02
@bric3 bric3 requested review from dougqh and removed request for a team May 22, 2026 13:02
@dd-octo-sts dd-octo-sts Bot added the tag: ai generated Largely based on code generated by an AI or LLM label May 22, 2026
@bric3 bric3 requested review from AlexeyKuznetsov-DD and sarahchen6 and removed request for dougqh May 22, 2026 13:02
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 076c5dc8a3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

doLast {
// Arbitrary limit to prevent unintentional increases to the dd-trace-ot jar size
// Raise or lower as required
assert(jarFile.length() <= 8 * 1024 * 1024)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Replace disabled Kotlin assert in size check

In this Kotlin DSL task, assert(...) calls Kotlin's assertion helper, which only throws when JVM assertions are enabled. Gradle does not enable -ea for task actions by default, so :ot-is-shaded:checkJarSize will pass even when dd-trace-ot grows past the 8 MiB limit. The Groovy assert this replaced was enforced for the build script; use check(...) or throw explicitly so this published-dependency guard still catches oversized artifacts.

Useful? React with 👍 / 👎.

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.

Interesting...

Copy link
Copy Markdown
Contributor

@AlexeyKuznetsov-DD AlexeyKuznetsov-DD left a comment

Choose a reason for hiding this comment

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

LGTM, added one optional nit comment.

Comment thread test-published-dependencies/agent-logs-on-java-7/build.gradle.kts Outdated
doLast {
// Arbitrary limit to prevent unintentional increases to the dd-trace-ot jar size
// Raise or lower as required
assert(jarFile.length() <= 8 * 1024 * 1024)
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.

From Claude:

"kotlin.assert(...) only fires when the JVM is started with -ea (same semantics as Java's assert). Groovy assert was always enabled, so the original guard reliably failed the build when the jar exceeded 8MB; under the Gradle daemon's default JVM args this check is silently a no-op and the size limit is no longer enforced. The local verification didn't catch it because the current jar is under the limit, so both an active and a disabled assertion produce the same passing result. Consider check(jarFile.length() <= 8 * 1024 * 1024) { ... } or an explicit throw GradleException(...) to restore the original behavior."

Copy link
Copy Markdown
Contributor Author

@bric3 bric3 May 22, 2026

Choose a reason for hiding this comment

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

Thanks this is a good point !

Replaced by

val checkJarSize = tasks.register("checkJarSize") {
  inputs.file(jarFile)
  doLast {
    val jar = jarFile.get().asFile
    // Arbitrary limit to prevent unintentional increases to the dd-trace-ot jar size
    // Raise or lower as required
    if (jar.length() > 8 * 1024 * 1024) {
      throw GradleException("jar size is too big: ${jar.length()} bytes")
    }
  }
}

Copy link
Copy Markdown
Contributor

@dougqh dougqh left a comment

Choose a reason for hiding this comment

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

Claude pointed out one detail about the assert
I'll leave that to your discretion
Otherwise, looks to me

@bric3 bric3 mentioned this pull request May 22, 2026
15 tasks
Update the published dependency test builds to use Kotlin DSL task
accessors and provider-backed configuration resolution.

Add junit-platform-launcher alongside the JUnit BOM update because the
missing launcher caused test execution problems at least on Gradle 9.5.

Fixed the size assert, replaced by a simpler if statement.
@bric3 bric3 force-pushed the bdu/migrate-test-published-artifacts-to-kotlin-dsl branch from cbd510f to a3ad2a6 Compare May 22, 2026 15:48
@bric3 bric3 enabled auto-merge May 22, 2026 15:50
@bric3 bric3 added this pull request to the merge queue May 25, 2026
@dd-octo-sts
Copy link
Copy Markdown
Contributor

dd-octo-sts Bot commented May 25, 2026

/merge

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

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

View all feedbacks in Devflow UI.

2026-05-25 19:04:01 UTC ℹ️ Start processing command /merge


2026-05-25 19:04:07 UTC ℹ️ MergeQueue: pull request added to the queue

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


2026-05-25 20:13:27 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 25, 2026
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot merged commit 1f72887 into master May 25, 2026
570 checks passed
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot deleted the bdu/migrate-test-published-artifacts-to-kotlin-dsl branch May 25, 2026 20:13
@github-actions github-actions Bot added this to the 1.63.0 milestone May 25, 2026
bric3 added a commit that referenced this pull request May 26, 2026
refactor(build): convert test-published-dependencies to Gradle Kotlin DSL

Convert the test-published-dependencies build scripts from Groovy to
Kotlin DSL: root settings/build, plus the four subprojects
(all-deps-exist, ot-pulls-in-api, ot-is-shaded, agent-logs-on-java-7).

In ot-is-shaded, the CheckJarContentsTask is rewritten with managed
Property/ListProperty inputs and idiomatic Kotlin.

Verified locally by reproducing the GitLab `test_published_artifacts`
job: publishToMavenLocal then `./gradlew check` in the subproject. All
modules pass; the Java 7 sub-test of agent-logs-on-java-7 is skipped
locally only because no JDK 7 build exists for arm64 macOS.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

Merge branch 'master' into bdu/migrate-test-published-artifacts-to-kotlin-dsl

fix(test-published-dependencies): declare JUnit launcher

Update the published dependency test builds to use Kotlin DSL task
accessors and provider-backed configuration resolution.

Add junit-platform-launcher alongside the JUnit BOM update because the
missing launcher caused test execution problems at least on Gradle 9.5.

Fixed the size assert, replaced by a simpler if statement.

Co-authored-by: devflow.devflow-routing-intake <[email protected]>
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 type: refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants