Thread
#multiplatform
    Siggi Gunnarss

    Siggi Gunnarss

    2 years ago
    Hello all. Does anyone have a link to a large gradle android/ios mpp project? Most samples are rather small. I'm looking for something that has multiplatform modules depending on other multiplatform modules?
    Hamza

    Hamza

    2 years ago
    Unsure if this uses other modules, but feel free to check this out https://github.com/JetBrains/kotlinconf-app
    Siggi Gunnarss

    Siggi Gunnarss

    2 years ago
    Thanks, this is a good example, although there are no complex module dependencies
    Jurriaan Mous

    Jurriaan Mous

    2 years ago
    I have a for now internal project which will at some moment be opened up and works with multiple layers of multiplatform dependencies. Is there anything specific you want to know? An example of a module depending on a different module in same project. I abstracted each platform setting into its own .gradle file so I avoid duplication.
    plugins {
        id("kotlin-multiplatform")
    }
    
    apply {
        from("../gradle/common.gradle")
        from("../gradle/js.gradle")
        from("../gradle/jvm.gradle")
        from("../gradle/native.gradle")
        from("../gradle/publish.gradle")
    }
    
    kotlin {
        sourceSets {
            commonMain {
                dependencies {
                    api(project(":yaml"))
                }
            }
            commonTest {
                dependencies {
                    implementation(project(":testmodels")) {
                        // Workaround for: <https://youtrack.jetbrains.com/issue/KT-33712>
                        exclude(module = "core")
                    }
                }
            }
        }
    }
    Siggi Gunnarss

    Siggi Gunnarss

    2 years ago
    That's very helpful, thanks. The platform gradle abstraction makes a lot of sense. So you only have to reference api(:yaml) in commonMain source sets, not nativeMain etc.?
    Jurriaan Mous

    Jurriaan Mous

    2 years ago
    Only commonMain, just like you do with the recent multiplatform dependencies. Kotlin multiplatform gradle plugin takes care of the rest.
    In the past there were issues with transitive project dependencies but that all got fixed along the way 🙂 https://youtrack.jetbrains.com/issue/KT-28019
    russhwolf

    russhwolf

    2 years ago
    Maybe not comolex enough, but here's a small project with two layers of common dependencies https://github.com/russhwolf/multiplatform-hello