sentry-android-gradle-plugin
sentry-android-gradle-plugin copied to clipboard
Support new Android Gradle APIs
We could improve how to find the mapping file using the latest APIs https://github.com/getsentry/sentry-android-gradle-plugin/blob/main/plugin-build/src/main/kotlin/io/sentry/android/gradle/SentryMappingFileProvider.kt
https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/ArtifactType.OBFUSCATION_MAPPING_FILE
https://medium.com/androiddevelopers/new-apis-in-the-android-gradle-plugin-f5325742e614
this won't work for people using AGP 4.0 though, only >= 4.1
https://github.com/ReactiveCircus/app-versioning/blob/b30fb5435b25ad7fb8acdf61179c7010f4074fdb/src/main/kotlin/io/github/reactivecircus/appversioning/AppVersioningPlugin.kt uses the onVariants API, we can learn from there
variant API is now stable: https://developer.android.com/studio/releases/gradle-plugin#7-0-0 https://github.com/android/gradle-recipes/tree/agp-7.0/Kotlin
variant API is now stable: developer.android.com/studio/releases/gradle-plugin#7-0-0 https://github.com/android/gradle-recipes/tree/agp-7.0/Kotlin
Awesome 🎉 I believe we want to try to land this https://github.com/getsentry/sentry-android-gradle-plugin/pull/106 first right?
@cortinico yeah landing https://github.com/getsentry/sentry-android-gradle-plugin/pull/106 would be nice, but if migrating to AGP 7.x is painless, I'd not mind ignoring it since AGP 4.1 to 4.2 does not have any benefits by the final user.
AGP 7.x though introduces breaking changes, but we can always bump a major and recommend people using the v2.x when using AGP < 7.x
what do you think? I'm fine either way, right now I believe our plugin 2.x works pretty well with AGP 7.x right? as we run tests on the beta version as well, so not an urgent issue to work on either.
https://github.com/getsentry/sentry-android-gradle-plugin/pull/155 for testing AGP 7.0.0 stable version
com.android.build.gradle.api.ApplicationVariant is deprecated and should be replaced
AndroidComponentsExtension does not exist on AGP 4.x so we have to drop support on 4.x
there's no way to access the object variant.buildType using the new API, variant.buildType is a String instead of a BuildType object, we really need to access the isMinifyEnabled and isDebuggable properties, better to not do it right now till finding a better solution
We'd also need to switch to the new instrumentation API introduced in 7.2 (https://developer.android.com/studio/releases/gradle-plugin-api-updates#instrumentatin-apis-deprecated). For now we'll stick to the deprecated version for compat's sake, but at some point it will be removed and we'll need to migrate.