How does one include the compose compiler when inv...
# compiler
d
How does one include the compose compiler when invoking from the command line with K2? With 1.9, we passed compose as a plugin, but now the following minimal repro case results in an exception:
Copy code
$ bin/kotlinc -Xplugin=lib/compose-compiler.jar
The exception:
Copy code
error: the provided plugin androidx.compose.compiler.plugins.kotlin.ComposePluginRegistrar is not compatible with this version of compiler.
java.lang.AbstractMethodError: Receiver class androidx.compose.compiler.plugins.kotlin.ComposePluginRegistrar does not define or inherit an implementation of the resolved method 'abstract void registerProjectComponents(com.intellij.mock.MockProject, org.jetbrains.kotlin.config.CompilerConfiguration)' of interface org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar.
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.registerExtensionsFromPlugins$cli_base(KotlinCoreEnvironment.kt:755)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$ProjectEnvironment.registerExtensionsFromPlugins(KotlinCoreEnvironment.kt:194)
        at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:91)
        at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:43)
        at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:103)
j
Seems like you're using the wrong version of the compose compiler. You need the one that has undergone jarjar to move the IntelliJ types into a shadowed package.
d
This is the one downloaded directly from github releases?
j
Actually sorry it's the inverse. Seems like you are using the jarjar'd one but need the one which is not jarjar'd.
d
how do i get one that has not been jarjar'ed?
i see this with both the 2.0.20 and 2.0.21 releases
d
just to make sure I understand, the jar that comes bundled with the release does not work as a plugin? https://github.com/JetBrains/kotlin/releases/tag/v2.0.21
(that is where our build system currently pulls from)
j
Right. That is produced by this module (https://github.com/JetBrains/kotlin/blob/master/plugins/compose/compiler/build.gradle.kts) which is the one that does jarjar-ing. If you were building it yourself you'd consume it from the 'compiler-hosted' module (https://github.com/JetBrains/kotlin/blob/master/plugins/compose/compiler-hosted/build.gradle.kts). They probably just didn't update whatever is attaching both versions of the binaries to the release. It's weird that they even bother including one specific plugin and no others.
👍 1
d
Thank you. This is info I can act upon.
d
cc @shikasd
s
It sounds like you are using the -embeddable version instead of regular compiler plugin. I am not sure what is shipped with a GitHub release, but I assume it is both
d
there is only the one compose jar
image.png
s
We might want to include the correct jar (or both?) with the future releases. I assumed that the one that was being shipped was already correct