I've found the following configuration in the <doc...
# ksp
n
I've found the following configuration in the documentation:
Copy code
dependencies {
    add("kspCommonMainMetadata", project(":test-processor"))
    add("kspJvm", project(":test-processor"))
    add("kspJvmTest", project(":test-processor"))
}
But how should I configure KSP to process classes in
src/commonTest/kotlin
?
kspCommonTestMetadata
does not seem to exist...
Besides, KSP does not seem to process in
src/jvmTest/kotlin
with the above configuration. But if I move the file to
src/jvmMain/kotlin
everything works as expected.
I'm really confused after I found this 🙂: https://github.com/google/ksp/issues/1365
p
Hey Norbi, is it really working for you? You get your common code processed and the generated code is placed correctly? If so, would you mind to share your setup? Thanks
n
@Pavel Lahoda This works for me currently for my actual project setup:
Copy code
dependencies {
    add("kspCommonMainMetadata", project(":test-processor"))
}

tasks.withType<KotlinCompile<*>>().all {
    if (name != "kspCommonMainKotlinMetadata") {
        dependsOn("kspCommonMainKotlinMetadata")
    }
}

kotlin.sourceSets.commonMain {
    kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin")
}
e
This is exactly the nugget of information I needed to get my multi platform KSP experiment going.
p
I got it running as well. Found a problem, that there are actually two variants of KotlinCompile, org.jetbrains.kotlin.gradle.tasks.KotlinCompile and org.jetbrains.kotlin.gradle.dsl.KotlinCompile. The former is the correct one to use - at least that was the source of problems for me.