svenjacobs
09/01/2022, 5:25 AMshared
module under commonMain
. Now I have the problem that the Compose compiler determines all of my (immutable) data classes as unstable because they are placed in a different module. I cannot add the Compose runtime dependency to commonMain
because this is not a multiplatform dependency and the project just won’t compile when doing so. Of course I could add wrapper classes like described in the linked article and use them only for Android, but this would mean I would have to start using generic types in my ViewModels extensively to ensure that I still share most of the business logic. Isn’t there another way of telling the Compose compiler which classes are actually immutable/stable, maybe via command line arguments or a configuration similar to ProGuard/R8?
I’m using version 1.3.0
of Compose compiler.jw
09/01/2022, 5:47 AMsvenjacobs
09/01/2022, 5:50 AM:shared:iosArm64Main: Could not resolve org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4.
Required by:
project :shared > androidx.compose.runtime:runtime:1.3.0-beta01
svenjacobs
09/01/2022, 6:07 AMimplementation("androidx.compose.runtime:runtime:1.3.0-beta01") {
exclude(group = "org.jetbrains.kotlinx")
}
I had to figure out the right syntax because actually I’m using Gradle version catalogs but this seems to be not well supported in a multiplatform project.
implementation(libs.androidx.compose.runtime) {
exclude(group = "org.jetbrains.kotlinx")
}
wasn’t working because implementation
doesn’t provide this overload as well as
implementation(variantOf(libs.androidx.compose.runtime) { exclude(group = "org.jetbrains.kotlinx") })
which I’ve seen in a few examples wasn’t working either because variantOf
isn’t known 🤷🏼ste
09/01/2022, 8:02 AMandroidx.compose
one - he meant org.jetbrains.compose
svenjacobs
09/01/2022, 8:38 AMsvenjacobs
09/01/2022, 8:53 AMval commonMain by getting {
dependencies {
... other dependencies here
implementation(libs.jetbrains.compose.runtime)
}
}
where libs.jetbrains.compose.runtime
points to org.jetbrains.compose.runtime:runtime:1.1.1
now gives me:
:shared:iosArm64Main: Could not resolve org.jetbrains.compose.runtime:runtime:1.1.1.
Marko Novakovic
09/01/2022, 9:00 AMUnable to find method ''void org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions.setUseIR(boolean)''
'void org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions.setUseIR(boolean)'
I gave up on it for the time being 😄svenjacobs
09/01/2022, 9:49 AMorg.jetbrains.compose.runtime:runtime:1.2.0-alpha01-dev620
this only gives me dependency errors for iOS Simulator. When commenting everything out in build.gradle.kts
related to iosSimulator
, the project does sync. But this cannot be the solution… 😐Marko Novakovic
09/01/2022, 9:50 AMBut this cannot be the solution…yes… but thanks, I will try this just to see compose compiler metrics
svenjacobs
09/01/2022, 9:56 AMorg.jetbrains.compose.runtime:runtime:1.2.0-alpha01-dev774
. You need to add the repository first, for example in root `build.gradle.kts`:
allprojects {
repositories {
google()
mavenCentral()
// Add this
maven("<https://maven.pkg.jetbrains.space/public/p/compose/dev/>")
}
}
This version works with iOS Simulator, too.mkrussel
09/01/2022, 12:23 PMsvenjacobs
09/01/2022, 12:24 PM