DataDog / dd-sdk-android-gradle-plugin

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

RUM-592: Support new Variant API #263

Closed 0xnm closed 5 months ago

0xnm commented 6 months ago

What does this PR do?

This PR brings support of new Variant API. It was originally added in AGP 7, but we didn't use it because it was missing some APIs from old Variant API.

Now we will use new Variant API for AGP 8.4.0 and above (because for the older AGP versions old Variant API works fine, but AGP 8.4.0 has a regression mentioned here).

Timeline of migration from old Variant API to the new one is here (new Variant API is completely stable with AGP 9, old Variant API is removed with AGP 10, mid-2025).

This PR should fix #242 and #257.

Review checklist (to be filled by reviewers)

codecov-commenter commented 6 months ago

Codecov Report

Attention: Patch coverage is 54.65116% with 78 lines in your changes are missing coverage. Please review.

Project coverage is 78.25%. Comparing base (7cd2c7d) to head (70ba81c). Report is 2 commits behind head on develop.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #263 +/- ## ============================================= - Coverage 80.56% 78.25% -2.30% - Complexity 210 249 +39 ============================================= Files 26 31 +5 Lines 828 892 +64 Branches 110 114 +4 ============================================= + Hits 667 698 +31 - Misses 116 144 +28 - Partials 45 50 +5 ``` | [Files](https://app.codecov.io/gh/DataDog/dd-sdk-android-gradle-plugin/pull/263?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) | Coverage Δ | | |---|---|---| | [...n/com/datadog/gradle/plugin/GenerateBuildIdTask.kt](https://app.codecov.io/gh/DataDog/dd-sdk-android-gradle-plugin/pull/263?src=pr&el=tree&filepath=dd-sdk-android-gradle-plugin%2Fsrc%2Fmain%2Fkotlin%2Fcom%2Fdatadog%2Fgradle%2Fplugin%2FGenerateBuildIdTask.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-ZGQtc2RrLWFuZHJvaWQtZ3JhZGxlLXBsdWdpbi9zcmMvbWFpbi9rb3RsaW4vY29tL2RhdGFkb2cvZ3JhZGxlL3BsdWdpbi9HZW5lcmF0ZUJ1aWxkSWRUYXNrLmt0) | `66.67% <100.00%> (+1.96%)` | :arrow_up: | | [...m/datadog/gradle/plugin/NdkSymbolFileUploadTask.kt](https://app.codecov.io/gh/DataDog/dd-sdk-android-gradle-plugin/pull/263?src=pr&el=tree&filepath=dd-sdk-android-gradle-plugin%2Fsrc%2Fmain%2Fkotlin%2Fcom%2Fdatadog%2Fgradle%2Fplugin%2FNdkSymbolFileUploadTask.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-ZGQtc2RrLWFuZHJvaWQtZ3JhZGxlLXBsdWdpbi9zcmMvbWFpbi9rb3RsaW4vY29tL2RhdGFkb2cvZ3JhZGxlL3BsdWdpbi9OZGtTeW1ib2xGaWxlVXBsb2FkVGFzay5rdA==) | `94.12% <100.00%> (ø)` | | | [...main/kotlin/com/datadog/gradle/plugin/TaskUtils.kt](https://app.codecov.io/gh/DataDog/dd-sdk-android-gradle-plugin/pull/263?src=pr&el=tree&filepath=dd-sdk-android-gradle-plugin%2Fsrc%2Fmain%2Fkotlin%2Fcom%2Fdatadog%2Fgradle%2Fplugin%2FTaskUtils.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-ZGQtc2RrLWFuZHJvaWQtZ3JhZGxlLXBsdWdpbi9zcmMvbWFpbi9rb3RsaW4vY29tL2RhdGFkb2cvZ3JhZGxlL3BsdWdpbi9UYXNrVXRpbHMua3Q=) | `77.27% <ø> (ø)` | | | [...tlin/com/datadog/gradle/plugin/CheckSdkDepsTask.kt](https://app.codecov.io/gh/DataDog/dd-sdk-android-gradle-plugin/pull/263?src=pr&el=tree&filepath=dd-sdk-android-gradle-plugin%2Fsrc%2Fmain%2Fkotlin%2Fcom%2Fdatadog%2Fgradle%2Fplugin%2FCheckSdkDepsTask.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-ZGQtc2RrLWFuZHJvaWQtZ3JhZGxlLXBsdWdpbi9zcmMvbWFpbi9rb3RsaW4vY29tL2RhdGFkb2cvZ3JhZGxlL3BsdWdpbi9DaGVja1Nka0RlcHNUYXNrLmt0) | `88.89% <50.00%> (ø)` | | | [...kotlin/com/datadog/gradle/plugin/FileUploadTask.kt](https://app.codecov.io/gh/DataDog/dd-sdk-android-gradle-plugin/pull/263?src=pr&el=tree&filepath=dd-sdk-android-gradle-plugin%2Fsrc%2Fmain%2Fkotlin%2Fcom%2Fdatadog%2Fgradle%2Fplugin%2FFileUploadTask.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-ZGQtc2RrLWFuZHJvaWQtZ3JhZGxlLXBsdWdpbi9zcmMvbWFpbi9rb3RsaW4vY29tL2RhdGFkb2cvZ3JhZGxlL3BsdWdpbi9GaWxlVXBsb2FkVGFzay5rdA==) | `81.75% <84.62%> (ø)` | | | [...atadog/gradle/plugin/internal/CurrentAgpVersion.kt](https://app.codecov.io/gh/DataDog/dd-sdk-android-gradle-plugin/pull/263?src=pr&el=tree&filepath=dd-sdk-android-gradle-plugin%2Fsrc%2Fmain%2Fkotlin%2Fcom%2Fdatadog%2Fgradle%2Fplugin%2Finternal%2FCurrentAgpVersion.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-ZGQtc2RrLWFuZHJvaWQtZ3JhZGxlLXBsdWdpbi9zcmMvbWFpbi9rb3RsaW4vY29tL2RhdGFkb2cvZ3JhZGxlL3BsdWdpbi9pbnRlcm5hbC9DdXJyZW50QWdwVmVyc2lvbi5rdA==) | `33.33% <33.33%> (ø)` | | | [...tadog/gradle/plugin/internal/variant/AppVariant.kt](https://app.codecov.io/gh/DataDog/dd-sdk-android-gradle-plugin/pull/263?src=pr&el=tree&filepath=dd-sdk-android-gradle-plugin%2Fsrc%2Fmain%2Fkotlin%2Fcom%2Fdatadog%2Fgradle%2Fplugin%2Finternal%2Fvariant%2FAppVariant.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-ZGQtc2RrLWFuZHJvaWQtZ3JhZGxlLXBsdWdpbi9zcmMvbWFpbi9rb3RsaW4vY29tL2RhdGFkb2cvZ3JhZGxlL3BsdWdpbi9pbnRlcm5hbC92YXJpYW50L0FwcFZhcmlhbnQua3Q=) | `0.00% <0.00%> (ø)` | | | [...com/datadog/gradle/plugin/MappingFileUploadTask.kt](https://app.codecov.io/gh/DataDog/dd-sdk-android-gradle-plugin/pull/263?src=pr&el=tree&filepath=dd-sdk-android-gradle-plugin%2Fsrc%2Fmain%2Fkotlin%2Fcom%2Fdatadog%2Fgradle%2Fplugin%2FMappingFileUploadTask.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-ZGQtc2RrLWFuZHJvaWQtZ3JhZGxlLXBsdWdpbi9zcmMvbWFpbi9rb3RsaW4vY29tL2RhdGFkb2cvZ3JhZGxlL3BsdWdpbi9NYXBwaW5nRmlsZVVwbG9hZFRhc2sua3Q=) | `83.82% <53.33%> (ø)` | | | [...gradle/plugin/internal/variant/NewApiAppVariant.kt](https://app.codecov.io/gh/DataDog/dd-sdk-android-gradle-plugin/pull/263?src=pr&el=tree&filepath=dd-sdk-android-gradle-plugin%2Fsrc%2Fmain%2Fkotlin%2Fcom%2Fdatadog%2Fgradle%2Fplugin%2Finternal%2Fvariant%2FNewApiAppVariant.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-ZGQtc2RrLWFuZHJvaWQtZ3JhZGxlLXBsdWdpbi9zcmMvbWFpbi9rb3RsaW4vY29tL2RhdGFkb2cvZ3JhZGxlL3BsdWdpbi9pbnRlcm5hbC92YXJpYW50L05ld0FwaUFwcFZhcmlhbnQua3Q=) | `60.00% <60.00%> (ø)` | | | [...com/datadog/gradle/plugin/DdAndroidGradlePlugin.kt](https://app.codecov.io/gh/DataDog/dd-sdk-android-gradle-plugin/pull/263?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=) | `70.25% <57.50%> (+2.64%)` | :arrow_up: | | ... and [2 more](https://app.codecov.io/gh/DataDog/dd-sdk-android-gradle-plugin/pull/263?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) | |