Migrate to v5.x
Transform API
There are no changes to the Transform API and no migration is required.
Task API
VariantProcessor
Replace BaseVariant
with Variant
in the process
method:
override fun process(variant: BaseVariant) {
// ...
}
2
3
override fun process(variant: Variant) {
// ...
}
2
3
Gradle Compat
AGPInterface
In Booster 5.0.0, all APIs with BaseVariant
in AGPInterface
have been replaced with Variant
, and some Task
related APIs have been deprecated. Although they have not been completely deleted, they are not recommended to be used and can basically be considered unusable -- the Task
will be null at runtime.
Project Extension
Similar to AGPInterface
, the Project
extension APIs in v4.x is retained as much as possible, the BaseVariant
parameter in the method is replaced with Variant
, and some methods are refactored.
getAndroid / getAndroidOrNull
Replace Project.getAndroid(...)
with Project.getAndroidComponents()
, and replace Project.getAndroidOrNull(...)
with Project.getAndroidComponentsOrNull()
:
val android = getAndroidOrNull<BaseExtension>()
val androidComponents = getAndroidComponentsOrNull<AndroidComponentsExtension<*, *, *>>()
getResolvedArtifactResults
Replace variant with filter in Project.getResolvedArtifactResults(...)
method
val result: Set<ResolvedArtifactResult> = project.getResolvedArtifactResults(
true,
variant
)
2
3
4
val result: Set<ResolvedArtifactResult> = project.getResolvedArtifactResults(
true,
variant.filterByNameOrBuildType()
)
2
3
4