Skip to content

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

Open
bric3 wants to merge 3 commits into
masterfrom
bdu/migrate-test-published-artifacts-to-kotlin-dsl
Open

Convert test-published-dependencies to Gradle Kotlin DSL#11445
bric3 wants to merge 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) <noreply@anthropic.com>
@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
Copy link
Copy Markdown
Contributor

datadog-official Bot commented May 22, 2026

Pipelines

Fix all issues with BitsAI

⚠️ Warnings

🚦 1 Pipeline job failed

DataDog/apm-reliability/dd-trace-java | muzzle: [1/8]   View in Datadog   GitLab

🛟 This job is unlikely to succeed on retry. Please review your pipeline configuration. Could not find testng-6.14.0.jar, testng-6.12.jar, and testng-6.9.13.8.jar during dependency resolution.

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: a3ad2a6 | Docs | Datadog PR Page | Give us feedback!

@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

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 !

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
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