https://kotlinlang.org logo
Title
g

Grégory Lureau

10/03/2021, 9:00 PM
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

Ting-Yuan Huang

10/04/2021, 6:53 PM
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

Grégory Lureau

10/05/2021, 9:18 PM
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

Ting-Yuan Huang

10/09/2021, 4:07 AM
Thanks a lot for the test case and filing the issues! I'll take a look next week.
🙏 1
a

Alex Vanyo

10/11/2021, 7:03 PM
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

Grégory Lureau

10/20/2021, 7:53 AM
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.