Hey, I've recently started playing with a Kotlin M...
# multiplatform
m
Hey, I've recently started playing with a Kotlin Multiplatform. I have a bunch of native targets and I wanted to group them under
nativeMain
target. I did this:
Copy code
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?
p
Enable hmpp
m
Oh I've seen this doc but I somehow missed this section, thank you! 🙏
It worked for one lib but not for Okio, Can it be because Okio doesn't support hmpp or something? I don't know if it doesn't, I'm guessing now
k
Yeah, issues but they look to be resolved in the next release: https://github.com/square/okio/pull/980
👍 1
🙌 2