https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
s

serebit

11/23/2019, 7:18 PM
What's the status of code generation for multiplatform projects where the code to be generated needs to be in the common source set?
r

russhwolf

11/23/2019, 7:26 PM
Code generation is very doable. Just add your generated code dir to your common source dirs. What’s hard is introspecting on common code so you know what you want to generate. But whether that’s an issue or not depends on your use-case.
s

serebit

11/23/2019, 7:29 PM
My particular problem requires generation of members of a sealed class, which complicates things. As far as I'm aware, only Kotlin/JVM supports multifile classes, so I need to insert code into a class within my common source dir before compile time and remove it after compilation completes. Is there another way to do this?
r

russhwolf

11/23/2019, 7:31 PM
Sounds hard. Probably would be easier to generate the entire sealed class instead of just some members. But I haven’t ever tried to do anything like this.
2 Views