I have this larger KMP build, and the IDE sync is ...
# community-support
v
I have this larger KMP build, and the IDE sync is taking like 1m20s (I know its not huge compared to monorepos etc, but android one is 15seconds So I tried to migrate to isolated projects to see if it would help, and yes it halved the config time on android But the IDE sync when ios target is enabled is still like 1m15s So it didnt help, or rather that gradle configuration time wasn't the bottleneck Does anyone know what's going on? (I'm on latest everything)
p
Send your project code or at least build.gradle.kts
v
I have convention plugin which applies default to every multiplatform project
Copy code
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
    val kotlin = extensions.getByName("kotlin") as KotlinMultiplatformExtension

    ...

    if (enableIosTarget.get() && kotlin.targets.findByName("iosSimulatorArm64") == null) {
        kotlin.iosSimulatorArm64()
    }

    if (enableWasmTarget.get() && kotlin.targets.findByName("wasmJs") == null) {
        kotlin.wasmJs {
            browser()
        }
    }

    ...
}
targets are selectively enabled to not do unnecessary work while local dev-ing
Copy code
plugins {
    alias libs.plugins.kotlin.multiplatform
    alias libs.plugins.foo.conventions
    alias libs.plugins.kotlin.serialization
    alias libs.plugins.android.kmp.library
    alias libs.plugins.compose.compiler
    alias libs.plugins.compose.multiplatform
    alias libs.plugins.detekt
    alias libs.plugins.metro
}

metro {
    generateContributionProviders = true
}

def enableIosTarget = providers.gradleProperty("foo.enableIosTarget")
        .map { it.toBoolean() }
        .orElse(false)
        .get()

def enableWasmTarget = providers.gradleProperty("foo.enableWasmTarget")
        .map { it.toBoolean() }
        .orElse(false)
        .get()

kotlin {
    android {
        namespace = "com.foo.sharedui"
        androidResources {
            enable = true
        }
    }
    if (enableIosTarget) {
        iosSimulatorArm64() {
            binaries {
                framework {
                    baseName = "SharedUI"
                    binaryOption("bundleId", "sk.foo.sharedui")
                    export project(":findoc-detail")
                    export project(":findoc-detail-2")
                    export project(":findoc-detail-3")
                    ... up to 100
                    export project(":findoc-detail-100")
                }
            }
        }
    }
    if (enableWasmTarget) {
        wasmJs()
    }
    sourceSets {
        commonMain.dependencies {
            implementation libs.androidx.compose.foundation
            implementation libs.androidx.compose.material3
            implementation libs.androidx.compose.components.resources
            implementation libs.androidx.navigation3.runtime
            implementation libs.androidx.navigation3.ui
            implementation libs.kotlinx.datetime
            implementation libs.coil.compose
            api project(":findoc-detail")
            api project(":findoc-detail-2")
            api project(":findoc-detail-3")
            ... up to 100
            api project(":findoc-detail-100")
            api project(":foo:design-system")
            api project(":bar:design-system")
        }
        androidMain.dependencies {
            implementation libs.androidx.lifecycle.process
        }
    }
}

dependencies {
    androidRuntimeClasspath libs.androidx.compose.tooling
}
and this is my umbrella module exposed to the ios app as you can see I have 100 modules as dependencies (its a synthetic project to see how would the experience be if I were to migrate out actual build) and each of the findoc projects as a build file of
Copy code
plugins {
    alias libs.plugins.kotlin.multiplatform
    alias libs.plugins.foo.conventions
    alias libs.plugins.kotlin.serialization
    alias libs.plugins.android.kmp.library
    alias libs.plugins.compose.compiler
    alias libs.plugins.compose.multiplatform
    alias libs.plugins.detekt
    alias libs.plugins.metro
}

metro {
    generateContributionProviders = true
}

kotlin {
    android {
        namespace = "com.foo.findoc"
        androidResources {
            enable = true
        }
    }
    sourceSets {
        commonMain.dependencies {
            implementation libs.coroutines.core
            implementation libs.androidx.compose.foundation
            implementation libs.androidx.compose.material3
            implementation libs.androidx.compose.components.resources
            implementation libs.kotlinx.serialization.json
            implementation project(":foo:design-system")
        }
    }
}

dependencies {
    androidRuntimeClasspath libs.androidx.compose.tooling
}
findoc-detail-X represents a feature module, where the exposed part to ios is a screencomposable, or rather the viewcontroller wrapping it, nothing else is public
I'm not aware of doing anything wrong, I'm mostly asking if this is to be expected at 100 projects, because there is a huge delta against just jvm target, 15s vs 90s