Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix caching of models generation task #1111

Merged

Conversation

0xnm
Copy link
Contributor

@0xnm 0xnm commented Oct 28, 2022

What does this PR do?

This change fixes the caching of GenerateJsonSchemaTask task. Before it was reading input files by calling listFiles for the given input dir, which will return only top-level files.

But it can be the case that top-level files are actually only the reference to the files deeper, like this:

{
  "$schema": "http://json-schema.org/draft-07/schema",
  "$id": "session-replay-mobile-schema.json",
  "$ref": "session-replay/mobile/segment-schema.json"
}

It means that top-level file will receive no change when referenced file session-replay/mobile/segment-schema.json actually changes, making Gradle think that inputs didn't change and skipping models generation.

With this change we track all files recursively with Gradle, but take only top-level files for the model generation.

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)

@0xnm 0xnm requested a review from a team as a code owner October 28, 2022 09:41
@@ -95,7 +103,10 @@ open class GenerateJsonSchemaTask : DefaultTask() {
fun performTask() {
val inputDir = getInputDir()
val outputDir = getOutputDir()
val files = getInputFiles().filter { it.name !in ignoredFiles }
val files = getInputFiles()
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess it can work...we are forcing it to only the root files

@codecov-commenter
Copy link

Codecov Report

Merging #1111 (3cb9b2f) into feature/sdkv2 (e201ff4) will decrease coverage by 0.17%.
The diff coverage is 92.39%.

@@                Coverage Diff                @@
##           feature/sdkv2    #1111      +/-   ##
=================================================
- Coverage          82.64%   82.47%   -0.17%     
=================================================
  Files                350      352       +2     
  Lines              11301    11415     +114     
  Branches            1846     1896      +50     
=================================================
+ Hits                9339     9414      +75     
- Misses              1396     1437      +41     
+ Partials             566      564       -2     
Impacted Files Coverage Δ
...n/com/datadog/android/core/internal/CoreFeature.kt 91.09% <ø> (-0.35%) ⬇️
...in/com/datadog/android/core/internal/SdkFeature.kt 88.18% <ø> (ø)
...atadog/android/log/internal/domain/LogGenerator.kt 80.00% <ø> (-3.33%) ⬇️
...og/android/v2/core/internal/NoOpContextProvider.kt 3.57% <0.00%> (-0.78%) ⬇️
...play/internal/storage/SessionReplayRecordWriter.kt 16.67% <16.67%> (ø)
.../android/v2/log/internal/storage/LogsDataWriter.kt 60.00% <60.00%> (ø)
...g/android/sessionreplay/processor/NodeFlattener.kt 93.33% <83.33%> (+2.03%) ⬆️
.../android/error/internal/DatadogExceptionHandler.kt 81.08% <84.62%> (-4.63%) ⬇️
...atadog/android/sessionreplay/recorder/ViewUtils.kt 84.62% <84.62%> (ø)
...g/android/log/internal/logger/DatadogLogHandler.kt 90.91% <86.96%> (-0.76%) ⬇️
... and 45 more

@0xnm 0xnm merged commit 56d16ba into feature/sdkv2 Oct 28, 2022
@0xnm 0xnm deleted the nogorodnikov/fix-caching-of-generate-models-task branch October 28, 2022 10:00
@xgouchet xgouchet added this to the 1.16.0 milestone Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants