diff --git a/CHANGELOG.md b/CHANGELOG.md index 78c451d..b9856bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/). +## [0.8.3] - 2024-03-16 +### Changed +- Bump kotlin to 1.9.23 +- Add wasmWasi support + ## [0.8.2] - 2023-11-10 ### Changed - Bump kotlin to 1.9.20 diff --git a/build.gradle.kts b/build.gradle.kts index 36a83de..d2f1b95 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,7 +3,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile import org.jetbrains.kotlin.konan.target.HostManager plugins { - kotlin("multiplatform") version "1.9.20" + kotlin("multiplatform") version "1.9.23" id("org.jetbrains.dokka") version "1.8.20" id("maven-publish") id("signing") @@ -66,9 +66,12 @@ kotlin { binaries.findTest(DEBUG)!!.linkerOpts = mutableListOf("-Wl,--subsystem,windows") } } - if (HostManager.hostIsLinux || HostManager.hostIsMac) { + if (HostManager.hostIsLinux) { linuxX64() linuxArm64() + wasmWasi { + nodejs() + } } } @@ -150,11 +153,12 @@ kotlin { val mingwX64Test by getting { dependsOn(mingwTest) } } - if (HostManager.hostIsLinux || HostManager.hostIsMac) { + if (HostManager.hostIsLinux) { val linuxX64Main by getting { dependsOn(nix64Main) } val linuxX64Test by getting { dependsOn(nix64Test) } val linuxArm64Main by getting { dependsOn(nix64Main) } val linuxArm64Test by getting { dependsOn(nix64Test) } + val wasmWasiMain by getting { dependsOn(nonJvmMain) } } } } @@ -167,6 +171,20 @@ tasks.withType().configureEach { compilerOptions.freeCompilerArgs.add("-opt-in=kotlinx.cinterop.ExperimentalForeignApi") } +if (HostManager.hostIsLinux) { + plugins.withType { + the().download = true + the().nodeVersion = + "21.0.0-v8-canary20231024d0ddc81258" + the().nodeDownloadBaseUrl = + "https://nodejs.org/download/v8-canary" + } + + tasks.withType().configureEach { + args.add("--ignore-engines") + } +} + val ktlintConfig by configurations.creating dependencies { diff --git a/gradle.properties b/gradle.properties index 917396d..b63d4fd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ kotlin.code.style=official kotlin.incremental=true GROUP=com.benasher44 -VERSION=0.8.2 +VERSION=0.8.3 POM_URL=https://github.com/benasher44/uuid/ POM_SCM_URL=https://github.com/benasher44/uuid/ @@ -21,4 +21,4 @@ POM_DESCRIPTION=A Kotlin multiplatform implementation of a v4 RFC4122 UUID org.gradle.jvmargs=-Xmx4g -kotlin.stdlib.default.dependency=false +kotlin.stdlib.default.dependency=false \ No newline at end of file diff --git a/publish.gradle b/publish.gradle index 40a4665..c72b097 100644 --- a/publish.gradle +++ b/publish.gradle @@ -118,4 +118,5 @@ tasks.register('publishWindows') { tasks.register('publishLinux') { dependsOn 'publishLinuxX64PublicationToMavenRepository' dependsOn 'publishLinuxArm64PublicationToMavenRepository' + dependsOn 'publishWasmWasiPublicationToMavenRepository' } diff --git a/src/wasmWasiMain/kotlin/platform.kt b/src/wasmWasiMain/kotlin/platform.kt new file mode 100644 index 0000000..470a00c --- /dev/null +++ b/src/wasmWasiMain/kotlin/platform.kt @@ -0,0 +1,7 @@ +package com.benasher44.uuid + +import kotlin.random.Random + +internal actual fun getRandomUuidBytes(): ByteArray = Random.Default.nextBytes(UUID_BYTES) + +internal actual fun T.freeze(): T = this