Calling kotlinc with plugins from the command line

I am trying to understand how kotlin compiler plugins are invoked using the command line (not with gradle or maven). I have a few questions using the allopen plugin as an example…

Consider the following invocation of the kotlin compiler:

java
-cp kotlin-preloader.jar
-cp kotlin-compiler.jar
org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
-d myjar.jar
-P plugin:allopen:annotation=com.my.Component
-cp allopen-compiler-plugin.jar:mylib.jar
MyFile.kt

  1. Where should the allopen-compiler-plugin jar go? In the last classpath (for kotlin file deps), the classpath to the preloader, or the classpath to java itself?

  2. What is the significance of the plugin name “allopen” (in plugin:allopen:key=value) ? Is this used to match against some token that’s hardcoded into the plugin implementation?

Thanks in advance,

Paul

1 Like