-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to load classes generated by a KSP symbol processor #312
Comments
This is likely related to all KSP generated files being missing from |
This is also happening to me, the file is correctly generated, but the class itself doesn't get loaded into the classpath. Have you find any solution for this @ansman? |
What I'm doing right now is doing a second compilation run without processors but including the generated files, but that's only a workaround |
This is what I just thought of doing. I'll try this and see if it works. Thanks! |
Compiling the code twice works. Hope we can remove this workaround soon. Thanks for the help! |
val compilation = KotlinCompilation().apply {
...
// add this
kspWithCompilation = true
} Ksp won't generate byte code by default. Try enable the compilation with |
Ah, it turns it it's likely because I'm generating java sources and not kotlin sources. Perhaps this isn't something that KSP/Compile Testing supports? |
/** Performs the 4th compilation step to compile Java source files */
private fun compileJava(sourceFiles: List<File>): ExitCode {
val javaSources = (sourceFiles + kaptSourceDir.listFilesRecursively())
.filterNot<File>(File::hasKotlinFileExtension)
if(javaSources.isEmpty())
return ExitCode.OK
...
} Yes, only java sources from It is still the best choice to compile again after KSP compilation. And I also did this in my extensions library with module support here kotlin-compile-testing-extensions/KotlinModule |
This also worked for me! Thanks! |
Here is an example that I use:
This works fine when using the KAPT version of the processor and I have manually confirmed that the source is indeed generated.
The text was updated successfully, but these errors were encountered: