From 5e5b403038ae220dd7de2e027477bc6a1b1eae91 Mon Sep 17 00:00:00 2001 From: Filipp Zhinkin Date: Fri, 13 Oct 2023 11:22:06 +0200 Subject: [PATCH 01/10] Bump up the version to 1.9.20-RC --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c70a25044..2b363d7f9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -kotlin = "1.9.10" +kotlin = "1.9.20-RC" java = "8" dokka = "1.8.20" kover = "0.7.3" From d431b3256bb1641f2a6037dbf1afa9b8ef4deb7f Mon Sep 17 00:00:00 2001 From: Filipp Zhinkin Date: Fri, 13 Oct 2023 11:33:12 +0200 Subject: [PATCH 02/10] Configure animalsniffer when the java-base is applied --- .../kotlinx/io/conventions/kotlinx-io-android-compat.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-android-compat.gradle.kts b/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-android-compat.gradle.kts index 1e9637161..948857618 100644 --- a/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-android-compat.gradle.kts +++ b/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-android-compat.gradle.kts @@ -5,7 +5,7 @@ import ru.vyarus.gradle.plugin.animalsniffer.AnimalSnifferExtension -pluginManager.withPlugin("java") { +pluginManager.withPlugin("org.gradle.java-base") { apply(plugin = "ru.vyarus.animalsniffer") configure { From b7597dc202ffa44a2cfd06291a5c65eeae334479 Mon Sep 17 00:00:00 2001 From: Filipp Zhinkin Date: Fri, 13 Oct 2023 11:33:56 +0200 Subject: [PATCH 03/10] Suppress the different base classes warning for RawSink --- core/jvm/src/RawSink.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/jvm/src/RawSink.kt b/core/jvm/src/RawSink.kt index a8d5d02e6..ce25bf8ab 100644 --- a/core/jvm/src/RawSink.kt +++ b/core/jvm/src/RawSink.kt @@ -22,7 +22,8 @@ package kotlinx.io import java.io.Flushable -@OptIn(ExperimentalStdlibApi::class) +@AllowDifferentMembersInActual +@OptIn(ExperimentalStdlibApi::class, ExperimentalMultiplatform::class) public actual interface RawSink : AutoCloseableAlias, Flushable { public actual fun write(source: Buffer, byteCount: Long) From dbb41748979f00d77d446cf19be0a27a200d1abf Mon Sep 17 00:00:00 2001 From: Filipp Zhinkin Date: Fri, 13 Oct 2023 11:34:14 +0200 Subject: [PATCH 04/10] Suppress actual/expect classes warning --- build.gradle.kts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index 7a84ebf09..dcff665cf 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,6 +4,7 @@ */ import kotlinx.kover.gradle.plugin.dsl.MetricType +import org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile @@ -27,11 +28,19 @@ subprojects { kotlinOptions { allWarningsAsErrors = true freeCompilerArgs += "-Xjvm-default=all" + freeCompilerArgs += "-Xexpect-actual-classes" } } tasks.withType().configureEach { kotlinOptions { allWarningsAsErrors = true + freeCompilerArgs += "-Xexpect-actual-classes" + } + } + tasks.withType().configureEach { + kotlinOptions { + allWarningsAsErrors = true + freeCompilerArgs += "-Xexpect-actual-classes" } } } From 234da163df262a013d0b612df13d8b5f1312cc79 Mon Sep 17 00:00:00 2001 From: Filipp Zhinkin Date: Fri, 13 Oct 2023 11:34:48 +0200 Subject: [PATCH 05/10] Get rid of default parameters from exception expect's ctors --- core/common/src/-CommonPlatform.kt | 7 +++++-- core/js/src/-PlatfromJs.kt | 6 +++++- core/native/src/-NonJvmPlatform.kt | 6 +++++- core/wasm/src/-PlatformWasm.kt | 6 +++++- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/core/common/src/-CommonPlatform.kt b/core/common/src/-CommonPlatform.kt index 7f0f74f19..8182eeb67 100644 --- a/core/common/src/-CommonPlatform.kt +++ b/core/common/src/-CommonPlatform.kt @@ -27,13 +27,16 @@ internal expect fun String.asUtf8ToByteArray(): ByteArray * Signals about a general issue occurred during I/O operation. */ public expect open class IOException(message: String?, cause: Throwable?) : Exception { - public constructor(message: String? = null) + public constructor() + public constructor(message: String?) } /** * Signals that the end of the file or stream was reached unexpectedly during an input operation. */ -public expect open class EOFException(message: String? = null) : IOException +public expect open class EOFException(message: String?) : IOException { + public constructor() +} // There is no actual AutoCloseable on JVM (https://youtrack.jetbrains.com/issue/KT-55777), diff --git a/core/js/src/-PlatfromJs.kt b/core/js/src/-PlatfromJs.kt index 732a2b4cc..fa06788a2 100644 --- a/core/js/src/-PlatfromJs.kt +++ b/core/js/src/-PlatfromJs.kt @@ -14,6 +14,10 @@ public actual open class IOException actual constructor( cause: Throwable? ) : Exception(message, cause) { public actual constructor(message: String?) : this(message, null) + + public actual constructor() : this(null) } -public actual open class EOFException actual constructor(message: String?) : IOException(message) +public actual open class EOFException actual constructor(message: String?) : IOException(message) { + public actual constructor() : this(null) +} diff --git a/core/native/src/-NonJvmPlatform.kt b/core/native/src/-NonJvmPlatform.kt index ffddac860..b5297d949 100644 --- a/core/native/src/-NonJvmPlatform.kt +++ b/core/native/src/-NonJvmPlatform.kt @@ -29,6 +29,10 @@ public actual open class IOException actual constructor( cause: Throwable? ) : Exception(message, cause) { public actual constructor(message: String?) : this(message, null) + + public actual constructor() : this(null) } -public actual open class EOFException actual constructor(message: String?) : IOException(message) +public actual open class EOFException actual constructor(message: String?) : IOException(message) { + public actual constructor() : this(null) +} diff --git a/core/wasm/src/-PlatformWasm.kt b/core/wasm/src/-PlatformWasm.kt index 732a2b4cc..fa06788a2 100644 --- a/core/wasm/src/-PlatformWasm.kt +++ b/core/wasm/src/-PlatformWasm.kt @@ -14,6 +14,10 @@ public actual open class IOException actual constructor( cause: Throwable? ) : Exception(message, cause) { public actual constructor(message: String?) : this(message, null) + + public actual constructor() : this(null) } -public actual open class EOFException actual constructor(message: String?) : IOException(message) +public actual open class EOFException actual constructor(message: String?) : IOException(message) { + public actual constructor() : this(null) +} From 5fad88a18bcba2eff6d482ed3d99b5069cb089c3 Mon Sep 17 00:00:00 2001 From: Filipp Zhinkin Date: Fri, 13 Oct 2023 11:42:16 +0200 Subject: [PATCH 06/10] Setup wasmJs source sets to use old wasm directory --- .../io/conventions/kotlinx-io-multiplatform.gradle.kts | 8 +++++++- core/build.gradle.kts | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts b/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts index 399c692d1..a33ba0409 100644 --- a/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts +++ b/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts @@ -38,7 +38,7 @@ kotlin { } @OptIn(org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl::class) - wasm { + wasmJs { nodejs() // Disabled because we can't exclude some tests: https://youtrack.jetbrains.com/issue/KT-58291 // browser() @@ -89,6 +89,12 @@ kotlin { createSourceSet("linuxTest", parent = unixTest, children = linuxTargets()) createSourceSet("androidMain", parent = unixMain, children = androidTargets()) createSourceSet("androidTest", parent = unixTest, children = androidTargets()) + getByName("wasmJsMain") { + kotlin.srcDir(File(File(projectDir, "wasm"), "src")) + } + getByName("wasmJsTest") { + kotlin.srcDir(File(File(projectDir, "wasm"), "test")) + } } } diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 3746d77e5..26b89e9b8 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -32,7 +32,7 @@ kotlin { } @OptIn(org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl::class) - wasm { + wasmJs { nodejs { testTask(Action { useMocha { From f5929a5cd9c406c9a71baf9a9f440b2476923c5a Mon Sep 17 00:00:00 2001 From: Filipp Zhinkin Date: Wed, 18 Oct 2023 17:18:53 +0200 Subject: [PATCH 07/10] Update nodejs to v21.0.0 --- .../kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts b/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts index a33ba0409..0fa5b0cae 100644 --- a/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts +++ b/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts @@ -198,5 +198,5 @@ fun androidTargets() = listOf( ) rootProject.the().apply { - nodeVersion = "20.4.0" + nodeVersion = "21.0.0" } From d1950009df6338258b9d706b17753b2bed025214 Mon Sep 17 00:00:00 2001 From: Filipp Zhinkin Date: Thu, 19 Oct 2023 11:06:24 +0200 Subject: [PATCH 08/10] Use canary NodeJs build --- .../io/conventions/kotlinx-io-multiplatform.gradle.kts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts b/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts index 0fa5b0cae..8dc93f5c3 100644 --- a/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts +++ b/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts @@ -6,6 +6,7 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension +import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask import kotlin.jvm.optionals.getOrNull plugins { @@ -198,5 +199,10 @@ fun androidTargets() = listOf( ) rootProject.the().apply { - nodeVersion = "21.0.0" + nodeVersion = "21.0.0-v8-canary202310177990572111" + nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary" +} + +rootProject.tasks.withType().configureEach { + args.add("--ignore-engines") } From 77e942c4acfa05882768b336d9c7a71a37868a1d Mon Sep 17 00:00:00 2001 From: Filipp Zhinkin Date: Wed, 25 Oct 2023 13:28:53 +0200 Subject: [PATCH 09/10] Update a Kotlin version to second 1.9.20 RC --- core/jvm/src/RawSink.kt | 3 --- gradle/libs.versions.toml | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/core/jvm/src/RawSink.kt b/core/jvm/src/RawSink.kt index ce25bf8ab..3c42e6428 100644 --- a/core/jvm/src/RawSink.kt +++ b/core/jvm/src/RawSink.kt @@ -21,9 +21,6 @@ package kotlinx.io import java.io.Flushable - -@AllowDifferentMembersInActual -@OptIn(ExperimentalStdlibApi::class, ExperimentalMultiplatform::class) public actual interface RawSink : AutoCloseableAlias, Flushable { public actual fun write(source: Buffer, byteCount: Long) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2b363d7f9..38b982e3a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -kotlin = "1.9.20-RC" +kotlin = "1.9.20-RC2" java = "8" dokka = "1.8.20" kover = "0.7.3" From cd484d0046e32d96ab9a77526e52b4ee02468a67 Mon Sep 17 00:00:00 2001 From: Filipp Zhinkin Date: Mon, 6 Nov 2023 10:07:27 +0100 Subject: [PATCH 10/10] Use final 1.9.20 build --- gradle.properties | 1 + gradle/libs.versions.toml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 32adba4d8..cf9e5bbb2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,3 +8,4 @@ version=0.3.1-SNAPSHOT kotlin.code.style=official org.gradle.jvmargs=-Xmx4G nativeBenchmarksEnabled=false +kotlin.mpp.applyDefaultHierarchyTemplate=false diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 38b982e3a..6ab60c22f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -kotlin = "1.9.20-RC2" +kotlin = "1.9.20" java = "8" dokka = "1.8.20" kover = "0.7.3"