Slackbot
05/03/2023, 9:49 PMVampire
05/03/2023, 9:54 PMtarget.plugins
, have a look at its (getPlugins()
) JavaDoc.
Besides that, if you develop a convention plugin, the you specify your dependencies and their versions in the build script of the project building those convention plugins. So specifying the plugin as implementation
dependency in the build building the plugin and then applying it in your convention plugin is practically the same as your second snippet.Gábor Török
05/03/2023, 10:00 PMtarget.plugins
?
i am using Kotlin to develop my plugins, and in kotlin target.getPlugins()
and target.plugins
are the same. in fact i am getting a warning that i should use property access syntax instead of the getter method…Vampire
05/03/2023, 10:01 PMVampire
05/03/2023, 10:02 PMtarget.apply(...)
Gábor Török
05/03/2023, 10:08 PMclass KotlinConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
target.apply {
it.plugin("org.jetbrains.kotlin.jvm")
}
}
}
Vampire
05/03/2023, 10:21 PMVampire
05/03/2023, 10:21 PMtarget._apply_(plugin = "org.jetbrains.kotlin.jvm")
Gábor Török
05/04/2023, 3:24 AMGábor Török
05/04/2023, 3:31 AMclass KotlinConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
target.apply(plugin = "org.jetbrains.kotlin.jvm")
}
}
what am i doing wrong?Vampire
05/04/2023, 6:41 AMgradleKotlinDsl()
that you might want to add as dependency to compileOnly
and maybe testImplementation
. Or you could apply the kotlin-dsl
plugin which also does a few other things.Vampire
05/04/2023, 6:42 AMkotlin-dsl
applies java-gradle-plugin
, kotlin-dsl.base
, and kotlin-dsl.precompiled-script-plugins
plugins
kotlin-dsl.base
plugin applies embedded-kotlin
, adds gradleKotlinDsl()
to the dependencies of compileOnly
and testImplementation
configurations, and configures the Kotlin DSL compiler plugins for example for proper SAM conversion for Action
and similar.Gábor Török
05/05/2023, 10:26 PM