Closed JakeWharton closed 1 year ago
I will research
I reproduced this problem with iosSimulatorArm64Test task. I will continue try to fix it.
But also, for now, you may use only jvm tests: ./gradlew -p molecule :m-r:jvmTest
I can reproduce this, also happens when building to an iOS app target not just testing only. I can't use compose runtime in shared module because of this.
I can reproduce this, also happens when building to an iOS app target not just testing only. I can't use compose runtime in shared module because of this.
Thanks! I will research your sample
Just noticed the same error in another project. In my case the compose compiler was not applied for k/native targets. In molecule runtime I see no compose gradle plugin applied (it applies the compiler plugin). Does compose plugin get applied for other targets in molecule runtime (and where is it configured)?
UPD: beside applying the compiler plugin, ComposeGradlePlugin also adds compiler options for k/js - https://github.com/JetBrains/compose-jb/blob/3996233b032772a5afb8ceceafc4affae793e480/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposeCompilerKotlinSupportPlugin.kt#L67
So I guess, k/js is probably not working too in molecule:runtime?
cc: @JakeWharton
You are correct we are not specifying the JS option correctly. Molecule's multiplatform entrance is a little more rash than Redwood where we did things a bit more carefully. That being said, we cannot use your Compose plugin because it assumes things about the JS target (the presence of a web extension) that doesn't work in the general case.
In Redwood we have a proper subproject plugin which applies the Compose compiler plugin and configures the JS build correctly: https://github.com/cashapp/redwood/blob/3956a7883950951f38e5d0c442d63b32cdfc955f/build-support/src/main/kotlin/app/cash/redwood/buildsupport/ComposePlugin.kt. I will do the same in Molecule here shortly.
This issue has resolved itself, but I'm not quite sure why. I upgraded to Kotlin 1.7.20 and JB Compose 1.2.1 (and compiler 1.3.2.1) along with adding the cacheKind=none
option and it started to succeed. We also had other build changes such as removing the use of includeBuild
across multiplatform projects which is known to not work well, but that shouldn't have affected the behavior.
(Separately I fixed our Gradle plugin to use JS decoys for downstream projects as well as using JS decoys for our own build. Thanks!)
Going to preemptively close and hope it's not an issue in the future!
I was also able to fix this specific issue by upgrading to Kotlin 1.7.20, but ended up running into another wall:
e: Compilation failed: Unbound symbols not allowed
Unbound public symbol IrSimpleFunctionPublicSymbolImpl: me.saket.teleport.ui/Presenter.present|-8951064700938915987[0]
* Source files:
* Compiler version info: Konan: 1.7.20 / Kotlin: 1.7.20
* Output kind: FRAMEWORK
e: java.lang.AssertionError: Unbound symbols not allowed
@JakeWharton Do you still have your jw/link-thing/2022-09-21
branch around? I'd like to compare my setup with yours.
@saket Did you add kotlin.native.cacheKind=none
? I got the same error and this resolved it.
Yea I already had kotlin.native.cacheKind=none
in my gradle.properties
so I believe I'm running into something else. Do you have a public project that I can take a look at?
I have a work-in-progress pr to include molecule into my playground app: https://github.com/hfhbd/ComposeTodo/pull/665/files
I had to add the molecule runtime manually though because I also use the compose plugin: https://github.com/cashapp/molecule/issues/134
@saket Can you please try version 1.3.0-alpha01-dev849 with kotlin.native.cacheKind=none
Sure, where are your alpha builds hosted on? I couldn't find any information in your readme or releases page.
@hfhbd going through this, thank you!
Thanks! I'm seeing the same error with 1.3.0-alpha01-dev849
.
@saket I had the same error in my case when using molecule. Its was caused due that composable functions couldn't be public in native (at least this is what I've read). I fixed it changing them to internal (an in my case only expose the flow created by the molecule launch)
@saket Yeah, for now Composable functions for native can be only internal or private. We will fix it in the future.
@saket Yeah, for now Composable functions for native can be only internal or private. We will fix it in the future.
Did this change or is this still valid?
@Nailik
for now Composable functions for native can be only internal or private. We will fix it in the future.
This part is fixed when using kotlin 1.8.20 and compose 1.4.0
kotlin.native.cacheKind=none - this parameter is still needed. The investigation has started by k/native team
@Nailik
for now Composable functions for native can be only internal or private. We will fix it in the future.
This part is fixed when using kotlin 1.8.20 and compose 1.4.0
kotlin.native.cacheKind=none - this parameter is still needed. The investigation has started by k/native team
Unfortunately i still get error: Module "Rhasspy_Mobile:ui" has a reference to symbol androidx.compose.runtime/CompositionLocalProvider|1991010962478225151[0]. Neither the module itself nor its dependencies contain such declaration.
with this project https://github.com/Nailik/rhasspy_mobile/tree/1454949c0d42b60ce48dc57ffb446e4061531522
Edit:
This issue was caused because i forgot to add id("org.jetbrains.compose")
in the plugins section
I have
kotlin.native.cacheKind=none
set in the project'sgradle.properties
but it still does not compile.Repro on this branch https://github.com/cashapp/molecule/tree/jw/link-thing/2022-09-21 running
./gradlew -p molecule :m-r:check
.