https://kotlinlang.org logo
Title
s

Stewart Stewart

11/30/2021, 7:50 PM
Can ksp be used as a drop-in replacement for kapt with hibernate-jpamodelgen? When I tried it, no sources were generated.
j

Jiaxiang

11/30/2021, 8:25 PM
You can’t just replace KAPT with KSP, the processor itself has to support ksp, my suggestion is to reach out to the developer of the processor you are using, to see if they support/plan to support ksp.
a

Alex Vanyo

11/30/2021, 8:28 PM
KSP’s APIs and how it views code is quite different than KAPT. If there is a library with an existing annotation processor that works with KAPT, you won’t be able to run KSP with that existing processor directly due to those differences. In order to use KSP, the library authors would have to convert the existing annotation processor to use KSP’s APIs, or maintain two annotations processors: the existing one that works with KAPT, and a KSP one. Once the library has a KSP processor that functions almost identically to the KAPT processor, then on the consuming side it looks like a drop-in replacement: swap out
kapt
with
ksp
and switch which processor is being used.
:today-i-learned: 1
s

Stewart Stewart

11/30/2021, 8:31 PM
I see. So the deprecation message at the top of the kapt doc is really just for compiler plugin authors, which is mildly confusing.
j

Jiaxiang

11/30/2021, 8:45 PM
it says
maintenance mode
not quite same as deprecation.
s

Stewart Stewart

11/30/2021, 8:46 PM
Fair enough! dev see big red banner scary no read
😂 3