rules_kotlin
rules_kotlin copied to clipboard
Generate KSP classes jar as output
Fixes #1328
Right now, the ksp generated src JAR has the generated sources and files from META-INF/. This doesn't suffice for KSP processors (Micronaut) which rely on generated .class files in annotation processing which isn't included in that jar now. We could include these files in that src jar but wasn't sure if it makes sense to include .class files, so I've added another output to the KotlinKsp task which generates this jar and is then forwarded as one of the outputs of the kt_jvm_library action.
I'll test this internally and verify it fixes our issue. I wanted to add tests with Micronaut in src/test along with the existing KSP test cases, but Micronaut 4/KSP requires Java 17 which would require upgrading rules_kotlin to Java 17 which could be a breaking change for other users, so I didn't (let me know if I should). Instead I've added tests with a dummy processor that generates bytecode and updated the tests to verify the functionality.