Skip to content

Commit

Permalink
Explicitly use selector.all to make plugin compatible across differen…
Browse files Browse the repository at this point in the history
…t AGP versions.
  • Loading branch information
dkostyrev committed Jun 29, 2023
1 parent 98581a3 commit 3dcacd2
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ParanoidPlugin : Plugin<Project> {

val androidComponentsExtension = project.androidComponents ?: throw GradleException("Failed to get androidComponents extension")
if (androidComponentsExtension.pluginVersion < MINIMUM_VERSION) {
throw GradleException("Paranoid requires Android Gradle Plugin version $MINIMUM_VERSION")
throw GradleException("Paranoid requires Android Gradle Plugin version ${MINIMUM_VERSION.major}.${MINIMUM_VERSION.minor}.${MINIMUM_VERSION.micro}")
}

registerParanoid(extension)
Expand Down Expand Up @@ -96,15 +96,15 @@ class ParanoidPlugin : Plugin<Project> {

private fun registerParanoid(extension: ParanoidExtension) {
project.applicationAndroidComponents?.apply {
onVariants { variant ->
onVariants(selector().all()) { variant ->
if (extension.applyToBuildTypes.isVariantFit(variant)) {
variant.createParanoidTransformTask(extension, validateClasspath = true)
}
}
}

project.libraryAndroidComponents?.apply {
onVariants { variant ->
onVariants(selector().all()) { variant ->
if (extension.applyToBuildTypes.isVariantFit(variant)) {
variant.createParanoidTransformTask(extension, validateClasspath = false)
}
Expand Down

0 comments on commit 3dcacd2

Please sign in to comment.