https://kotlinlang.org logo
n

natpryce

01/28/2019, 11:34 AM
Does the kotlin-multiplatform plugin create standard source-sets that are dependencies of all native targets? E.g. it creates the standard commonMain and commonTest source sets, which are dependencies of all targets, which can contain code that uses kotlin-stdlib-common. Is there equivalent for native targets, which relies on stdlib features common to all native platforms? (is that even a thing?)
i

icarumbas

01/28/2019, 12:36 PM
You can use dependsOn with source sets. Create commonNative in sourceSets and depend on it
n

natpryce

01/28/2019, 12:37 PM
which dependency should I use in the commonNative source set to get stdlib definitions for all native platforms?
i

icarumbas

01/28/2019, 12:45 PM
everything u need is already in common
n

natpryce

01/28/2019, 12:45 PM
Not in 1.3.20 it’s not. Common doesn’t have Char.isLetter, Char.isDigit, but they do exist on native platforms
m

max.cruz

02/24/2019, 6:27 PM
Notice that Char.isDigit isn’t in Common, just in JVM and Native, so my solution is to create an extension function isDigitCommon declare it as expect and provide the specific implementation in JVM and Native modules
t

Thomas

03/05/2019, 2:02 PM
@natpryce did you find a solution?
n

natpryce

03/05/2019, 2:58 PM
I defined the source set and dependency relationships explicitly in the Gradle file