I'm working on a project combining groovy
and kotlin
.
My Kotlin classes require objects from groovy part, how can i make gradle compile groovy before kotlin ?
I'm using Gradle 6.3
with kotlin-dsl
I've tried several solutions : srcsets order, tasks order, ... Nothing seems to work
Any idea ?
Thanks to tim_yates ! (why this documentation doesn't come out on google 😧)
Here is the adaptation of documentation for kotlin
& groovy
tasks.named<AbstractCompile>("compileGroovy") {
// Groovy only needs the declared dependencies
// (and not longer the output of compileJava)
classpath = sourceSets.main.get().compileClasspath
}
tasks.named<AbstractCompile>("compileKotlin") {
// Java also depends on the result of Groovy compilation
// (which automatically makes it depend of compileGroovy)
classpath += files(sourceSets.main.get().withConvention(GroovySourceSet::class) { groovy }.classesDirectory)
}