Use new AGP APIs for hooking our tasks
Description
At the moment we are relying on older AGP APIs from the internal package, e.g. here to retrieve an assembleTaskProvider:
https://github.com/getsentry/sentry-android-gradle-plugin/blob/6865616328829c33fbde83295bda915e7a3849c9/plugin-build/src/agp74/kotlin/io/sentry/android/gradle/AGP74Compat.kt#L37-L40
We should rather use newer APIs to properly hook with the classes compilation, for example this one: https://github.com/android/gradle-recipes/blob/agp-8.2/getScopedArtifacts/README.md
variant.artifacts
.forScope(ScopedArtifacts.Scope.PROJECT)
.use(collectSourcesTaskProvider)
.toGet(
ScopedArtifact.CLASSES,
CollectSourcesTask::projectJars,
CollectSourcesTask::sourceDirs,
)
Related tasks:
assemblebundleinstall
Let's ensure we can make this work across different versions of AGP (e.g. 7.0, 7.4, 8.x). The upcoming project isolation feature could have an effect on overall build speed, we should investigate that.