Why does Now in Android mix pluginManager.apply(...) and apply(...) when convention plugins? #1931
-
I was studying the convention plugin Kotlin files under the class AndroidApplicationComposeConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
apply(plugin = "com.android.application")
apply(plugin = "org.jetbrains.kotlin.plugin.compose")
val extension = extensions.getByType<ApplicationExtension>()
configureAndroidCompose(extension)
}
}
} class AndroidApplicationJacocoConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
pluginManager.apply("jacoco")
val androidExtension = extensions.getByType<ApplicationExtension>()
androidExtension.buildTypes.configureEach {
enableAndroidTestCoverage = true
enableUnitTestCoverage = true
}
configureJacoco(extensions.getByType<ApplicationAndroidComponentsExtension>())
}
}
} From what I understand, Is there a specific reason or benefit to mixing these two approaches? Wouldn’t it be clearer and more consistent to pick one style (for example, always using ₩pluginManager.apply(...)₩) throughout the build-logic convention plugins? I’d appreciate any insight into why the project chooses to use both styles. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
There is probably no good reason, you are more than welcome to draft a PR to unify these usages 👍 |
Beta Was this translation helpful? Give feedback.
There is probably no good reason, you are more than welcome to draft a PR to unify these usages 👍