Now, I’m adding kotlin-api to my framework.
The existing java-api uses annotation processor, the user gradle code looks like this
annotationProcessor(project("org.babyfish.jimmer:jimmer-apt:0.0.35"))
it’s very simple, isn’t it?
However, the kotlin-api should use KSP, the user gradle code looks like this
plugins {
id("com.google.devtools.ksp") version "1.6.21-1.0.5" // 1
}
dependencies {
ksp(project("org.babyfish.jimmer:jimmer-ksp:0.0.35")) //2
}
kotlin {
sourceSets.main {
kotlin.srcDir("build/generated/ksp/main/kotlin") //3
}
}
- Add the ksp plugin
- Use ksp plugin to generate source files
- Add generated source files into compile path.
From the user’s point of view, using KSP is more troublesome than using annotation processor. Is there a way to make using KSP as easy as using annotation processor?