https://kotlinlang.org logo
h

Hannes

09/01/2020, 3:29 PM
gradle config:
Copy code
kotlin {
    jvm()
    iosArm32()
    iosArm64()
    iosX64()
    linuxX64()
    macosX64()
    mingwX64()
    tvosArm64()
    tvosX64()
    watchosArm32()
    watchosArm64()
    watchosX86()

    sourceSets {
        commonMain {
            dependencies {
                api 'org.jetbrains.kotlin:kotlin-stdlib-common'
                api libraries.coroutines
            }
        }

        commonTest {
            dependencies {
                implementation 'org.jetbrains.kotlin:kotlin-test-multiplatform'
                implementation 'app.cash.turbine:turbine:0.2.1'
            }
        }

        jvmTest {
            dependsOn commonMain
            dependencies {
                implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
                implementation testLibraries.junit
                implementation testLibraries.coroutinesTest
            }
        }

        nativeMain {
        }
        nativeTest {
        }

        configure([
                targets.iosArm32,
                targets.iosArm64,
                targets.iosX64,
                targets.linuxX64,
                targets.macosX64,
                targets.mingwX64,
                targets.tvosArm64,
                targets.tvosX64,
                targets.watchosArm32,
                targets.watchosArm64,
                targets.watchosX86,
        ]) {
            compilations.main.source(sourceSets.nativeMain)
            compilations.test.source(sourceSets.nativeTest)
        }
    }
}
r

romtsn

09/01/2020, 7:38 PM
I am not sure if the kotlin mpp plugin can automatically link nativeMain with commonMain, perhaps you’d need to add
dependsOn commonMain
and
dependsOn commonTest
respectively?
also I’ve checked the repo, and looks like your
TestUtils.kt
in
commonTest
is not under your package name, whereas in
nativeTests
it is. I believe they should be under the same package name for expect/actual to function properly
👍 1
h

Hannes

09/02/2020, 9:53 AM
yep, that was the issue 🤦‍♂️ . Thank you.
r

romtsn

09/02/2020, 11:02 AM
the latter one? 🙂 so nativeMain is still linked right?