Kotlin-compiler-embeddable vs kotlin-compiler

There are two different maven packages relevant to kotlin compiler:

What are the differences between the two and when should they be used respectively?

1 Like

kotlin-compiler-embeddable should be used in scenarios when it’s necessary to have the compiler packaged as a single jar with no external dependencies. In all other cases, use the regular kotlin-compiler.


Hey Dmitry,

I’ve been working on Kotlin support for Bazel, one thing I’ve noticed is that:

1P Jetbrains compiler plugins are built against https://github.com/JetBrains/kotlin/tree/master/compiler/plugin-api which includes in the method signature for ComponentRegistrar. registerProjectComponents(com.intellij.mock.MockProject, CompilerConfiguration): https://github.com/JetBrains/kotlin/blob/2f835ed66f0583cbcf92f05fd8842910f5d56f10/compiler/plugin-api/src/org/jetbrains/kotlin/compiler/plugin/ComponentRegistrar.kt#L19

3P plugins tend to be built against kotlin-compiler-embeddable which includes in the method signature org.jetbrains.kotlin.com.intellij.mock.MockProject instead.

Bazel Kotlin rules use kotlin-compiler which works fine for 1P plugins, but 3P plugins fails with an AbstractMethodError because the signature doesn’t match for ComponentRegistrar. registerProjectComponents(MockProject, CompilerConfiguration).

I’m guessing the right thing to do is to have the Kotlin rules use compiler-plugin-embeddable here?

Note that the kotlin-compiler-embeddable artifact is missing source code (even though there is a -sources.jar, it’s empty). To be able to debug it from an IDE I had to download the kotlin-compiler-1.5.10-sources.jar file and point the IDE to it manually.