https://kotlinlang.org logo
#compiler
Title
# compiler
e

elect

10/24/2023, 7:00 PM
would it be possible for a compiler plugin to retrieve all the classes with a specific annotation, in third dependencies as well, in multiplatform?
f

Filip Dolník

10/25/2023, 11:33 AM
yes, but it depends on what you want to do with those classes. Basically you need a plugin that hooks into the linking phase that produces the framework. I’ve described this approach in this thread: https://kotlinlang.slack.com/archives/C7L3JB43G/p1698116255957259
e

elect

10/25/2023, 4:41 PM
I'll like to collect those classes to instantiate them later on I'm investigating how to get this behavior of Scijava in Kotlin multiplatform But I'm evaluating also KSP at the moment, I'm kind of afraid a compiler plugin would be overkill (I'm totally unfamiliar with them)
f

Filip Dolník

10/25/2023, 4:43 PM
Yeah KSP would be a preferred solution for this. You might want to take a look at the implementation of KMP-NativeCoroutines and Moko-kswift
e

elect

10/25/2023, 4:44 PM
why, are they doing something similar?
f

Filip Dolník

10/25/2023, 4:46 PM
yes, but each has a slightly different approach if I remember correctly.