how can i have my kmp project use the latest corou...
# coroutines
l
how can i have my kmp project use the latest coroutines-core and enforce native-only targets to use the -native-mt variant? I came up with a solution that had me replace my iosMain sourceSet with both iosArm64Main and iosX64Main and duplicate all its code.
j
what is the reason to just not using the mt one?
I think that mt variant does exactly that behavior, no?
f
Copy code
val commonMain by getting {
    dependencies {
        api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2")
    }
}

val iosX64Main by getting {
            dependencies {
                implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-iosx64:1.5.2-native-mt") {
                    version {
                        strictly("1.5.2-native-mt")
                    }
                }
            }
        }
l
@Javier it forces android clients of a library to also depend on it
@Francis Mariano and you declare the same for iosArm64Main, right? do you also have two different source sets, one per target?
j
But the jvm/android part of mt library is the same of the normal one, indeed the normal one and the mt will be “merged” with 1.6, and there will be only one
l
I may be doing something wrong then, because using native-mt on my commonMain.dependencies{} forced my apps to also declare native-mt. You mean with kotlinx-couroutines-core:1.6.0, right? that may be true, but it won’t be available anytime soon
j
Yeah, with 1.6. Not sure about that error tho 🤔
l
strange… it seems that
Copy code
val iosMain by getting {
      dependencies {
        api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0-native-mt") {
          isForce = true
        }
      }
    }
whereas
Copy code
val iosMain by getting {
      dependencies {
        api("org.jetbrains.kotlinx:kotlinx-coroutines-core") {
          version { strictly("1.5.0-native-mt") }
        }
      }
    }
does not !
it doesnt make much sense to me, as isForce is deprecated and points to version.strictly()
f
@leandro hello
I think stranger as well. Here also is in this way.
l
Force behaves differently than strict, I assumed at the time that they were virtually the same but gradle docs explains the differences
f