Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with Kotlin #29

Open
mikehearn opened this issue Mar 30, 2018 · 4 comments
Open

Doesn't work with Kotlin #29

mikehearn opened this issue Mar 30, 2018 · 4 comments

Comments

@mikehearn
Copy link

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.

@zyxist
Copy link
Owner

zyxist commented Apr 3, 2018

Thanks for the feedback. Unfortunately I have very little experience with Kotlin, so any support with this issue is really welcome!

@Burtan
Copy link

Burtan commented Sep 7, 2018

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.

@utybo
Copy link

utybo commented Jun 25, 2019

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

@utybo
Copy link

utybo commented Jun 25, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants