RUM-12387: Slight refactoring of RUM schema cloning and parser generation tasks#3094
Conversation
7d96d19 to
821b47a
Compare
|
🎯 Code Coverage 🔗 Commit SHA: ebd311a | Docs | Datadog PR Page | Was this helpful? Give us feedback! |
Codecov Report✅ All modified and coverable lines are covered by tests. 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 🚀 New features to boost your workflow:
|
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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" |
There was a problem hiding this comment.
This dd.rum.schema.ref argument is used here.
| private const val CLONE_ALL_RUM_SCHEMAS_TASK_NAME = "cloneAllRumSchemas" | ||
| private const val GENERATE_ALL_JSON_MODELS_TASK_NAME = "generateAllJsonModels" | ||
|
|
||
| fun Project.createRumSchemaCloningTask( |
There was a problem hiding this comment.
nit: just for wording consistency
| fun Project.createRumSchemaCloningTask( | |
| fun Project.createRumSchemaCloneTask( |
|
|
||
| rootTask.dependsOn(task) | ||
|
|
||
| afterEvaluate { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
- Removed
afterEvaluate. - Changed to lazy api
tasks.findByName(ApiSurfacePlugin.TASK_GEN_KOTLIN_API_SURFACE)->tasks.withType(GenerateApiSurfaceTask::class.java).configureEach. - 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 betweenSourceJarTaskand 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.
There was a problem hiding this comment.
we need to delete this file instead, I forgot to do it in https://github.com/DataDog/dd-sdk-android/pull/2859/files
There was a problem hiding this comment.
Same as my comment above, we need to delete this file
7d13a96 to
2f7ad91
Compare
060d9bb to
ebd311a
Compare
|
|
||
| rootTask.dependsOn(task) | ||
|
|
||
| tasks.withType(GenerateApiSurfaceTask::class.java).configureEach { |
There was a problem hiding this comment.
there is also a bit shorter Kotlin DSL for that (similar to register calls above)
but no need to change anything
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:
cloneAllRumSchemastask that runs allrum-events-formatcloning tasks in different modules.generateAllJsonModelsthat generates all JSON serialization/deserialization code in the project.These 2 tasks are used in the PR in
rum-events-formatrepo 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)