google / ksp

Kotlin Symbol Processing API
https://github.com/google/ksp
Apache License 2.0
2.84k stars 266 forks source link

Command line tool #67

Closed davidjwiner closed 4 years ago

ting-yuan commented 4 years ago

It works out of box when invoking from command line. The only caveat is that the api definition jar has to be passed in -Xplugin as well. Here is an example:

$ kotlinc \
    -classpath /path/to/test-processor-1.0-SNAPSHOT.jar \
    -Xplugin=/path/to/kotlin-symbol-processing-1.4.0-rc.jar\,/path/to/kotlin-symbol-processing-api-1.4.0-rc.jar \
    -P plugin:org.jetbrains.kotlin.ksp:apclasspath=/path/to/test-processor-1.0-SNAPSHOT.jar \
    -P plugin:org.jetbrains.kotlin.ksp:classOutputDir=/path/to/gen \
    -P plugin:org.jetbrains.kotlin.ksp:javaOutputDir=/path/to/gen \
    -P plugin:org.jetbrains.kotlin.ksp:kotlinOutputDir=/path/to/gen \
    -P plugin:org.jetbrains.kotlin.ksp:resourceOutputDir=/path/to/gen \
    /path/to/src/*.kt