pfn / kotlin-plugin

Build kotlin code using sbt
MIT License
136 stars 35 forks source link

Use embeddable version of Kotlin compiler #1

Closed Darkyenus closed 8 years ago

Darkyenus commented 8 years ago

There are two Kotlin compiler distributions, both contain (not depend on!) a few libraries, most notably Google Guava. Due to this, when kotlin-plugin is added as a dependency alongside with other plugins which depend on different version of Guava, things break with hard-to-trace errors. Kotlin is aware of this and publishes embeddable version which relocates all baked dependencies into different package, thus fixing this problem.

Workaround is EDIT: would be to add this plugin with:

addSbtPlugin("com.hanhuy.sbt" % "kotlin-plugin" % "0.9.2" exclude("org.jetbrains.kotlin", "kotlin-compiler"))

libraryDependencies += "org.jetbrains.kotlin" % "kotlin-compiler-embeddable" % "1.0.0-beta-2423"

which is not very clean. But the plugin uses some of the libraries which are relocated and breaks.

Adding -embeddable after kotlinLib("compiler in build.sbt and changing imports should be enough.

pfn commented 8 years ago

Thanks for investigating this and coming up with the workaround and solution.

Can you submit the solution as a pr? It's trivial, but I don't have much time to get to this right now