Hi all! Tell me how to properly configure the Grad...
# moko
k
Hi all! Tell me how to properly configure the Gradle configuration when there are several modules, as an example from the moko-resources readme:
Copy code
- shared
-- resources
-- feature-1
-- feature-2
The only working solution that made my project build on both Android and iOS was to register the moko resources plugin for the iOS version, and remove this solution for Android. Also, when building the IOS, it is necessary to replace implementation(project(:resource)) with api(project(:resource)) My shared module:
Copy code
plugins {
    . . .
    id("dev.icerock.mobile.multiplatform-resources") <- only for ios
}

kotlin {
    androidTarget()
    iosX64()
    iosArm64()
    iosSimulatorArm64()

    cocoapods {
        summary = "Some description for the Shared Module"
        homepage = "Link to the Shared Module homepage"
        ios.deploymentTarget = ProjectSettings.IOS_DEPLOYMENT_TARGET
        version = ProjectSettings.VERSION_NAME
        podfile = project.file("../iosApp/Podfile")
        framework {
            baseName = "shared"
            isStatic = true
            export(project(":resource"))
            transitiveExport = true
        }
    }

    sourceSets {
        val commonMain by getting {
            dependencies {
                api(project(:resource)) <- api for ios, implementation for android
            }
        }
        . . .
    }
    
   . . .
}
Is there a more automated way to build two versions without making changes to Gradle? Thanks in advance for any answer or advice on what I'm doing wrong) Kotlin: 1.9.10 Gradle plugin: 8.1.2 Moko-resources: 0.23.0
a
gradle configuration cache supported from 0.24.0. please try 0.24.0-alpha-2. migration guide here
k
Thanks Aleksey for the answer! I don’t quite understand how gradle configuration cache will help me automate my problem. I'll try to update to the latest alpha version, maybe something will become clearer
b
hello @Katyrin Roman, I'm also trying to achieve same thing. Did you able to make it work? I tried it, android is working but ios is crashing (
k
Hello, no, I have not yet found a solution better than what I described.
b
@Katyrin Roman thanks a lot for sharing your gradle file, I tried to implement it over 8-10 days and finally it worked. Junior life is hard🥲
🙌 1