mzgreen
01/04/2022, 5:57 PMnativeMain
target. I did this:
val commonMain by sourceSets.getting
val commonTest by sourceSets.getting
val nativeMain by sourceSets.creating
nativeMain.dependsOn(commonMain)
targets.withType<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget>().all {
val mainSourceSet = compilations.getByName("main").defaultSourceSet
val testSourceSet = compilations.getByName("test").defaultSourceSet
mainSourceSet.dependsOn(nativeMain)
testSourceSet.dependsOn(commonTest)
}
I also added Okio
library as a dependency in commonMain
.
Now I'm trying to use Okio in a kotlin file inside nativeMain
directory but it doesn't work. Looks like the dependency is not being correctly picked up.
If instead of creating this custom nativeMain
source set I just use a single one like macosX64
and then put my kotlin file inside macosX64
directory then I can use the Okio and it works fine.
What am I doing wrong that the dependency doesn't work in my custom nativeMain
source set?Paul Woitaschek
01/04/2022, 5:57 PMPaul Woitaschek
01/04/2022, 5:58 PMmzgreen
01/04/2022, 6:01 PMmzgreen
01/04/2022, 6:11 PMkpgalligan
01/04/2022, 6:24 PM