Ana Sekuloski
03/28/2024, 10:08 AMapply(libs.findPlugin("kotlin.multiplatform").get().get().pluginId)
apply(libs.findPlugin("android.library").get().get().pluginId)
apply(libs.findPlugin("kotlin.serialization").get().get().pluginId)
apply(libs.findPlugin("ksp").get().get().pluginId)
libs
is from version catalog. Multiplatform and Android library plugins seem to don’t have the issue. Any ideas?hfhbd
03/28/2024, 10:15 AMfindPlugin
add the plugins to your build logic classpath and just use the id, its way easier: https://github.com/hfhbd/kotlinx-uuid/tree/main/gradle/build-logicAna Sekuloski
03/28/2024, 10:18 AMfindPlugin
, but still the same error.
Thanks for the source, I’ll take a look. Maybe I’m implementing the Plugin
interface wrongly, I see you’re not using it.Adam S
03/28/2024, 10:21 AMplugins {}
block, then Gradle will do some behind-the-scenes magic to automatically add the plugin to the build script classpath. But if you use the apply()
method, without the plugins {}
block, then you need to add the plugins to the build script classpath.hfhbd
03/28/2024, 10:24 AMkotlin-dsl
) to have the same DevEx comparing to "normal" build.gradle.kts allowing code sharing and reduces complexity.Adam S
03/28/2024, 10:25 AMhfhbd
03/28/2024, 10:25 AMAdam S
03/28/2024, 10:25 AMAdam S
03/28/2024, 10:26 AMAna Sekuloski
03/28/2024, 10:55 AMimplementation
in dependencies
of build.gradle.kts
. Seems that the problem is resolved now.
I agree that Philip’s approach is simpler, I’ll try to re-implement with it.Ana Sekuloski
03/28/2024, 2:38 PMkotlin {}
block in my plugin gradle script.
I’m adding the kotling jvm plugin:
dependencies {
implementation(libs.plugins.kotlin.jvm.toDep())
}
however, the build is failing with:
Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun DependencyHandler.kotlin(module: String, version: String? = ...): Any defined in org.gradle.kotlin.dsl
public fun PluginDependenciesSpec.kotlin(module: String): PluginDependencySpec defined in org.gradle.kotlin.dsl
hfhbd
03/28/2024, 2:47 PMimplementation(libs.plugins.kotlin.multiplatform.toDep())
but it depends on your libs.versions.toml entry.Ana Sekuloski
03/28/2024, 2:51 PM