chainsaw
chainsaw copied to clipboard
Doesn't work with Kotlin
Unfortunately my Gradle-fu is not strong enough to debug this, but basically - create a hello world Kotlin project, create a module-info.java file, add Chainsaw and it doesn't work. The java compiler can no longer see the Kotlin generated classes.
Kotlin also does a lot of interesting reconfiguration of tasks and things in order to allow Java/Kotlin code to see and call each other, so undoubtably, they're clashing somewhere and Chainsaw is undoing the Kotlin build modifications.
Thanks for the feedback. Unfortunately I have very little experience with Kotlin, so any support with this issue is really welcome!
Try these lines (for gradle kotlin DSL)
val compileKotlin: KotlinCompile by tasks
val compileJava: JavaCompile by tasks
compileJava.destinationDir = compileKotlin.destinationDir
It has to do with the directories gradle uses to generate the module.
Bug is still here, Gradle complains about not finding the packages declared using the Kotlin language when exporting them through the module-info file. @Burtan's solution's works flawlessly, huge thank you sir!
EDIT: Here is an example
module-info.java
module my.module {
exports package.made.in.kotlin
}
Error:
C:\...\src\main\java\module-info.java:2: error: package is empty or does not exist: package.made.in.kotlin
Multi-project builds seem to be broken in Kotlin even with the workaround. Projects that depend on other projects in the same multi-project build complain about missing modules.