JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
16.35k stars 1.18k forks source link

[Wasm] [1.6.10] MissingResourceException: Missing resource with path: ./values/strings.commonMain.cvr #4654

Closed Nek-12 closed 7 months ago

Nek-12 commented 7 months ago

Just upgraded https://opensource.respawn.pro/FlowMVI/sample/ to 1.6.10. Resources no longer load.

Importantly, we still have to use 1.9.23 because of other dependencies. I saw some notices about public resources working in 2.0.0 only, but if that's true and resources won't work at all unles 2.0-rc is used, how can I get resources working with k 1.9.23 and compose 1.6.10?

Versions

MissingResourceException: Missing resource with path: ./values/strings.commonMain.cvr

// shared module
compose.resources {
    packageOfResClass = Config.Sample.namespace
    publicResClass = false
}

// app module

val copyWasmResources = tasks.create("copyWasmResourcesWorkaround", Copy::class.java) {
    from(project(":sample").file("src/commonMain/composeResources"))
    into("build/processedResources/wasmJs/main")
}

afterEvaluate {
    tasks {
        getByName("wasmJsProcessResources").finalizedBy(copyWasmResources)
        getByName("wasmJsDevelopmentExecutableCompileSync").dependsOn(copyWasmResources)
        getByName("wasmJsProductionExecutableCompileSync").dependsOn(copyWasmResources)
        getByName("wasmJsJar").dependsOn(copyWasmResources)
    }
}

Maybe I need to fix the hack I'm using another time now?

terrakok commented 7 months ago

Could you share the project with me? And what exactly version of the compose do you use? (add it to the description)

Nek-12 commented 7 months ago

Version added to the description

Here: https://github.com/respawn-app/FlowMVI/tree/master/sample

terrakok commented 7 months ago

I see you have a multimodule project but the resources in such case works only with Kotlin Gradle Plugin >= 2.0.0-Beta5

terrakok commented 7 months ago

I understood that you worked around it with hacks. But it doesn't work anymore. The final resources (cvr files) are generated as part of the build. You can try to do the trick again but with the build directory. Take a look into build/generated/processedResources directory. The task to generate the dir: :sample:wasmJsProcessResources

Nek-12 commented 7 months ago

Okay, I will try to copy the resources from that dir as well. Other users may hopefully use that as a workaround for now

okushnikov commented 4 months ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.