Does Kotlin Multiplatform have a way to share code...
# multiplatform
n
Does Kotlin Multiplatform have a way to share code between multiple Platform modules (eg linuxX64, linuxARMV7) where the OS (eg Linux) is the same?
i
yes you can create shared source sets that top level source sets depend on much like common is a predefined source set for all targets
in the 2nd example those show a
desktopTest
source set that is depended on by min and linux test targets
d
Small Tip: Don't be fooled by the IDE saying no. It will build just fine. There are workarounds to make the IDE happy.
h
We are working on proper support for the IDE that requires no workarounds and reusing declarations from a library’s shared platform-specific source set of this kind. Stay tuned!
🎉 6
💯 1
d
Woo! \o/
n
If i'm reading this correctly there is a single source set used (part of a Platform module) that the other source sets (part of Platform modules) depend on for shared platform logic. This doesn't sound logical from the onset.