We have a pretty basic preprocessor task coming (g...
# ksp
s
We have a pretty basic preprocessor task coming (generating a documentation file containing all the classes/methods in the project with a special annotation). Normally I'd use KAPT, since KSP is still in Alpha, but it's unclear if KAPT will support the new compiler frontend. So how is the situation with KSP? Does it already work with the new frontend? Since my task is so straight forward, I think, I'd be ok with updating/adapting my code through different alpha versions of KSP, or is this a bad idea?
b
Kapt works with .class files, so it'll never go away. Otherwise you couldn't use java processors with kotlin.
It's also one of the reasons why kapt is much slower than ksp
s
JetBrains doesn't seem to be equally sure about KAPT being supported with the new frontend. (I did ask in general-channel first)
I just saw that KSP seemed to have reached beta-status 13 days ago 🙂 (see https://github.com/google/ksp/releases)
b
Sorry for spreading misinformation, then. Although I think it's important that kapt(or equivalent) stays so that we'd still be able to write java annotation processors in kotlin.
Maybe ksp will eventually support that too somehow to avoid duplicated effort
e
We are starting to use KSP for our internal processors now. APIs should be stable now that it is in beta, although small bugs may exist - but likely not a big problem for you for a simple processor. I would recommend using https://github.com/androidx/androidx/tree/androidx-main/room/room-compiler-processing to create your processor so you have the flexibility to switch between ksp and kapt if needed. It is working well for us so far
j
we are now in beta and you can expect APIs will be mostly stable
👍 1
s
@elihart I'm actually working serverside/jvm, not on android. I assume that ksp is applicable there as well!?
b
I can confirm that it is
👍 1
e
yes, it is not android specific. it supports jvm right now but will be multi platform eventually