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 948857618..58e6768b8 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 @@ -9,7 +9,7 @@ pluginManager.withPlugin("org.gradle.java-base") { apply(plugin = "ru.vyarus.animalsniffer") configure { - sourceSets = listOf((project.extensions.getByName("sourceSets") as SourceSetContainer).getByName("main")) + defaultTargets = setOf("jvmMain") } val signature: Configuration by configurations dependencies { 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 0780b1b96..05b978353 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 kotlinx.io.build.configureJava9ModuleInfoCompilation import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl +import org.jetbrains.kotlin.gradle.dsl.JvmDefaultMode import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet import kotlin.jvm.optionals.getOrNull @@ -30,17 +31,11 @@ kotlin { } jvm { - withJava() testRuns["test"].executionTask.configure { useJUnitPlatform() } - // can be replaced with just `compilerOptions { }` in Kotlin 2.0 - compilations.configureEach { - compileTaskProvider.configure { - compilerOptions { - freeCompilerArgs.add("-Xjvm-default=all") - } - } + compilerOptions { + jvmDefault = JvmDefaultMode.NO_COMPATIBILITY } val mrjToolchain = versionCatalog.findVersion("multi.release.toolchain").getOrNull()?.requiredVersion diff --git a/bytestring/apple/test/ByteStringAppleTest.kt b/bytestring/apple/test/ByteStringAppleTest.kt index 702bbf5a2..45166786a 100644 --- a/bytestring/apple/test/ByteStringAppleTest.kt +++ b/bytestring/apple/test/ByteStringAppleTest.kt @@ -12,7 +12,6 @@ import platform.Foundation.NSData import platform.Foundation.create import platform.posix.memset import kotlin.io.encoding.Base64 -import kotlin.io.encoding.ExperimentalEncodingApi import kotlin.test.* @OptIn(UnsafeNumber::class) @@ -27,12 +26,12 @@ class ByteStringAppleTest { assertContentEquals(byteArrayOf(0, 1, 2, 3, 4, 5), copy.bytes!!.readBytes(copy.length.convert())) } - @OptIn(BetaInteropApi::class, ExperimentalEncodingApi::class) + @OptIn(BetaInteropApi::class) @Test fun fromNSData() { assertTrue(NSData().toByteString().isEmpty()) val src = NSData.create( - base64EncodedString = Base64.Default.encode(byteArrayOf(0, 1, 2, 3, 4, 5)), + base64EncodedString = Base64.encode(byteArrayOf(0, 1, 2, 3, 4, 5)), options = 0u )!! val copy = src.toByteString() diff --git a/bytestring/apple/test/samples/samplesApple.kt b/bytestring/apple/test/samples/samplesApple.kt index c2d6432bb..9d0701638 100644 --- a/bytestring/apple/test/samples/samplesApple.kt +++ b/bytestring/apple/test/samples/samplesApple.kt @@ -12,7 +12,7 @@ import platform.Foundation.* import kotlin.test.* class ByteStringSamplesApple { - @OptIn(UnsafeNumber::class, ExperimentalForeignApi::class, ExperimentalStdlibApi::class) + @OptIn(UnsafeNumber::class, ExperimentalForeignApi::class) @Test fun nsDataConversion() { val originalByteString: ByteString = "Compress me, please!".encodeToByteString() diff --git a/bytestring/common/src/Base64.kt b/bytestring/common/src/Base64.kt index f21ebc4e1..1b516efa4 100644 --- a/bytestring/common/src/Base64.kt +++ b/bytestring/common/src/Base64.kt @@ -6,9 +6,6 @@ package kotlinx.io.bytestring import kotlin.io.encoding.Base64 -import kotlin.io.encoding.Base64.Default.encode -import kotlin.io.encoding.Base64.Default.encodeToByteArray -import kotlin.io.encoding.ExperimentalEncodingApi /** * Encodes bytes from the specified [source] byte string or its subrange. @@ -30,7 +27,6 @@ import kotlin.io.encoding.ExperimentalEncodingApi * * @return a [ByteArray] with the resulting symbols. */ -@ExperimentalEncodingApi public fun Base64.encodeToByteArray(source: ByteString, startIndex: Int = 0, endIndex: Int = source.size): ByteArray { return encodeToByteArray(source.getBackingArrayReference(), startIndex, endIndex) } @@ -55,7 +51,6 @@ public fun Base64.encodeToByteArray(source: ByteString, startIndex: Int = 0, end * * @return the number of symbols written into [destination] array. */ -@ExperimentalEncodingApi public fun Base64.encodeIntoByteArray( source: ByteString, destination: ByteArray, @@ -84,7 +79,6 @@ public fun Base64.encodeIntoByteArray( * * @return a string with the resulting symbols. */ -@ExperimentalEncodingApi public fun Base64.encode( source: ByteString, startIndex: Int = 0, @@ -110,7 +104,6 @@ public fun Base64.encode( * * @return the destination appendable. */ -@ExperimentalEncodingApi public fun Base64.encodeToAppendable( source: ByteString, destination: A, @@ -139,7 +132,6 @@ public fun Base64.encodeToAppendable( * * @return a [ByteArray] with the resulting bytes. */ -@ExperimentalEncodingApi public fun Base64.decode(source: ByteString, startIndex: Int = 0, endIndex: Int = source.size): ByteArray { return decode(source.getBackingArrayReference(), startIndex, endIndex) } @@ -162,7 +154,6 @@ public fun Base64.decode(source: ByteString, startIndex: Int = 0, endIndex: Int * * @return a [ByteArray] with the resulting bytes. */ -@ExperimentalEncodingApi public fun Base64.decodeToByteString(source: CharSequence, startIndex: Int = 0, endIndex: Int = source.length): ByteString { return ByteString.wrap(decode(source, startIndex, endIndex)) } @@ -189,7 +180,6 @@ public fun Base64.decodeToByteString(source: CharSequence, startIndex: Int = 0, * * @return the number of bytes written into [destination] array. */ -@ExperimentalEncodingApi public fun Base64.decodeIntoByteArray( source: ByteString, destination: ByteArray, @@ -218,7 +208,6 @@ public fun Base64.decodeIntoByteArray( * * @return a [ByteString] with the resulting bytes. */ -@ExperimentalEncodingApi public fun Base64.decodeToByteString(source: ByteArray, startIndex: Int = 0, endIndex: Int = source.size): ByteString { return ByteString.wrap(decode(source, startIndex, endIndex)) } @@ -241,7 +230,6 @@ public fun Base64.decodeToByteString(source: ByteArray, startIndex: Int = 0, end * * @return a [ByteString] with the resulting bytes. */ -@ExperimentalEncodingApi public fun Base64.decodeToByteString(source: ByteString, startIndex: Int = 0, endIndex: Int = source.size): ByteString { return ByteString.wrap(decode(source.getBackingArrayReference(), startIndex, endIndex)) } diff --git a/bytestring/common/src/Hex.kt b/bytestring/common/src/Hex.kt index 4ecb46b6e..dbb213a1c 100644 --- a/bytestring/common/src/Hex.kt +++ b/bytestring/common/src/Hex.kt @@ -14,7 +14,6 @@ package kotlinx.io.bytestring * * @throws IllegalArgumentException if the result length is more than [String] maximum capacity. */ -@ExperimentalStdlibApi public fun ByteString.toHexString(format: HexFormat = HexFormat.Default): String { return getBackingArrayReference().toHexString(0, getBackingArrayReference().size, format) } @@ -32,7 +31,6 @@ public fun ByteString.toHexString(format: HexFormat = HexFormat.Default): String * @throws IllegalArgumentException when `startIndex > endIndex`. * @throws IllegalArgumentException if the result length is more than [String] maximum capacity. */ -@ExperimentalStdlibApi public fun ByteString.toHexString( startIndex: Int = 0, endIndex: Int = size, @@ -52,7 +50,6 @@ public fun ByteString.toHexString( * * @throws IllegalArgumentException if this string does not comply with the specified [format]. */ -@ExperimentalStdlibApi public fun String.hexToByteString(format: HexFormat = HexFormat.Default): ByteString { return ByteString.wrap(hexToByteArray(format)) } diff --git a/bytestring/common/test/ByteStringBase64Test.kt b/bytestring/common/test/ByteStringBase64Test.kt index 482029096..32daee64a 100644 --- a/bytestring/common/test/ByteStringBase64Test.kt +++ b/bytestring/common/test/ByteStringBase64Test.kt @@ -3,12 +3,9 @@ * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. */ -@file:OptIn(ExperimentalEncodingApi::class) - package kotlinx.io.bytestring import kotlin.io.encoding.Base64 -import kotlin.io.encoding.ExperimentalEncodingApi import kotlin.test.* class ByteStringBase64Test { diff --git a/bytestring/common/test/ByteStringHexTest.kt b/bytestring/common/test/ByteStringHexTest.kt index cd249a050..131830e22 100644 --- a/bytestring/common/test/ByteStringHexTest.kt +++ b/bytestring/common/test/ByteStringHexTest.kt @@ -3,8 +3,6 @@ * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. */ -@file:OptIn(ExperimentalStdlibApi::class) - package kotlinx.io.bytestring import kotlin.test.Test diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 0f974c16d..27d077027 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -61,7 +61,7 @@ tasks.named("wasmWasiNodeTest") { val templateFile = layout.projectDirectory.file("wasmWasi/test/test-driver.mjs.template").asFile val driverFile = layout.buildDirectory.file( - "compileSync/wasmWasi/test/testDevelopmentExecutable/kotlin/kotlinx-io-kotlinx-io-core-wasm-wasi-test.mjs" + "compileSync/wasmWasi/test/testDevelopmentExecutable/kotlin/kotlinx-io-kotlinx-io-core-test.mjs" ) fun File.mkdirsAndEscape(): String { diff --git a/core/common/test/Utf8Test.kt b/core/common/test/Utf8Test.kt index 2f1853985..499039d7d 100644 --- a/core/common/test/Utf8Test.kt +++ b/core/common/test/Utf8Test.kt @@ -432,7 +432,6 @@ class Utf8Test { buffer.assertUtf8StringDecoded("${REPLACEMENT_CHARACTER}aaa", "f0616161") } - @OptIn(ExperimentalStdlibApi::class) @Test fun encodeUtf16SurrogatePair() { val buffer = Buffer() diff --git a/core/common/test/files/SmokeFileTest.kt b/core/common/test/files/SmokeFileTest.kt index a4242b398..7761b4566 100644 --- a/core/common/test/files/SmokeFileTest.kt +++ b/core/common/test/files/SmokeFileTest.kt @@ -331,7 +331,6 @@ class SmokeFileTest { assertFailsWith { SystemFileSystem.source(dir).buffered().readByte() } } - @OptIn(ExperimentalStdlibApi::class) @Test fun writeDirectory() { val dir = createTempPath() diff --git a/core/common/test/samples/unsafe/unsafeSamples.kt b/core/common/test/samples/unsafe/unsafeSamples.kt index 18ec78918..98996c8bb 100644 --- a/core/common/test/samples/unsafe/unsafeSamples.kt +++ b/core/common/test/samples/unsafe/unsafeSamples.kt @@ -10,7 +10,6 @@ import kotlinx.io.bytestring.ByteString import kotlinx.io.unsafe.UnsafeBufferOperations import kotlinx.io.unsafe.withData import kotlin.io.encoding.Base64 -import kotlin.io.encoding.ExperimentalEncodingApi import kotlin.math.min import kotlin.random.Random import kotlin.test.* @@ -47,7 +46,7 @@ class UnsafeBufferOperationsSamples { assertEquals(10042L, buffer.size) } - @OptIn(ExperimentalEncodingApi::class, UnsafeIoApi::class) + @OptIn(UnsafeIoApi::class) @Test fun moveToTail() { fun Buffer.writeBase64(data: ByteArray, encoder: Base64 = Base64.Default) { diff --git a/core/jvm/test/samples/unsafeAccessSamplesJvm.kt b/core/jvm/test/samples/unsafeAccessSamplesJvm.kt index 298b75012..3e138d8a3 100644 --- a/core/jvm/test/samples/unsafeAccessSamplesJvm.kt +++ b/core/jvm/test/samples/unsafeAccessSamplesJvm.kt @@ -101,7 +101,7 @@ class UnsafeReadWriteSamplesJvm { } } - @OptIn(UnsafeByteStringApi::class, ExperimentalStdlibApi::class) + @OptIn(UnsafeByteStringApi::class) @Test fun messageDigest() { fun Buffer.digest(algorithm: String): ByteString { diff --git a/core/jvm/test/utilJVM.kt b/core/jvm/test/utilJVM.kt index a17d5ea4b..5d0833dee 100644 --- a/core/jvm/test/utilJVM.kt +++ b/core/jvm/test/utilJVM.kt @@ -9,7 +9,6 @@ import java.io.File import kotlin.random.Random import kotlin.test.assertEquals -@OptIn(ExperimentalStdlibApi::class) actual fun tempFileName(): String { val tmpDir = SystemTemporaryDirectory.file while (true) { diff --git a/core/native/test/util.kt b/core/native/test/util.kt index f8f50c5fd..0743a43ae 100644 --- a/core/native/test/util.kt +++ b/core/native/test/util.kt @@ -12,7 +12,6 @@ import platform.posix.F_OK import platform.posix.access import kotlin.random.Random -@OptIn(ExperimentalStdlibApi::class) actual fun tempFileName(): String { val tmpDir = SystemTemporaryDirectory.path for (i in 0 until 10) { diff --git a/core/nodeFilesystemShared/test/files/utils.kt b/core/nodeFilesystemShared/test/files/utils.kt index 20c6b2178..04e61ebce 100644 --- a/core/nodeFilesystemShared/test/files/utils.kt +++ b/core/nodeFilesystemShared/test/files/utils.kt @@ -10,7 +10,6 @@ import kotlinx.io.node.os import kotlinx.io.node.path import kotlin.random.Random -@OptIn(ExperimentalStdlibApi::class) actual fun tempFileName(): String { while (true) { val tmpdir = os.tmpdir() diff --git a/core/wasmWasi/test/test-driver.mjs.template b/core/wasmWasi/test/test-driver.mjs.template index 21003bed2..121b20217 100644 --- a/core/wasmWasi/test/test-driver.mjs.template +++ b/core/wasmWasi/test/test-driver.mjs.template @@ -7,14 +7,9 @@ const wasi = new WASI({ version: 'preview1', args: argv, env: env, preopens: { '/var/log': '' }}); -const module = await import(/* webpackIgnore: true */'node:module'); -const require = module.default.createRequire(import.meta.url); -const fs = require('fs'); -const path = require('path'); -const url = require('url'); -const filepath = url.fileURLToPath(import.meta.url); -const dirpath = path.dirname(filepath); -const wasmBuffer = fs.readFileSync(path.resolve(dirpath, './kotlinx-io-kotlinx-io-core-wasm-wasi-test.wasm')); +const fs = await import('node:fs'); +const url = await import('node:url'); +const wasmBuffer = fs.readFileSync(url.fileURLToPath(import.meta.resolve('./kotlinx-io-kotlinx-io-core-test.wasm'))); const wasmModule = new WebAssembly.Module(wasmBuffer); const wasmInstance = new WebAssembly.Instance(wasmModule, wasi.getImportObject()); @@ -22,20 +17,10 @@ wasi.initialize(wasmInstance); const exports = wasmInstance.exports -export default new Proxy(exports, { - _shownError: false, - get(target, prop) { - if (!this._shownError) { - this._shownError = true; - if (typeof console !== "undefined") { - console.error("Do not use default import. Use corresponding named import instead.") - } - } - return target[prop]; - } -}); export const { - startUnitTests, - _initialize, - memory -} = exports; +memory, +_initialize, +startUnitTests +} = exports + + diff --git a/core/wasmWasi/test/utils.kt b/core/wasmWasi/test/utils.kt index 5f4b4a254..cdc93c27d 100644 --- a/core/wasmWasi/test/utils.kt +++ b/core/wasmWasi/test/utils.kt @@ -9,6 +9,5 @@ import kotlinx.io.files.Path import kotlinx.io.files.SystemTemporaryDirectory import kotlin.random.Random -@OptIn(ExperimentalStdlibApi::class) actual fun tempFileName(): String = Path(SystemTemporaryDirectory, Random.nextBytes(32).toHexString()).toString() diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4d50fec49..61a02e733 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -kotlin = "2.1.0" +kotlin = "2.2.0" java = "8" multi-release-toolchain = "17" dokka = "2.0.0" diff --git a/kotlin-js-store/wasm/yarn.lock b/kotlin-js-store/wasm/yarn.lock new file mode 100644 index 000000000..fb57ccd13 --- /dev/null +++ b/kotlin-js-store/wasm/yarn.lock @@ -0,0 +1,4 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + diff --git a/kotlin-js-store/yarn.lock b/kotlin-js-store/yarn.lock index 4e41bd6b9..cb9453f88 100644 --- a/kotlin-js-store/yarn.lock +++ b/kotlin-js-store/yarn.lock @@ -456,11 +456,6 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" -typescript@5.5.4: - version "5.5.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.4.tgz#d9852d6c82bad2d2eda4fd74a5762a8f5909e9ba" - integrity sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q== - workerpool@^6.5.1: version "6.5.1" resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.5.1.tgz#060f73b39d0caf97c6db64da004cd01b4c099544"