Skip to content

RUM-16470: Cleanup ahead of the API 37 support#3582

Merged
kikoveiga merged 2 commits into
developfrom
kikoveiga/rum-16470/prep-non-breaking
Jun 26, 2026
Merged

RUM-16470: Cleanup ahead of the API 37 support#3582
kikoveiga merged 2 commits into
developfrom
kikoveiga/rum-16470/prep-non-breaking

Conversation

@kikoveiga

@kikoveiga kikoveiga commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Gets the repo closer to supporting API 37, by cleaning up some warnings, APIs and build-script patterns. The idea here is to apply non-breaking changes, so we don't bump, for now, any targetSDK, AGP, kotlin versions, which would change the abi compatibility to 2.1.

  • Add a unitTest.gradle.kts precompiled script plugin and apply it to the library/integration modules. The pair testImplementation(libs.bundles.jUnit5) / testImplementation(libs.bundles.testTools was duplicated across modules, which trips the IDE's dependency declared multiple times warning.
  • Inline the apply(from = generate_*/clone_*gradle.kts) scripts directly into their module build.gradle.kts and delete the wrapper files. This is the new correct way as we have IDE code-insight, type-safety and avoid a future K2 lint crash.
  • Make buildSrc task wiring lazy / config-cache friendly (TestPyramidConfig and ApiSurfacePlugin).
  • Bump build-only tooling: kover, dokka, binaryCompatibility. Note that we are not changing any transitiveDependencies files so these are ok to update.
  • Clean up minor warnings.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@kikoveiga
kikoveiga force-pushed the kikoveiga/rum-16470/prep-non-breaking branch from 935d49a to 3f66805 Compare June 26, 2026 10:23
@codecov-commenter

codecov-commenter commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.80%. Comparing base (456ca2c) to head (be4acc5).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3582      +/-   ##
===========================================
+ Coverage    72.47%   72.80%   +0.34%     
===========================================
  Files          978      974       -4     
  Lines        36069    35245     -824     
  Branches      6041     5967      -74     
===========================================
- Hits         26138    25659     -479     
+ Misses        8246     7918     -328     
+ Partials      1685     1668      -17     
Files with missing lines Coverage Δ
...lin/com/datadog/android/webview/WebViewTracking.kt 84.43% <ø> (ø)
.../compose/internal/ComposeActionTrackingStrategy.kt 48.39% <100.00%> (-0.10%) ⬇️

... and 350 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR prepares the repo for API 37 support by reducing build/IDE warnings and modernizing Gradle/buildSrc patterns without changing AGP/Kotlin/targetSdk to keep ABI compatibility stable.

Changes:

  • Introduces a datadog.unit-test convention plugin and applies it across many modules to deduplicate common test dependency declarations.
  • Inlines previously applied wrapper .gradle.kts scripts (json-model generation + schema cloning + git clone tasks) directly into module build.gradle.kts files and deletes the wrappers.
  • Improves buildSrc task wiring/config-cache friendliness (API surface plugin, JSON schema generation dependencies, detekt custom config) and bumps build-only tooling versions.

Reviewed changes

Copilot reviewed 59 out of 60 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tools/unit/src/main/kotlin/com/datadog/tools/unit/ObjectTest.kt Adjusts test helper to avoid Object() usage and keep type-sensitivity check.
tools/unit/src/main/kotlin/com/datadog/tools/unit/extensions/TestConfigurationExtension.kt Minor refactor to avoid repeated superclass access.
tools/detekt/src/main/kotlin/com/datadog/tools/detekt/rules/sdk/InvalidStringFormat.kt Fixes array comparison semantics when validating allowed argument types.
tools/benchmark/generate_trace_models.gradle.kts Removes wrapper script (logic moved into module build file).
tools/benchmark/build.gradle.kts Inlines JSON model generation task setup.
sample/kotlin/src/main/kotlin/com/datadog/android/sample/crash/CrashFragment.kt Updates deprecated uppercase call to locale-stable uppercase(Locale.US).
integrations/dd-sdk-android-tv/build.gradle.kts Applies datadog.unit-test; removes duplicated test bundle deps.
integrations/dd-sdk-android-trace-coroutines/build.gradle.kts Applies datadog.unit-test; removes duplicated test bundle deps.
integrations/dd-sdk-android-timber/build.gradle.kts Applies datadog.unit-test; removes duplicated test bundle deps.
integrations/dd-sdk-android-sqldelight/build.gradle.kts Applies datadog.unit-test; removes duplicated test bundle deps.
integrations/dd-sdk-android-rx/build.gradle.kts Applies datadog.unit-test; removes duplicated test bundle deps.
integrations/dd-sdk-android-rum-coroutines/build.gradle.kts Applies datadog.unit-test; removes duplicated test bundle deps.
integrations/dd-sdk-android-okhttp/build.gradle.kts Applies datadog.unit-test; removes duplicated test bundle deps.
integrations/dd-sdk-android-okhttp-otel/build.gradle.kts Applies datadog.unit-test; removes duplicated test bundle deps.
integrations/dd-sdk-android-glide/build.gradle.kts Applies datadog.unit-test; removes duplicated test bundle deps.
integrations/dd-sdk-android-fresco/build.gradle.kts Applies datadog.unit-test; removes duplicated test bundle deps.
integrations/dd-sdk-android-cronet/build.gradle.kts Applies datadog.unit-test; removes duplicated test bundle deps.
integrations/dd-sdk-android-compose/src/main/kotlin/com/datadog/android/compose/internal/ComposeActionTrackingStrategy.kt Avoids raw generic type inference warning for LinkedList.
integrations/dd-sdk-android-compose/build.gradle.kts Applies datadog.unit-test; removes duplicated test bundle deps.
integrations/dd-sdk-android-coil3/build.gradle.kts Applies datadog.unit-test; removes duplicated test bundle deps.
integrations/dd-sdk-android-coil/build.gradle.kts Applies datadog.unit-test; removes duplicated test bundle deps.
integrations/dd-sdk-android-apollo/build.gradle.kts Applies datadog.unit-test; removes duplicated test bundle deps.
gradle/libs.versions.toml Bumps build-only tool versions (kover, dokka, binaryCompatibility).
features/dd-sdk-android-webview/src/main/kotlin/com/datadog/android/webview/WebViewTracking.kt Fixes spacing in a warning message constant.
features/dd-sdk-android-webview/build.gradle.kts Applies datadog.unit-test; removes duplicated test bundle deps.
features/dd-sdk-android-trace/generate_trace_models.gradle.kts Removes wrapper script (logic moved into module build file).
features/dd-sdk-android-trace/build.gradle.kts Applies datadog.unit-test; inlines JSON model generation task setup.
features/dd-sdk-android-trace-otel/src/main/kotlin/com/datadog/android/trace/opentelemetry/internal/OtelContext.kt Avoids storing null values under OTel context keys to prevent internal throws.
features/dd-sdk-android-trace-otel/build.gradle.kts Applies datadog.unit-test; removes duplicated test bundle deps.
features/dd-sdk-android-trace-internal/clone_dd_trace.gradle.kts Removes wrapper script (logic moved into module build file).
features/dd-sdk-android-trace-internal/build.gradle.kts Applies datadog.unit-test; inlines git clone task setup.
features/dd-sdk-android-session-replay/generate_session_replay_models.gradle.kts Removes wrapper script (logic moved into module build file).
features/dd-sdk-android-session-replay/clone_session_replay_schema.gradle.kts Removes wrapper script (logic moved into module build file).
features/dd-sdk-android-session-replay/build.gradle.kts Applies datadog.unit-test; inlines schema clone + JSON model generation tasks.
features/dd-sdk-android-session-replay-material/build.gradle.kts Applies datadog.unit-test; removes duplicated test bundle deps.
features/dd-sdk-android-session-replay-compose/build.gradle.kts Applies datadog.unit-test; removes duplicated test bundle deps.
features/dd-sdk-android-rum/generate_telemetry_models.gradle.kts Removes wrapper script (logic moved into module build file).
features/dd-sdk-android-rum/generate_rum_models.gradle.kts Removes wrapper script (logic moved into module build file).
features/dd-sdk-android-rum/clone_telemetry_schema.gradle.kts Removes wrapper script (logic moved into module build file).
features/dd-sdk-android-rum/clone_rum_schema.gradle.kts Removes wrapper script (logic moved into module build file).
features/dd-sdk-android-rum/build.gradle.kts Applies datadog.unit-test; inlines schema clone + JSON model generation tasks.
features/dd-sdk-android-rum-debug-widget/build.gradle.kts Applies datadog.unit-test; removes duplicated test bundle deps.
features/dd-sdk-android-profiling/generate_profiling_models.gradle.kts Removes wrapper script (logic moved into module build file).
features/dd-sdk-android-profiling/clone_profiling_schema.gradle.kts Removes wrapper script (logic moved into module build file).
features/dd-sdk-android-profiling/build.gradle.kts Applies datadog.unit-test; inlines schema clone + JSON model generation tasks.
features/dd-sdk-android-ndk/build.gradle.kts Applies datadog.unit-test; removes duplicated test bundle deps.
features/dd-sdk-android-logs/generate_log_models.gradle.kts Removes wrapper script (logic moved into module build file).
features/dd-sdk-android-logs/build.gradle.kts Applies datadog.unit-test; inlines JSON model generation task setup.
features/dd-sdk-android-flags/generate_flags_models.gradle.kts Removes wrapper script (logic moved into module build file).
features/dd-sdk-android-flags/build.gradle.kts Applies datadog.unit-test; inlines JSON model generation task setup.
features/dd-sdk-android-flags-openfeature/src/main/kotlin/com/datadog/android/flags/openfeature/DatadogFlagsProvider.kt Makes callbackFlow send explicit via captured scope.
features/dd-sdk-android-flags-openfeature/build.gradle.kts Applies datadog.unit-test; removes duplicated test bundle deps.
dd-sdk-android-internal/build.gradle.kts Applies datadog.unit-test; removes duplicated test bundle deps.
dd-sdk-android-core/build.gradle.kts Applies datadog.unit-test; removes duplicated test bundle deps.
buildSrc/src/main/kotlin/com/datadog/gradle/utils/JsonSchemaGenerationTasks.kt Adds additional task dependencies (KSP + ExtractAnnotations) for generated model availability.
buildSrc/src/main/kotlin/com/datadog/gradle/plugin/config/UnitTestConventionPlugin.kt Adds new convention plugin to centralize shared unit-test dependencies.
buildSrc/src/main/kotlin/com/datadog/gradle/plugin/apisurface/ApiSurfacePlugin.kt Makes Java API dump task wiring lazier by using task matching providers.
buildSrc/src/main/kotlin/com/datadog/gradle/config/TestPyramidConfig.kt Makes aggregation task depend only on tasks that exist in submodules.
buildSrc/src/main/kotlin/com/datadog/gradle/config/DetektCustomConfig.kt Defers detekt classpath file I/O to execution time for config-cache friendliness.
buildSrc/build.gradle.kts Registers the datadog.unit-test convention plugin id.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread buildSrc/src/main/kotlin/com/datadog/gradle/config/TestPyramidConfig.kt Outdated
@kikoveiga
kikoveiga force-pushed the kikoveiga/rum-16470/prep-non-breaking branch 2 times, most recently from 12491a4 to 760b760 Compare June 26, 2026 12:12
@kikoveiga
kikoveiga force-pushed the kikoveiga/rum-16470/prep-non-breaking branch from 760b760 to 9d06876 Compare June 26, 2026 12:28
@kikoveiga
kikoveiga marked this pull request as ready for review June 26, 2026 12:46
@kikoveiga
kikoveiga requested review from a team as code owners June 26, 2026 12:46
* `kotlin-stdlib` is deliberately not added here — the Kotlin plugin already contributes it to every
* source set (`kotlin.stdlib.default.dependency`), so adding it again would duplicate it.
*/
class UnitTestConventionPlugin : Plugin<Project> {

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.

There is a lot of boiler plate with these kind of convention plugins. Can we use pre compiled script plugins instead?

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.

Yes, created a new unitTest.gradle.kts and updated the pr description, thanks!

@kikoveiga
kikoveiga force-pushed the kikoveiga/rum-16470/prep-non-breaking branch from c311adb to 7e008dc Compare June 26, 2026 13:34
@kikoveiga
kikoveiga requested a review from abrooksv June 26, 2026 13:39

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

Copy link
Copy Markdown

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

ℹ️ 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".

Comment thread dd-sdk-android-core/build.gradle.kts
implementation(libs.gson)
implementation(libs.mockitoKotlin)

testImplementation(libs.bundles.jUnit5)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This file doesn't apply id("unitTest") as others, is this expected?

@kikoveiga kikoveiga Jun 26, 2026

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.

Yes, because the unitTest plugin only adds the bundles to testImplementation. This module is the opposite: as it's a test-support library, we need it in the main source so we keep implementation(libs.bundles.jUnit5) and implementation(libs.bundles.testTools).

@kikoveiga
kikoveiga force-pushed the kikoveiga/rum-16470/prep-non-breaking branch from 7e008dc to be4acc5 Compare June 26, 2026 14:08
Comment thread buildSrc/src/main/kotlin/unitTest.gradle.kts
@kikoveiga
kikoveiga merged commit 7c4778b into develop Jun 26, 2026
27 checks passed
@kikoveiga
kikoveiga deleted the kikoveiga/rum-16470/prep-non-breaking branch June 26, 2026 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants