From 85be84e819756d4d384c504c245a70684829a445 Mon Sep 17 00:00:00 2001 From: "Alexander.Likhachev" Date: Mon, 17 Feb 2025 21:26:39 +0100 Subject: [PATCH 1/8] Suppress K/JS configuration deprecation warnings Relates to KT-68597, KT-75144 --- buildSrc/src/main/kotlin/CacheRedirector.kt | 2 +- .../src/main/kotlin/kotlin-multiplatform-conventions.gradle.kts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/CacheRedirector.kt b/buildSrc/src/main/kotlin/CacheRedirector.kt index 85e6eef840..b7e2772b53 100644 --- a/buildSrc/src/main/kotlin/CacheRedirector.kt +++ b/buildSrc/src/main/kotlin/CacheRedirector.kt @@ -4,7 +4,6 @@ import org.gradle.api.artifacts.repositories.* import org.gradle.api.initialization.dsl.* import org.gradle.kotlin.dsl.* import org.jetbrains.kotlin.gradle.targets.js.nodejs.* -import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.* import org.jetbrains.kotlin.gradle.targets.js.yarn.* import java.net.* @@ -100,6 +99,7 @@ private fun Project.checkRedirect(repositories: RepositoryHandler, containerName } } +@Suppress("DEPRECATION", "DEPRECATION_ERROR") // KT-68597, KT-68597 private fun Project.configureYarnAndNodeRedirects() { if (CacheRedirector.isEnabled) { val yarnRootExtension = extensions.findByType() diff --git a/buildSrc/src/main/kotlin/kotlin-multiplatform-conventions.gradle.kts b/buildSrc/src/main/kotlin/kotlin-multiplatform-conventions.gradle.kts index e2e1e66e2d..6f3c2fb58e 100644 --- a/buildSrc/src/main/kotlin/kotlin-multiplatform-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/kotlin-multiplatform-conventions.gradle.kts @@ -47,6 +47,7 @@ kotlin { watchosDeviceArm64() } js { + @Suppress("DEPRECATION", "DEPRECATION_ERROR") // KT-68597, KT-68597 moduleName = project.name nodejs() compilations["main"]?.dependencies { @@ -57,6 +58,7 @@ kotlin { wasmJs { // Module name should be different from the one from JS // otherwise IC tasks that start clashing different modules with the same module name + @Suppress("DEPRECATION", "DEPRECATION_ERROR") // KT-68597, KT-68597 moduleName = project.name + "Wasm" nodejs() compilations["main"]?.dependencies { From 3c0d95213aad866ee3fe89a771c6899e2d6dbcd6 Mon Sep 17 00:00:00 2001 From: Tatiana Bogdanova Date: Wed, 26 Feb 2025 18:24:13 +0100 Subject: [PATCH 2/8] Add new kotlin-dev repo url --- integration-testing/build.gradle.kts | 3 +++ integration-testing/java8Test/build.gradle.kts | 1 + integration-testing/jpmsTest/build.gradle.kts | 1 + integration-testing/settings.gradle.kts | 1 + integration-testing/smokeTest/build.gradle.kts | 1 + 5 files changed, 7 insertions(+) diff --git a/integration-testing/build.gradle.kts b/integration-testing/build.gradle.kts index 95556ed9f6..b50aff4fb3 100644 --- a/integration-testing/build.gradle.kts +++ b/integration-testing/build.gradle.kts @@ -47,6 +47,7 @@ buildscript { if (usingSnapshotVersion) { repositories { mavenLocal() + maven("https://redirector.kotlinlang.org/maven/dev") maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev") } } @@ -58,9 +59,11 @@ plugins { repositories { if (extra["using_snapshot_version"] == true) { + maven("https://redirector.kotlinlang.org/maven/dev") maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev") } mavenLocal() + maven("https://redirector.kotlinlang.org/maven/dev") mavenCentral() } diff --git a/integration-testing/java8Test/build.gradle.kts b/integration-testing/java8Test/build.gradle.kts index ada90adaab..8e6b330cb7 100644 --- a/integration-testing/java8Test/build.gradle.kts +++ b/integration-testing/java8Test/build.gradle.kts @@ -5,6 +5,7 @@ plugins { repositories { mavenCentral() maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev") + maven("https://redirector.kotlinlang.org/maven/dev") // Coroutines from the outer project are published by previous CI buils step mavenLocal() } diff --git a/integration-testing/jpmsTest/build.gradle.kts b/integration-testing/jpmsTest/build.gradle.kts index f96f99822f..ef0a9fae96 100644 --- a/integration-testing/jpmsTest/build.gradle.kts +++ b/integration-testing/jpmsTest/build.gradle.kts @@ -8,6 +8,7 @@ val coroutines_version: String by project repositories { if (project.properties["build_snapshot_train"]?.toString()?.toBoolean() == true) { maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev") + maven("https://redirector.kotlinlang.org/maven/dev") } mavenLocal() mavenCentral() diff --git a/integration-testing/settings.gradle.kts b/integration-testing/settings.gradle.kts index f6711b86c0..d73c83ad67 100644 --- a/integration-testing/settings.gradle.kts +++ b/integration-testing/settings.gradle.kts @@ -3,6 +3,7 @@ pluginManagement { mavenCentral() maven("https://plugins.gradle.org/m2/") maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev") + maven("https://redirector.kotlinlang.org/maven/dev") mavenLocal() } } diff --git a/integration-testing/smokeTest/build.gradle.kts b/integration-testing/smokeTest/build.gradle.kts index 3739c7209e..ceffee21c6 100644 --- a/integration-testing/smokeTest/build.gradle.kts +++ b/integration-testing/smokeTest/build.gradle.kts @@ -11,6 +11,7 @@ plugins { repositories { mavenCentral() maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev") + maven("https://redirector.kotlinlang.org/maven/dev") // Coroutines from the outer project are published by previous CI builds step mavenLocal() } From e147216cbc836aa6bf986c716f5c6d87c3239b01 Mon Sep 17 00:00:00 2001 From: Margarita Bobova Date: Tue, 18 Mar 2025 11:53:30 +0100 Subject: [PATCH 3/8] Kotlin 2.2 migration: Drop obsolete nodejs setup --- integration-testing/smokeTest/build.gradle.kts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/integration-testing/smokeTest/build.gradle.kts b/integration-testing/smokeTest/build.gradle.kts index ceffee21c6..c9cd166421 100644 --- a/integration-testing/smokeTest/build.gradle.kts +++ b/integration-testing/smokeTest/build.gradle.kts @@ -80,11 +80,3 @@ kotlin { } } } - -// Drop this configuration when the Node.JS version in KGP will support wasm gc milestone 4 -// check it here: -// https://github.com/JetBrains/kotlin/blob/master/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/nodejs/NodeJsRootExtension.kt -rootProject.extensions.findByType(NodeJsRootExtension::class.java)?.apply { - nodeVersion = "21.0.0-v8-canary202309167e82ab1fa2" - nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary" -} \ No newline at end of file From 56894d006f663f9f2f056e465970630a41bd94e0 Mon Sep 17 00:00:00 2001 From: Dmitry Khalanskiy Date: Fri, 7 Mar 2025 14:15:13 +0100 Subject: [PATCH 4/8] Add Release Team to Codeowners. Only for kotlin-community branches. --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000000..0004a935d9 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @tbogdanova @woainikk From b17bb47285ed357b88142694379724807396adc8 Mon Sep 17 00:00:00 2001 From: Margarita Bobova Date: Wed, 30 Apr 2025 10:54:50 +0200 Subject: [PATCH 5/8] Increase memory to 4096M for integration-testing --- integration-testing/gradle.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/integration-testing/gradle.properties b/integration-testing/gradle.properties index 56cac5b0ec..a0e462a8c9 100644 --- a/integration-testing/gradle.properties +++ b/integration-testing/gradle.properties @@ -5,3 +5,4 @@ junit5_version=5.7.0 kotlin.code.style=official kotlin.mpp.stability.nowarn=true +org.gradle.jvmargs=-Xmx4096M \ No newline at end of file From 8c3415e4fb81a7158eeb6e1acb41025bdeb38dd7 Mon Sep 17 00:00:00 2001 From: Kirill Rakhman Date: Mon, 19 May 2025 11:00:51 +0200 Subject: [PATCH 6/8] Fix wasm compilation after KT-63348 (#4438) --- .../api/kotlinx-coroutines-test.klib.api | 33 +++++++++---------- .../wasmJs/src/TestBuilders.kt | 1 - .../internal/JsPromiseInterfaceForTesting.kt | 2 +- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/kotlinx-coroutines-test/api/kotlinx-coroutines-test.klib.api b/kotlinx-coroutines-test/api/kotlinx-coroutines-test.klib.api index 38dfad99c6..8c4a13a274 100644 --- a/kotlinx-coroutines-test/api/kotlinx-coroutines-test.klib.api +++ b/kotlinx-coroutines-test/api/kotlinx-coroutines-test.klib.api @@ -74,23 +74,6 @@ final fun kotlinx.coroutines.test/runTest(kotlin.coroutines/CoroutineContext = . // Targets: [native, wasmWasi] final fun kotlinx.coroutines.test/runTest(kotlin.coroutines/CoroutineContext = ..., kotlin/Long, kotlin.coroutines/SuspendFunction1) // kotlinx.coroutines.test/runTest|runTest(kotlin.coroutines.CoroutineContext;kotlin.Long;kotlin.coroutines.SuspendFunction1){}[0] -// Targets: [js, wasmJs] -final class kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting { // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting|null[0] - constructor () // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting.|(){}[0] - - // Targets: [js] - final fun then(kotlin/Function1): kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting.then|then(kotlin.Function1){}[0] - - // Targets: [js] - final fun then(kotlin/Function1, kotlin/Function1): kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting.then|then(kotlin.Function1;kotlin.Function1){}[0] - - // Targets: [wasmJs] - final fun then(kotlin/Function1): kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting.then|then(kotlin.Function1){}[0] - - // Targets: [wasmJs] - final fun then(kotlin/Function1, kotlin/Function1): kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting.then|then(kotlin.Function1;kotlin.Function1){}[0] -} - // Targets: [js, wasmJs] final fun (kotlinx.coroutines.test/TestScope).kotlinx.coroutines.test/runTest(kotlin.time/Duration = ..., kotlin.coroutines/SuspendFunction1): kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting // kotlinx.coroutines.test/runTest|runTest@kotlinx.coroutines.test.TestScope(kotlin.time.Duration;kotlin.coroutines.SuspendFunction1){}[0] @@ -105,3 +88,19 @@ final fun kotlinx.coroutines.test/runTest(kotlin.coroutines/CoroutineContext = . // Targets: [js, wasmJs] final fun kotlinx.coroutines.test/runTest(kotlin.coroutines/CoroutineContext = ..., kotlin/Long, kotlin.coroutines/SuspendFunction1): kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting // kotlinx.coroutines.test/runTest|runTest(kotlin.coroutines.CoroutineContext;kotlin.Long;kotlin.coroutines.SuspendFunction1){}[0] + +// Targets: [js] +final class kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting { // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting|null[0] + constructor () // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting.|(){}[0] + + final fun then(kotlin/Function1): kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting.then|then(kotlin.Function1){}[0] + final fun then(kotlin/Function1, kotlin/Function1): kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting.then|then(kotlin.Function1;kotlin.Function1){}[0] +} + +// Targets: [wasmJs] +final class kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting : kotlin.js/JsAny { // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting|null[0] + constructor () // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting.|(){}[0] + + final fun then(kotlin/Function1): kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting.then|then(kotlin.Function1){}[0] + final fun then(kotlin/Function1, kotlin/Function1): kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting.then|then(kotlin.Function1;kotlin.Function1){}[0] +} diff --git a/kotlinx-coroutines-test/wasmJs/src/TestBuilders.kt b/kotlinx-coroutines-test/wasmJs/src/TestBuilders.kt index 8409b0f2d0..ed9f9c9139 100644 --- a/kotlinx-coroutines-test/wasmJs/src/TestBuilders.kt +++ b/kotlinx-coroutines-test/wasmJs/src/TestBuilders.kt @@ -6,7 +6,6 @@ import kotlin.js.* public actual typealias TestResult = JsPromiseInterfaceForTesting -@Suppress("INFERRED_TYPE_VARIABLE_INTO_POSSIBLE_EMPTY_INTERSECTION") internal actual fun createTestResult(testProcedure: suspend CoroutineScope.() -> Unit): TestResult = GlobalScope.promise { testProcedure() diff --git a/kotlinx-coroutines-test/wasmJs/src/internal/JsPromiseInterfaceForTesting.kt b/kotlinx-coroutines-test/wasmJs/src/internal/JsPromiseInterfaceForTesting.kt index e6697db307..da1e1c8759 100644 --- a/kotlinx-coroutines-test/wasmJs/src/internal/JsPromiseInterfaceForTesting.kt +++ b/kotlinx-coroutines-test/wasmJs/src/internal/JsPromiseInterfaceForTesting.kt @@ -7,7 +7,7 @@ a parametric class. So, we make a non-parametric class just for this. */ * @suppress */ @JsName("Promise") -public external class JsPromiseInterfaceForTesting { +public external class JsPromiseInterfaceForTesting : JsAny { /** * @suppress */ From f2afdd1c9bc98df6404407a2d1c2e009ff111b6c Mon Sep 17 00:00:00 2001 From: Kirill Rakhman Date: Thu, 22 May 2025 16:59:04 +0200 Subject: [PATCH 7/8] Fix compilation after KT-76478 (#4441) --- .../api/kotlinx-coroutines-core.api | 13 +++++++++++++ .../api/kotlinx-coroutines-core.klib.api | 17 +++++++++++++++++ .../common/src/channels/Channel.kt | 2 ++ .../jvm/src/internal/ThreadContext.kt | 1 + 4 files changed, 33 insertions(+) diff --git a/kotlinx-coroutines-core/api/kotlinx-coroutines-core.api b/kotlinx-coroutines-core/api/kotlinx-coroutines-core.api index 9790ed05ab..322c60099e 100644 --- a/kotlinx-coroutines-core/api/kotlinx-coroutines-core.api +++ b/kotlinx-coroutines-core/api/kotlinx-coroutines-core.api @@ -742,12 +742,25 @@ public final class kotlinx/coroutines/channels/ChannelResult { public final synthetic fun unbox-impl ()Ljava/lang/Object; } +public final class kotlinx/coroutines/channels/ChannelResult$Closed : kotlinx/coroutines/channels/ChannelResult$Failed { + public final field cause Ljava/lang/Throwable; + public fun (Ljava/lang/Throwable;)V + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + public final class kotlinx/coroutines/channels/ChannelResult$Companion { public final fun closed-JP2dKIU (Ljava/lang/Throwable;)Ljava/lang/Object; public final fun failure-PtdJZtk ()Ljava/lang/Object; public final fun success-JP2dKIU (Ljava/lang/Object;)Ljava/lang/Object; } +public class kotlinx/coroutines/channels/ChannelResult$Failed { + public fun ()V + public fun toString ()Ljava/lang/String; +} + public final class kotlinx/coroutines/channels/ChannelsKt { public static final synthetic fun any (Lkotlinx/coroutines/channels/ReceiveChannel;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final fun cancelConsumed (Lkotlinx/coroutines/channels/ReceiveChannel;Ljava/lang/Throwable;)V diff --git a/kotlinx-coroutines-core/api/kotlinx-coroutines-core.klib.api b/kotlinx-coroutines-core/api/kotlinx-coroutines-core.klib.api index effb60f649..b352f412ee 100644 --- a/kotlinx-coroutines-core/api/kotlinx-coroutines-core.klib.api +++ b/kotlinx-coroutines-core/api/kotlinx-coroutines-core.klib.api @@ -546,6 +546,23 @@ final value class <#A: out kotlin/Any?> kotlinx.coroutines.channels/ChannelResul final fun hashCode(): kotlin/Int // kotlinx.coroutines.channels/ChannelResult.hashCode|hashCode(){}[0] final fun toString(): kotlin/String // kotlinx.coroutines.channels/ChannelResult.toString|toString(){}[0] + final class Closed : kotlinx.coroutines.channels/ChannelResult.Failed { // kotlinx.coroutines.channels/ChannelResult.Closed|null[0] + constructor (kotlin/Throwable?) // kotlinx.coroutines.channels/ChannelResult.Closed.|(kotlin.Throwable?){}[0] + + final val cause // kotlinx.coroutines.channels/ChannelResult.Closed.cause|{}cause[0] + final fun (): kotlin/Throwable? // kotlinx.coroutines.channels/ChannelResult.Closed.cause.|(){}[0] + + final fun equals(kotlin/Any?): kotlin/Boolean // kotlinx.coroutines.channels/ChannelResult.Closed.equals|equals(kotlin.Any?){}[0] + final fun hashCode(): kotlin/Int // kotlinx.coroutines.channels/ChannelResult.Closed.hashCode|hashCode(){}[0] + final fun toString(): kotlin/String // kotlinx.coroutines.channels/ChannelResult.Closed.toString|toString(){}[0] + } + + open class Failed { // kotlinx.coroutines.channels/ChannelResult.Failed|null[0] + constructor () // kotlinx.coroutines.channels/ChannelResult.Failed.|(){}[0] + + open fun toString(): kotlin/String // kotlinx.coroutines.channels/ChannelResult.Failed.toString|toString(){}[0] + } + final object Companion { // kotlinx.coroutines.channels/ChannelResult.Companion|null[0] final fun <#A2: kotlin/Any?> closed(kotlin/Throwable?): kotlinx.coroutines.channels/ChannelResult<#A2> // kotlinx.coroutines.channels/ChannelResult.Companion.closed|closed(kotlin.Throwable?){0§}[0] final fun <#A2: kotlin/Any?> failure(): kotlinx.coroutines.channels/ChannelResult<#A2> // kotlinx.coroutines.channels/ChannelResult.Companion.failure|failure(){0§}[0] diff --git a/kotlinx-coroutines-core/common/src/channels/Channel.kt b/kotlinx-coroutines-core/common/src/channels/Channel.kt index 3e3c0f5fae..4f058127a9 100644 --- a/kotlinx-coroutines-core/common/src/channels/Channel.kt +++ b/kotlinx-coroutines-core/common/src/channels/Channel.kt @@ -939,10 +939,12 @@ public value class ChannelResult */ public fun exceptionOrNull(): Throwable? = (holder as? Closed)?.cause + @PublishedApi internal open class Failed { override fun toString(): String = "Failed" } + @PublishedApi internal class Closed(@JvmField val cause: Throwable?): Failed() { override fun equals(other: Any?): Boolean = other is Closed && cause == other.cause override fun hashCode(): Int = cause.hashCode() diff --git a/kotlinx-coroutines-core/jvm/src/internal/ThreadContext.kt b/kotlinx-coroutines-core/jvm/src/internal/ThreadContext.kt index 8f21b13c25..979d357ee0 100644 --- a/kotlinx-coroutines-core/jvm/src/internal/ThreadContext.kt +++ b/kotlinx-coroutines-core/jvm/src/internal/ThreadContext.kt @@ -96,6 +96,7 @@ internal fun restoreThreadContext(context: CoroutineContext, oldState: Any?) { @PublishedApi internal data class ThreadLocalKey(private val threadLocal: ThreadLocal<*>) : CoroutineContext.Key> +@PublishedApi internal class ThreadLocalElement( private val value: T, private val threadLocal: ThreadLocal From 35be629f8ceb1318f3391bd921ce1d7be723a534 Mon Sep 17 00:00:00 2001 From: Kirill Rakhman Date: Wed, 18 Jun 2025 10:02:54 +0200 Subject: [PATCH 8/8] Convert return in expression body to labeled return in preparation for KT-22786 --- kotlinx-coroutines-core/common/src/flow/SharedFlow.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kotlinx-coroutines-core/common/src/flow/SharedFlow.kt b/kotlinx-coroutines-core/common/src/flow/SharedFlow.kt index 4f19641e48..690eb29281 100644 --- a/kotlinx-coroutines-core/common/src/flow/SharedFlow.kt +++ b/kotlinx-coroutines-core/common/src/flow/SharedFlow.kt @@ -519,9 +519,9 @@ internal open class SharedFlowImpl( } private fun cancelEmitter(emitter: Emitter) = synchronized(this) { - if (emitter.index < head) return // already skipped past this index + if (emitter.index < head) return@synchronized // already skipped past this index val buffer = buffer!! - if (buffer.getBufferAt(emitter.index) !== emitter) return // already resumed + if (buffer.getBufferAt(emitter.index) !== emitter) return@synchronized // already resumed buffer.setBufferAt(emitter.index, NO_VALUE) cleanupTailLocked() }