How would I specify in my gradle file that the code should be applicable to both the 64 bit and the 32 bit version of windows?
a
Artyom Degtyarev [JB]
04/27/2020, 9:52 AM
That can be done by providing an intermediate source set, adding it as a dependency for both of your mingw targets. Something like the old approach of iOS code sharing described here.
The problem here is that all platform libraries resolve can break up. In most cases, IDE just presumes the intermediate source set is just a common Kotlin code. There are several workarounds like enabling
Copy code
kotlin.mpp.enableGranularSourceSetsMetadata=true
in the project’s
gradle.properties
, but IIRC there are no guarantees for it’s help.
100% working method will be sharing all platform-independent code as a common, and duplicate all platform-dependent in both of the target’s default source sets(