DataDog / dd-sdk-android-gradle-plugin

The Datadog Gradle Plugin for Android
Apache License 2.0
14 stars 9 forks source link

RUM-4031: Avoid eager fetching of Variant values #240

Closed 0xnm closed 5 months ago

0xnm commented 5 months ago

What does this PR do?

This PR switches to the lazy configuration of upload task by using TaskContainer#register API instead of TaskContainer#create. This solves the problem of compatibility with https://github.com/Triple-T/gradle-play-publisher plugin which is similar to what described here https://github.com/Triple-T/gradle-play-publisher/issues/940.

Long-term solution will be to switch from the legacy Variant API to the new Variant API.

Note: This is a partial fix, because if both tasks try to configure themselves in the same build execution, the problem will still occur. But it is not clear if it should be fixed on our side or problem is on the gradle-play-publisher plugin side.

Review checklist (to be filled by reviewers)

codecov-commenter commented 5 months ago

Codecov Report

Merging #240 (2651409) into release/1.13.0 (85c7d67) will increase coverage by 0.57%. The diff coverage is 83.33%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## release/1.13.0 #240 +/- ## ==================================================== + Coverage 76.65% 77.22% +0.57% Complexity 201 201 ==================================================== Files 26 26 Lines 788 790 +2 Branches 104 104 ==================================================== + Hits 604 610 +6 + Misses 147 143 -4 Partials 37 37 ``` | [Files](https://app.codecov.io/gh/DataDog/dd-sdk-android-gradle-plugin/pull/240?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) | Coverage Δ | | |---|---|---| | [...tlin/com/datadog/gradle/plugin/DdFileUploadTask.kt](https://app.codecov.io/gh/DataDog/dd-sdk-android-gradle-plugin/pull/240?src=pr&el=tree&filepath=dd-sdk-android-gradle-plugin%2Fsrc%2Fmain%2Fkotlin%2Fcom%2Fdatadog%2Fgradle%2Fplugin%2FDdFileUploadTask.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-ZGQtc2RrLWFuZHJvaWQtZ3JhZGxlLXBsdWdpbi9zcmMvbWFpbi9rb3RsaW4vY29tL2RhdGFkb2cvZ3JhZGxlL3BsdWdpbi9EZEZpbGVVcGxvYWRUYXNrLmt0) | `80.65% <100.00%> (-0.66%)` | :arrow_down: | | [...com/datadog/gradle/plugin/DdAndroidGradlePlugin.kt](https://app.codecov.io/gh/DataDog/dd-sdk-android-gradle-plugin/pull/240?src=pr&el=tree&filepath=dd-sdk-android-gradle-plugin%2Fsrc%2Fmain%2Fkotlin%2Fcom%2Fdatadog%2Fgradle%2Fplugin%2FDdAndroidGradlePlugin.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-ZGQtc2RrLWFuZHJvaWQtZ3JhZGxlLXBsdWdpbi9zcmMvbWFpbi9rb3RsaW4vY29tL2RhdGFkb2cvZ3JhZGxlL3BsdWdpbi9EZEFuZHJvaWRHcmFkbGVQbHVnaW4ua3Q=) | `61.11% <80.77%> (+0.24%)` | :arrow_up: | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/DataDog/dd-sdk-android-gradle-plugin/pull/240/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog)