so in a gradle plugin with kotlin-dsl i can do eve...
# gradle
n
so in a gradle plugin with kotlin-dsl i can do everything, except doing things with the kotlin plugin eg. add kotlin sourceSets
t
It is not related to Kotlin DSL, but rather to Kotlin plugin itself. As for adding sourcesets - should be possible using extension
n
what do you mena using extension? configuring the kotlin extension or passing in the sourceset using my own exension ?

https://i.imgur.com/IA4KAEl.pngâ–¾

i can try that but it seems like nothing kotlin plugin related is available for import
t
This works for me:
Copy code
project.extensions.findByType(KotlinJvmProjectExtension::class.java)?.sourceSets
Copy code
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
n
i managed to make it work by adding it as depedency and loading it as a plugin, was just a wild guess but it seems to work
i also managed to make my plugin apply("kotlin")
t
that is true, without adding it as a dependency IDEA can't find it and import 🙂
n
but why does i also need it in the plugin block ?
that confused me
t
can you elaborate, I don't get it?
n
Copy code
plugins {
    kotlin("jvm")
    `java-gradle-plugin`
    id("org.gradle.kotlin.kotlin-dsl") version "1.0-rc-6"
//    id("org.gradle.kotlin.kotlin-dsl.precompiled-script-plugins") version "1.0-rc-6"
    `maven-publish`
}

dependencies {
    compile(project(":poet"))
    compile(group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version = "1.2.71" /*Versions.kotlin*/)
}
i need to either have kotlin("jvm") in the plugin block or apply it, otherwise it does not work either
or maybe i am confused ad i was just another side effect that i fixed
t
you need in plugins block only that plugin that your project is using, and I suppose you project is using kotlin. If you are using groovy then you don't need
kotlin("jvm")
in plugins
n
except the kotlin-dsl loads kotlin already
t
kotlin-dsl loads kotlin only for build scripts
it doesn't applied to project files itself
n
anyways.. that seems to be fixed now too.. disregard my last few messages
t
n
i will.. for now i have a working plugin that sets up sourceSets, generates kotlin sources and discovers tasks based on scripts it finds in configurable folders