Hello, I would like to just ask for explanation of...
# moko
d
Hello, I would like to just ask for explanation of one of the things I bumped upon when including moko-resources into my project. In
build.gradle.kts
, I had to add
Copy code
sourceSets {
        androidMain {
            dependencies {
                implementation(libs.compose.ui)
                implementation(libs.compose.ui.tooling.preview)
                implementation(libs.androidx.activity.compose)
                implementation(libs.ktor.client.android)
                implementation(libs.decompose)
            }
            dependsOn(commonMain.get()) ----> this line
        }
dependsOn(commonMain.get())
line for example, why? Also in iOS, I had change
isStatic = false
instead of
true
which was there by default. What does this change for me? I also added
Copy code
"$SRCROOT/../gradlew" -p "$SRCROOT/../" :yourframeworkproject:copyFrameworkResourcesToApp \
    -Pmoko.resources.PLATFORM_NAME="$PLATFORM_NAME" \
    -Pmoko.resources.CONFIGURATION="$CONFIGURATION" \
    -Pmoko.resources.ARCHS="$ARCHS" \
    -Pmoko.resources.BUILT_PRODUCTS_DIR="$BUILT_PRODUCTS_DIR" \
    -Pmoko.resources.CONTENTS_FOLDER_PATH="$CONTENTS_FOLDER_PATH"
My main issue was that
isStatic
field was set to
false
Also, I had to add following code to KotlinMultiplatformExtension kotlin { applyDefaultHierarchyTemplate() } Isn't there any simpler way to perform all of this? Am I doing something wrong or is it supposed to be like this
a
dependsOn(commonMain.get())
line for example, why?
it's workaround to support kotlin 1.9 with resources 0.23. in 0.24 it's not required.
Also in iOS, I had change
isStatic = false
instead of
true
which was there by default. What does this change for me?
compose multiplatform in past require
isStatic = true
. at latest CM versions it's not requirement so you can disable static.
Copy code
copyFrameworkResourcesToApp
this call should be used only when you use
isStatic = true
. because static frameworks can't have own resources.
gratitude thank you 1
d
Thank you Aleksey, I just updated to 0.24.0-alpha-1 and I don't need
dependsOn(commonMain.get())
Regarding iOS limitations, well I'll just let them be 😄
@alex009 I had to add 1 more thing to my code
Copy code
sourceSets {
    val iosSimulatorArm64Main by getting {
            dependsOn(commonMain.get())
        }
}
Otherwise, I would be getting an error
Copy code
MR.kt:7:22: error: Expected object 'MR' has no actual declaration in module <AppName:composeApp> for Native
error: Compilation finished with errors
Is this expected behaviour?
a
not, its not expected. it's some bug 🙂 report please at github
d
Sure, will do Aleksey 👍🏼
Update here, I've been trying to reproduce it today but I have some other errors. I will open an issue during the day