Playing with KSP on a multiplatform project, compi...
# ksp
g
Playing with KSP on a multiplatform project, compilation is crashing because of multiple classesDirs (as I understand it). It's crashing in KotlinJsIrLink:l54 where the code use a .single() on a list that (I suppose) has the classes dir + the generated dir. Is my understanding correct and should I discuss this in multiplatform/JS instead?
t
Can you provide a test case or stacktrace? So that we can understand what happened better and whether it should be fixed in KSP or compiler
g
Here a simple project that reproduces the error, stacktrace available in the README.md https://github.com/glureau/ksp-kmp-issues/tree/kotlinjsir_single_crashing
Note that I also reproduced another issue with an infinite build time on another branch. Build ends with a stackoverflow due to recursive calls for some reasons. Not related to the other issue I think, you can reproduce the issue on this branch https://github.com/glureau/ksp-kmp-issues/tree/stackoverflow
I've asked on the javascript channel for help on the IR limitation, and created an issue for the crash. Let me know if I can help with the KotlinJsIr limitation as I didn't found any workaround so far and it's quite annoying.
t
Thanks a lot for the test case and filing the issues! I'll take a look next week.
🙏 1
a
If helpful, I’ve also ran into the “Collection has more than one element” error when trying to add a
js
target with
ksp
in my multiplatform branch here: https://github.com/livefront/sealed-enum/tree/av/multiplatform-js-ksp-error
🙏 1
👍 1
g
Should I create a Kotlin Js/IR issue for the
Collection has more than one element.
error?
I think I've found an ugly workaround : don't provide the annotation interface in a dedicated module but duplicate it in every modules where you need to run KSP. Each duplicated annotation must have a different name. Then I pass the full name manually via gradle KSP options to the processor.