From 09247616fc65a4521408f8ed5e33008c011e2b50 Mon Sep 17 00:00:00 2001 From: Matthew Nelson Date: Mon, 18 Mar 2024 11:58:19 -0400 Subject: [PATCH] Add wasmJs & wasmWasi --- README.md | 7 ++--- .../main/kotlin/-KmpConfigurationExtension.kt | 26 +++++++++++++++++-- build.gradle.kts | 14 ++++++++++ gradle/libs.versions.toml | 2 +- 4 files changed, 41 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 98ca39d..22e3211 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ ![badge-platform-jvm] ![badge-platform-js] ![badge-platform-js-node] +![badge-platform-wasm] ![badge-platform-linux] ![badge-platform-macos] ![badge-platform-ios] @@ -19,10 +20,6 @@ ![badge-support-js-ir] ![badge-support-linux-arm] - - [Sponge functions][url-sponge-functions] For Kotlin Multiplatform Utilized by the [hash][url-hash] repository `sha3` implementation @@ -68,7 +65,7 @@ dependencies { [badge-license]: https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat -[badge-kotlin]: https://img.shields.io/badge/kotlin-1.9.21-blue.svg?logo=kotlin +[badge-kotlin]: https://img.shields.io/badge/kotlin-1.9.23-blue.svg?logo=kotlin [badge-platform-android]: http://img.shields.io/badge/-android-6EDB8D.svg?style=flat diff --git a/build-logic/src/main/kotlin/-KmpConfigurationExtension.kt b/build-logic/src/main/kotlin/-KmpConfigurationExtension.kt index dd0ed50..e93887a 100644 --- a/build-logic/src/main/kotlin/-KmpConfigurationExtension.kt +++ b/build-logic/src/main/kotlin/-KmpConfigurationExtension.kt @@ -18,6 +18,7 @@ import io.matthewnelson.kmp.configuration.extension.KmpConfigurationExtension import io.matthewnelson.kmp.configuration.extension.container.target.KmpConfigurationContainerDsl import org.gradle.api.Action import org.gradle.api.JavaVersion +import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl fun KmpConfigurationExtension.configureShared( java9ModuleName: String? = null, @@ -36,8 +37,29 @@ fun KmpConfigurationExtension.configureShared( } js() -// wasmJs {} -// wasmWasi {} + + @OptIn(ExperimentalWasmDsl::class) + wasmJs { + target { + browser { + testTask { + useMocha { timeout = "30s" } + } + } + nodejs { + testTask { + useMocha { timeout = "30s" } + } + } + } + } + + @OptIn(ExperimentalWasmDsl::class) + wasmWasi { + target { + nodejs() + } + } androidNativeAll() diff --git a/build.gradle.kts b/build.gradle.kts index 6eb59ca..6b804eb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,6 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. **/ +import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension +import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin +import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension @@ -37,6 +40,17 @@ plugins.withType { the().lockFileDirectory = rootDir.resolve(".kotlin-js-store") } +plugins.withType { + the().apply { + nodeVersion = "21.0.0-v8-canary202309167e82ab1fa2" + nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary" + } + + tasks.withType().configureEach { + args.add("--ignore-engines") + } +} + apiValidation { if (findProperty("CHECK_PUBLICATION") != null) { ignoredProjects.add("check-publication") diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 07b2c20..332e674 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,7 +2,7 @@ binaryCompat = "0.14.0" configuration = "0.2.1" encoding = "2.2.1" -endians = "0.2.0" +endians = "0.3.0" kotlin = "1.9.23" publish = "0.27.0"