Fixed
Status Update
Comments
me...@thomaskeller.biz <me...@thomaskeller.biz> #2
The use case is
vi...@google.com <vi...@google.com>
xa...@google.com <xa...@google.com> #3
We need to intro a new API for this. getCompileClasspath(Object)
is not meant for this.
je...@google.com <je...@google.com>
sp...@google.com <sp...@google.com> #4
BaseVariant
has been deprecated, but an API to access the varian't compile classpath has been added to com.android.build.api.variant.Component
, starting with AGP 7.3.0-alpha03
.
API:
/**
* Access to the variant's compile classpath.
*
* The returned [FileCollection] should not be resolved until execution time.
*/
@get:Incubating
val compileClasspath: FileCollection
Example usage:
androidComponents {
onVariants { variant ->
project.tasks.register(
variant.name + "Foo",
FooTask::class.java
) {
it.configurableFileCollectionInput.from(variant.compileClasspath)
}
}
}
Does this new API satisfy your use case?
Description
Using AGP 4.0.0, there is
getCompileClasspath(null)
onBaseVariant
to return the compile classpath that I need to feed into another Gradle plugin.What I figured however is that this classpath is missing the path where the compiled R.java, databinding classes or Kotlin synthetic accessor code is put at, effectively leading to compilation errors in the said other plugin.
It would be nice if
BaseVariant
would get the ability to offer the classpath to these resources.