Use new AGP APIs for hooking our tasks
romtsn opened this issue · comments
Description
At the moment we are relying on older AGP APIs from the internal package, e.g. here to retrieve an assembleTaskProvider
:
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:
assemble
bundle
install
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.