I'm working on a custom Gradle setup using Kotlin DSL, and while exploring the nowinandroid project—specifically the convention/build.gradle.kts and libs.versions.toml files—I noticed an inconsistency in how plugin IDs are accessed from the
libs.versions.toml
version catalog in the
build-logic:convention
module.
Vivek Modi
04/15/2025, 6:28 PM
Copy code
gradlePlugin {
plugins {
register("androidApplicationCompose") {
id = libs.plugins.nowinandroid.android.application.compose.get().pluginId
implementationClass = "AndroidApplicationComposeConventionPlugin"
}
register("androidApplication") {
id = libs.plugins.nowinandroid.android.application.asProvider().get().pluginId
implementationClass = "AndroidApplicationConventionPlugin"
}
// ... more plugins
}
}
Vivek Modi
04/15/2025, 6:29 PM
Some plugin IDs use
.get()
directly (e.g.,
compose.get()
), while others use
.asProvider().get()
(e.g.,
application.asProvider().get()
).
Vivek Modi
04/15/2025, 6:29 PM
From the
libs.versions.toml
, these plugins are declared normally under
[plugins]
or indirectly referenced.
My questions are:
1. What's the difference between
plugin.get()
and
plugin.asProvider().get()
?
2. Is one preferred over the other in certain scenarios?
3. Could this difference be caused by how the plugin is defined in
libs.versions.toml
?
Any clarification would be helpful! I'm trying to standardize how plugins are registered in the convention plugins module.
e
ephemient
04/15/2025, 6:33 PM
it's just an artifact of the accessor types. if you have