Is there a reason why KSP generated classes are no...
# ksp
m
Is there a reason why KSP generated classes are not visible by IDE? It is unless you add the following code in config. Generated sources are visible when we use Java Annotation Processing.
Copy code
kotlin.sourceSets.main {
    kotlin.srcDirs(
        file("$buildDir/generated/ksp/main/kotlin"),
    )
}
e
m
I see a discussion on how to overcome this limitation, but I cannot see the answer to the question why is it this way. I am pretty sure it is technically possible. First of all, ksp plugin could set source set.
o
There are long-standing design issues in KSP which prevent generated sources from being recognized as such by the IDE and by the Gradle toolchain. These problems cannot be fixed with an IDE plugin. You would still run into dependency issues with Gradle warning "Execution optimizations have been disabled..." as explained here: https://github.com/google/ksp/pull/1021#issuecomment-1204046182 and here: https://github.com/google/ksp/pull/1021#issuecomment-1205001722 The solution I had proposed got stalled, and there were no alternative suggestions offered. I have abandoned KSP since and switched to Compiler plugins.
m
I made an example using this feature, but this generated class resolution is not really needed https://github.com/MarcinMoskala/DependencyInjection-KSP
o
That one is for the other thread, right?
m
Oh, sorry, deleting ti
Thanks 🙂
842 Views