https://kotlinlang.org logo
Title
s

salomonbrys

11/03/2021, 9:21 AM
Hey guys. I am having a weird problem. I have a SymbolProcessor that generates source files, which I use on a Multiplatform Project. When I run
kspTestKotlinJvm
(the SP is supposed to be applied on test sources), generation happens normally and
build/generated/ksp/jvmTest/kotlin
is properly populated. However, if I run
kspTestKotlinJvm
a second time (without changing anything), all generated files are removed and
build/generated/ksp/jvmTest
is left empty (which of course makes the compilation fail). I’ve tracked it down to this gradle configuration:
sourceSets {
    val jvmTest by getting {
        kotlin.srcDir("build/generated/ksp/jvmTest/kotlin")
    }
}
So, the fact that I add the generated sources as a sourceset makes KSP remove them ?!?
I’ve fixed the bug by properly defining a source file in the
Dependencies
of the
CodeGenerator
.
👍 1