From c4bc761b0dc2a4a3ae3d379203d2d54b1f58c044 Mon Sep 17 00:00:00 2001 From: Oleksandr Karpovich Date: Sat, 10 Feb 2024 13:13:03 +0100 Subject: [PATCH] Gradle Plugin: Force kotlinx-coroutines version 1.8.0-RC2 for web targets in user projects (#4278) Removed such the version substituion from the resources library. The versions will be subtituted now by gradle plugin. --- components/resources/library/build.gradle.kts | 13 ------------- .../org/jetbrains/compose/ComposePlugin.kt | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/components/resources/library/build.gradle.kts b/components/resources/library/build.gradle.kts index 222274e5f8..1e563934c5 100644 --- a/components/resources/library/build.gradle.kts +++ b/components/resources/library/build.gradle.kts @@ -204,16 +204,3 @@ afterEvaluate { if (name == "compileWebMainKotlinMetadata") enabled = false } } - -// TODO: remove this (https://youtrack.jetbrains.com/issue/COMPOSE-939) -configurations.all { - val isWeb = name.startsWith("wasmJs") || name.startsWith("js") - if (isWeb) { - resolutionStrategy.eachDependency { - if (requested.group.startsWith("org.jetbrains.kotlinx") && - requested.name.startsWith("kotlinx-coroutines-")) { - useVersion("1.8.0-RC2") - } - } - } -} \ No newline at end of file diff --git a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt index f542374d67..a7c4b4acd3 100644 --- a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt +++ b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt @@ -87,6 +87,23 @@ abstract class ComposePlugin : Plugin { disableSignatureClashCheck(project) } + + // TODO: remove this (https://youtrack.jetbrains.com/issue/COMPOSE-939) + // we substitute the coroutines version for web targets in user projects, + // so they don't need to do that manually + project.configurations.all { + val isWeb = it.name.startsWith("wasmJs") || it.name.startsWith("js") + if (isWeb) { + it.resolutionStrategy.eachDependency { + if (it.requested.group.startsWith("org.jetbrains.kotlinx") && + it.requested.name.startsWith("kotlinx-coroutines-")) { + if (it.requested.version?.startsWith("1.8") != true) { + it.useVersion("1.8.0-RC2") + } + } + } + } + } } private fun disableSignatureClashCheck(project: Project) {