I am developing a Gradle plugin according to the d...
# gradle
a
I am developing a Gradle plugin according to the documentation. Am I correct that we can't (or won't) use the Kotlin JVM plugin for writing plugins? But it is as follows?
Copy code
plugins {
    `java-gradle-plugin`
    `kotlin-dsl`
}

sourceSets {
    main {
        kotlin {
            srcDir("src/main/kotlin")
        }
    }
}
https://docs.gradle.org/current/userguide/custom_plugins.html#sec:custom_plugins_standalone_project EDIT: well.... actually that just works, after removing
kotlin-dsl
. I am a bit uncertain whether or not kotlin-dsl was needed. I suppose it wasnt. A plugin is 'just' another project.
h
You don’t need the first plugin too. The sourceSet is also not needed. But the kotlin-dsl plugin adds the SAM plugin.
a
Yeah I removed it. I need the first one for:
Copy code
gradlePlugin {
    plugins {
        create("wiredPlugin") {
            id = "nl.helicotech.wired.plugin"
            implementationClass = "nl.helicotech.wired.plugin.WiredPlugin"
        }
    }
}
v
kotlin-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.
👍 3