Should it be possible right now to run a wasm base...
# webassembly
j
Should it be possible right now to run a wasm based Compose for Web app using Kotlin 1.9.0-Beta?
b
You can try Compose
1.4.0-dev-wasm08
j
getting further I think....I tried starting off to update the
compose-jetsnack
sample but still getting following for some reason
Copy code
Could not determine the dependencies of task ':kotlinNpmInstall'.
> Could not resolve all dependencies for configuration ':web:wasmNpm'.
   > Could not find org.jetbrains.kotlin:kotlin-stdlib:1.9.0-dev-6976.
     Searched in the following locations:
       - <https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib/1.9.0-dev-6976/kotlin-stdlib-1.9.0-dev-6976.pom>
       - <https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/1.9.0-dev-6976/kotlin-stdlib-1.9.0-dev-6976.pom>
       - <https://maven.pkg.jetbrains.space/public/p/compose/dev/org/jetbrains/kotlin/kotlin-stdlib/1.9.0-dev-6976/kotlin-stdlib-1.9.0-dev-6976.pom>
       - <https://maven.pkg.jetbrains.space/kotlin/p/wasm/experimental/org/jetbrains/kotlin/kotlin-stdlib/1.9.0-dev-6976/kotlin-stdlib-1.9.0-dev-6976.pom>
       - <https://androidx.dev/storage/compose-compiler/repository/org/jetbrains/kotlin/kotlin-stdlib/1.9.0-dev-6976/kotlin-stdlib-1.9.0-dev-6976.pom>
     Required by:
         project :web > org.jetbrains.compose.foundation:foundation:1.4.0-dev-wasm08 > org.jetbrains.compose.foundation:foundation-wasm:1.4.0-dev-wasm08 > org.jetbrains.skiko:skiko-wasm:0.0.7.58-wasm03
Could be something on my side still....I've pared things down to just
web
module and added following in there
Copy code
compose {
    experimental {
        web.application {}
    }

    kotlinCompilerPlugin.set("1.4.7-dev-k1.9.0-Beta-bb7dc8b44eb")
    kotlinCompilerPluginArgs.add("suppressKotlinVersionCompatibilityCheck=1.9.0-Beta")
}
(if I don't do that then I get
This version of Compose Multiplatform 1.4.0-dev-wasm08 doesn't support Kotlin 1.9.0-Beta.
)
o
Copy code
kotlinCompilerPlugin.set("1.4.7-dev-k1.9.0-Beta-bb7dc8b44eb")
This version won't work. I guess it's the Jetpack Compose Compiler plugin version, right? what if you set:
Copy code
kotlinCompilerPlugin.set("1.4.0-dev-wasm08")
? _ Or did 1.4.7-dev-k1.9.0-Beta-bb7dc8b44eb work for you? _ And 1.4.0-dev-wasm08 was built with a dependency on org.jetbrains.kotlinkotlin stdlib1.9.0-dev-6976 So It still can complain. But stdlib version substituion should help
j
I had needed to use
1.4.7-dev-k1.9.0-Beta-bb7dc8b44eb
in other projects to work with Kotlin 1.9.0-Beta. I tried what you suggested but get same error
o
Just to be sure: did k/wasm target work with 1.4.7-dev-k1.9.0-Beta-... ?
j
Not that I'm aware of.....had just been trying it out on this project....seems like I get same error with it
o
I see. I'll try 1.9.0-Beta with compose-jetsnack later today. I think we can make it work withou new compose verion publication
j
btw, re. using Jetpack Compose Compiler plugin version, this is something I've been doing on a number of other projects when there's been mismatch that needed it. What I also have in this case is something like:
Copy code
allprojects {
    configurations.all {
        resolutionStrategy.dependencySubstitution {
            substitute(module("org.jetbrains.compose.compiler:compiler")).apply {
                using(module("androidx.compose.compiler:compiler:1.4.7-dev-k1.9.0-Beta-bb7dc8b44eb"))
            }
        }
    }
}
(but if there's JB version that works with the particular Kotlin version then that works of course)
o
Yeah, what you're doing makese sense when you have many modules with compose. Just a note: androidx.compose.compiler:compiler should work properly for desktop target (jvm). But it doesn't have all extra patches for k/native, k/js yet.
The branch with kotlin 1.9.0-Beta in compose-jetsnack - https://github.com/Kotlin/kotlin-wasm-examples/tree/jetsnacks-kotlin190 runs in the browser with k/wasm
j
Ah, great... thanks! Will try shortly.
looks like following was key change...
Copy code
if (requested.module.name.startsWith("kotlin-stdlib")) {
                useVersion("1.9.0-Beta")
            }
o
right
j
btw I brought that change over to my own project and getting following for some reason.....I'll investigate differences further here but just in case you know off top of your head what would cause this
Copy code
Querying the mapped value of map(task ':compose-web:wasmBrowserDevelopmentRun' property 'inputFilesDirectory') before task ':compose-web:wasmDevelopmentExecutableCompileSync' has completed is not supported
hmm, might be related to fact that am using v8.0.1 of gradle plugin.....I updated
compose-jetsnack
to use that version and see same issue with that project too now
o
Got it. It's good to know. Thanks! We'll need to figure out if it's kotlin gradle plugin or compose gradle plugin affected.
j
I've gone back to 7.3.0 in this branch at least for now
and is working fine
this is the project btw that I'm trying this with https://twitter.com/joreilly/status/1661809446908035094?s=20
147 Views