I’m using the Kotlin command-line compiler to compile my Kotlin source files. When I add the Kapt compiler plugin, it only produces the files my AP is supposed to produce and some other stuff like stubs, etc. Unlike javac
, it doesn’t generate any .class
file.
This is how my argfile looks like:
-cp my-lib.jar
-d build/classes
-Xplugin="C:/Program Files/Java/jdk1.8.0_281/lib/tools.jar"
-Xplugin=kotlinc/lib/kotlin-annotation-processing.jar
-P "plugin:org.jetbrains.kotlin.kapt3:sources=build/kapt/classes"
-P "plugin:org.jetbrains.kotlin.kapt3:classes=build/kapt"
-P "plugin:org.jetbrains.kotlin.kapt3:stubs=build/kapt/stubs"
-P "plugin:org.jetbrains.kotlin.kapt3:aptMode=stubsAndApt"
-P "plugin:org.jetbrains.kotlin.kapt3:apclasspath=my-ap.jar"
-P "plugin:org.jetbrains.kotlin.kapt3:apoptions=<encoded_ap_opts>"
src/com/example/Test.kt
One option I see is to run the compiler twice, first to compile sources to .class files and then, generate to the AP files using Kapt. But I’d really like to know if there’s a way to do both of those things in one go.