Skip to content

RUM-12387: Slight refactoring of RUM schema cloning and parser generation tasks#3094

Merged
aleksandr-gringauz merged 3 commits into
developfrom
aleksandr-gringauz/RUM-12387/pass-ref-from-gradle-properties
Jan 5, 2026
Merged

RUM-12387: Slight refactoring of RUM schema cloning and parser generation tasks#3094
aleksandr-gringauz merged 3 commits into
developfrom
aleksandr-gringauz/RUM-12387/pass-ref-from-gradle-properties

Conversation

@aleksandr-gringauz

@aleksandr-gringauz aleksandr-gringauz commented Jan 2, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

This PR introduces changes the are needed for this PR to work. Read the description there to understand what we are trying to do.

Here we introduce 2 new Gradle tasks:

  1. cloneAllRumSchemas task that runs all rum-events-format cloning tasks in different modules.
  2. generateAllJsonModels that generates all JSON serialization/deserialization code in the project.

These 2 tasks are used in the PR in rum-events-format repo mentioned above.

Motivation

What inspired you to submit this pull request?

Additional Notes

Anything else we should know when reviewing?

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)

@aleksandr-gringauz
aleksandr-gringauz force-pushed the aleksandr-gringauz/RUM-12387/pass-ref-from-gradle-properties branch from 7d96d19 to 821b47a Compare January 2, 2026 10:44
@datadog-official

datadog-official Bot commented Jan 2, 2026

Copy link
Copy Markdown

🎯 Code Coverage
Patch Coverage: 100.00%
Overall Coverage: 71.48% (+4.97%)

View detailed report

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

@codecov-commenter

codecov-commenter commented Jan 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.46%. Comparing base (7eda91f) to head (ebd311a).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3094      +/-   ##
===========================================
- Coverage    71.47%   71.46%   -0.01%     
===========================================
  Files          881      881              
  Lines        32460    32460              
  Branches      5466     5466              
===========================================
- Hits         23200    23196       -4     
+ Misses        7715     7712       -3     
- Partials      1545     1552       +7     

see 41 files with indirect coverage changes

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

@aleksandr-gringauz

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

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

destinationFolder: String,
excludedPrefixes: List<String> = emptyList()
) {
val repositoryRef = project.findProperty("dd.rum.schema.ref") as? String ?: "master"

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.

This dd.rum.schema.ref argument is used here.

@aleksandr-gringauz
aleksandr-gringauz marked this pull request as ready for review January 2, 2026 13:19
@aleksandr-gringauz
aleksandr-gringauz requested a review from a team as a code owner January 2, 2026 13:19
private const val CLONE_ALL_RUM_SCHEMAS_TASK_NAME = "cloneAllRumSchemas"
private const val GENERATE_ALL_JSON_MODELS_TASK_NAME = "generateAllJsonModels"

fun Project.createRumSchemaCloningTask(

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.

nit: just for wording consistency

Suggested change
fun Project.createRumSchemaCloningTask(
fun Project.createRumSchemaCloneTask(

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.

fixed


rootTask.dependsOn(task)

afterEvaluate {

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.

I think we have an opportunity to ditch afterEvaluate usage here if we replace tasks.findByName(ApiSurfacePlugin.TASK_GEN_KOTLIN_API_SURFACE) with tasks.withType<...>().all { dependsOn(taskName) }. Same for below.

But maybe I'm wrong, didn't try it by myself.

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.

  1. Removed afterEvaluate.
  2. Changed to lazy api tasks.findByName(ApiSurfacePlugin.TASK_GEN_KOTLIN_API_SURFACE) -> tasks.withType(GenerateApiSurfaceTask::class.java).configureEach.
  3. Also moved these tasks.withType(SourceJarTask::class.java) here. I think it is better to have this for all modules. Yes, if we use KSP in the module, we have a dependency between SourceJarTask and the task generating the code for JSON schemas even without this, but it looks like pure luck and IMHO is quite error prone.

Proof that it works https://gist.github.com/aleksandr-gringauz/5e4d05f041df787a7a73bed934ec0158.

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.

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.

fixed

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.

Same as my comment above, we need to delete this file

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.

fixed

@aleksandr-gringauz
aleksandr-gringauz force-pushed the aleksandr-gringauz/RUM-12387/pass-ref-from-gradle-properties branch from 7d13a96 to 2f7ad91 Compare January 2, 2026 17:11
@aleksandr-gringauz
aleksandr-gringauz force-pushed the aleksandr-gringauz/RUM-12387/pass-ref-from-gradle-properties branch from 060d9bb to ebd311a Compare January 2, 2026 17:29

rootTask.dependsOn(task)

tasks.withType(GenerateApiSurfaceTask::class.java).configureEach {

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.

there is also a bit shorter Kotlin DSL for that (similar to register calls above)

but no need to change anything

@aleksandr-gringauz
aleksandr-gringauz merged commit 17c117e into develop Jan 5, 2026
26 checks passed
@aleksandr-gringauz
aleksandr-gringauz deleted the aleksandr-gringauz/RUM-12387/pass-ref-from-gradle-properties branch January 5, 2026 10:02
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.

3 participants