Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pluginManager.withPlugin("org.gradle.java-base") {
apply(plugin = "ru.vyarus.animalsniffer")

configure<AnimalSnifferExtension> {
sourceSets = listOf((project.extensions.getByName("sourceSets") as SourceSetContainer).getByName("main"))
defaultTargets = setOf("jvmMain")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
val signature: Configuration by configurations
dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

val mrjToolchain = versionCatalog.findVersion("multi.release.toolchain").getOrNull()?.requiredVersion
Expand Down
5 changes: 2 additions & 3 deletions bytestring/apple/test/ByteStringAppleTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion bytestring/apple/test/samples/samplesApple.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
12 changes: 0 additions & 12 deletions bytestring/common/src/Base64.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
}
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -110,7 +104,6 @@ public fun Base64.encode(
*
* @return the destination appendable.
*/
@ExperimentalEncodingApi
public fun <A : Appendable> Base64.encodeToAppendable(
source: ByteString,
destination: A,
Expand Down Expand Up @@ -139,7 +132,6 @@ public fun <A : Appendable> 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)
}
Expand All @@ -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))
}
Expand All @@ -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,
Expand Down Expand Up @@ -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))
}
Expand All @@ -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))
}
3 changes: 0 additions & 3 deletions bytestring/common/src/Hex.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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,
Expand All @@ -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))
}
3 changes: 0 additions & 3 deletions bytestring/common/test/ByteStringBase64Test.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 0 additions & 2 deletions bytestring/common/test/ByteStringHexTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion core/common/test/Utf8Test.kt
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,6 @@ class Utf8Test {
buffer.assertUtf8StringDecoded("${REPLACEMENT_CHARACTER}aaa", "f0616161")
}

@OptIn(ExperimentalStdlibApi::class)
@Test
fun encodeUtf16SurrogatePair() {
val buffer = Buffer()
Expand Down
1 change: 0 additions & 1 deletion core/common/test/files/SmokeFileTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ class SmokeFileTest {
assertFailsWith<IOException> { SystemFileSystem.source(dir).buffered().readByte() }
}

@OptIn(ExperimentalStdlibApi::class)
@Test
fun writeDirectory() {
val dir = createTempPath()
Expand Down
3 changes: 1 addition & 2 deletions core/common/test/samples/unsafe/unsafeSamples.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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.*
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion core/jvm/test/samples/unsafeAccessSamplesJvm.kt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class UnsafeReadWriteSamplesJvm {
}
}

@OptIn(UnsafeByteStringApi::class, ExperimentalStdlibApi::class)
@OptIn(UnsafeByteStringApi::class)
@Test
fun messageDigest() {
fun Buffer.digest(algorithm: String): ByteString {
Expand Down
1 change: 0 additions & 1 deletion core/jvm/test/utilJVM.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion core/native/test/util.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion core/nodeFilesystemShared/test/files/utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
33 changes: 9 additions & 24 deletions core/wasmWasi/test/test-driver.mjs.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,20 @@ const wasi = new WASI({ version: 'preview1', args: argv, env: env, preopens: {
'/var/log': '<SYSTEM_TEMP_DIR2>'
}});

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());

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


1 change: 0 additions & 1 deletion core/wasmWasi/test/utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
kotlin = "2.1.0"
kotlin = "2.2.0"
java = "8"
multi-release-toolchain = "17"
dokka = "2.0.0"
Expand Down
4 changes: 4 additions & 0 deletions kotlin-js-store/wasm/yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
Copy link
Contributor Author

@whyoleg whyoleg Jun 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# yarn lockfile v1


5 changes: 0 additions & 5 deletions kotlin-js-store/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,6 @@ to-regex-range@^5.0.1:
dependencies:
is-number "^7.0.0"

[email protected]:
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"
Expand Down