Udi Cohen
08/23/2021, 8:31 PMkotlinc
command doesn't compile the project's classes and places them in the output folder.
As a repro example using the playground project, after running the following command I don't see anything in the build2/classes
folder. I do however see the generated AClassBuilder
class inside build2/generated/ksp/main/kotlin
.
kotlinc \
-d /Users/udinic/projects/ksp-playground4/workload/build2/classes \
-verbose \
-cp /Users/udinic/projects/ksp-playground4/test-processor/build/libs/test-processor-1.0-SNAPSHOT.jar \
-Xplugin=/Users/udinic/tmp/ksp-stuff/symbol-processing-api-1.5.21-1.0.0-beta07.jar \
-Xplugin=/Users/udinic/tmp/ksp-stuff/symbol-processing-cmdline-1.5.21-1.0.0-beta07.jar \
-P plugin:com.google.devtools.ksp.symbol-processing:apclasspath=/Users/udinic/projects/ksp-playground4/test-processor/build/libs/test-processor-1.0-SNAPSHOT.jar \
-P plugin:com.google.devtools.ksp.symbol-processing:projectBaseDir=/Users/udinic/projects/ksp-playground4/workload/src/main/java \
-P plugin:com.google.devtools.ksp.symbol-processing:classOutputDir=/Users/udinic/projects/ksp-playground4/workload/build2/classes/kotlin/main \
-P plugin:com.google.devtools.ksp.symbol-processing:kotlinOutputDir=/Users/udinic/projects/ksp-playground4/workload/build2/generated/ksp/main/kotlin \
-P plugin:com.google.devtools.ksp.symbol-processing:javaOutputDir=/Users/udinic/projects/ksp-playground4/workload/build2/generated/ksp/main/java \
-P plugin:com.google.devtools.ksp.symbol-processing:resourceOutputDir=/Users/udinic/projects/ksp-playground4/workload/build2/generated/ksp/main/resources \
-P plugin:com.google.devtools.ksp.symbol-processing:cachesDir=/Users/udinic/projects/ksp-playground4/workload/build2/generated/ksp/main/cache \
-P plugin:com.google.devtools.ksp.symbol-processing:kspOutputDir=/Users/udinic/projects/ksp-playground4/workload/build2/ksp \
/Users/udinic/projects/ksp-playground4/workload/build2/generated/ksp/main/kotlin/ /Users/udinic/projects/ksp-playground4/workload/src/main/java
If I disable KSP, by removing the -Xplugin
params, I will see the compiled classes in the classes folder, but without any new generated classes of course.
Is there something missing in my command?Ting-Yuan Huang
08/23/2021, 10:24 PM-Xplugin
only calls processors to generate sources but not compile them into classes. You'll need a second compiler invocation (without -Xplugin
and corresponding arguments) to compile them, as if the generated sources are provided / hand-written.Udi Cohen
08/23/2021, 10:34 PMTing-Yuan Huang
08/23/2021, 10:38 PMUdi Cohen
08/23/2021, 10:47 PMTing-Yuan Huang
08/23/2021, 11:07 PMUdi Cohen
08/23/2021, 11:31 PMKSPLogger
is printing to the terminal when using gradle --debug
, but is there a way to get KSPLogger
to print to stdout when using command line?
Thanks.Ting-Yuan Huang
08/23/2021, 11:38 PM-Dkotlin.daemon.jvm.options="-Xdebug,-Xrunjdwp:transport=dt_socket\,address=8765\,server=y\,suspend=y"
is useful.
If running directly from command line, there should be a way to specify jvm options similar to the above, but I cannot really recall.Ting-Yuan Huang
08/23/2021, 11:40 PMlogger.warn()
(either KSPLogger or it's underlying impl.) should make it always print to stdout.Udi Cohen
08/23/2021, 11:55 PM