Hey guys, I'm currently working on a modular proje...
# announcements
g
Hey guys, I'm currently working on a modular project that has 2 submodules,
:core
and
:common
, both of them are multiplatform supporting all existent platforms. But when I try to add :common as a dependency to core, the build doesn't fail, but it's not imported, here's my build.gradle.kts in :core
Copy code
plugins {
    kotlin("multiplatform") apply true
}

repositories {
    mavenCentral()
}

dependencies {
    implementation(project(":common"))
}

kotlin {
    jvm {
        compilations.all {
            kotlinOptions.jvmTarget = "1.8"
        }
    }
    js {
        browser {
            testTask {
                useKarma {
                    useChromeHeadless()
                    webpackConfig.cssSupport.enabled = true
                }
            }
        }
    }
    val hostOs = System.getProperty("os.name")
    val isMingwX64 = hostOs.startsWith("Windows")
    val nativeTarget = when {
        hostOs == "Mac OS X" -> macosX64("native")
        hostOs == "Linux" -> linuxX64("native")
        isMingwX64 -> mingwX64("native")
        else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
    }


    sourceSets {
        val commonMain by getting
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test-common"))
                implementation(kotlin("test-annotations-common"))
            }
        }
        val jvmMain by getting
        val jvmTest by getting {
            dependencies {
                implementation(kotlin("test-junit"))
            }
        }
        val jsMain by getting
        val jsTest by getting {
            dependencies {
                implementation(kotlin("test-js"))
            }
        }
        val nativeMain by getting
        val nativeTest by getting
    }
}
e
Shouldn't the dependency be added to the
commonMain
source set? https://kotlinlang.org/docs/reference/mpp-add-dependencies.html
g
Yes, this works! Thank you.
👍 1