Adam
03/14/2023, 5:49 PMbuildSrc/build.gradle.kts
, and the plugin versions would be the same in both the convention plugins, and if they were applied directly in subprojects. I liked that there was one central place were the plugin versions were defined.
When I change from buildSrc to an included build, I lose this feature. Even though the plugins are still defined in build-logic/build.gradle.kts
I have to specify the plugin version again in subprojects. This means there's not a central place where plugins are defined.
I know there's plugin aliases in libs.versions.toml
, but I'm not a fan of this because the kts implementation is janky ("val Project.libs: LibrariesForLibs' can't be called in this context..."), and I have to define both the plugin ID and the Maven coordinates. I preferred the buildSrc method.
Is there a nice way of having all the plugins defined in one place while using included build?ephemient
03/14/2023, 5:51 PMChris Lee
03/14/2023, 5:51 PMpublic fun DependencyHandlerScope.plugin(id: String, version: String): String =
"$id:$id.gradle.plugin:$version"
public fun DependencyHandlerScope.plugin(plugin: Provider<PluginDependency>): Provider<String> =
plugin.map { "${it.pluginId}:${it.pluginId}.gradle.plugin:${it.version}" }
ephemient
03/14/2023, 5:52 PMAdam
03/14/2023, 5:54 PMephemient
03/14/2023, 5:58 PM