-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add WasmWasi support #154
Add WasmWasi support #154
Conversation
c9cc41b
to
28f70f2
Compare
So I can't get past this error in the wasi test run by nodejs:
Any ideas? |
@benasher44 Have you tried out Node's canary versions? WASM GC is still a bit unstable. This works for me: In import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin
// ...
rootProject.plugins.withType(NodeJsRootPlugin::class.java) {
rootProject.the<NodeJsRootExtension>().download = true
rootProject.the<NodeJsRootExtension>().nodeVersion = nodeVersion
if (nodeVersion.contains("canary")) {
rootProject.the<NodeJsRootExtension>().nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary"
}
}
tasks.withType(org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask::class.java).configureEach {
args.add("--ignore-engines")
} In nodeVersion=21.0.0-v8-canary20231024d0ddc81258 This is what they do on KotlinX Serialization, for instance. The
Applying these changes locally fixes the WASI testsuite. Based on the changes in this PR, here is a patch: diff --git a/build.gradle.kts b/build.gradle.kts
index 9c60a63..7a38dc4 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,3 +1,5 @@
+import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
+import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin
import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompileTool
import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile
import org.jetbrains.kotlin.konan.target.HostManager
@@ -9,6 +11,8 @@ plugins {
id("signing")
}
+val nodeVersion = properties["nodeVersion"] as String
+
repositories {
mavenCentral()
}
@@ -171,8 +175,16 @@ tasks.withType<KotlinNativeCompile>().configureEach {
compilerOptions.freeCompilerArgs.add("-opt-in=kotlinx.cinterop.ExperimentalForeignApi")
}
-plugins.withType<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin> {
- the<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension>().nodeVersion = "20.11.1"
+rootProject.plugins.withType(NodeJsRootPlugin::class.java) {
+ rootProject.the<NodeJsRootExtension>().download = true
+ rootProject.the<NodeJsRootExtension>().nodeVersion = nodeVersion
+ if (nodeVersion.contains("canary")) {
+ rootProject.the<NodeJsRootExtension>().nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary"
+ }
+}
+
+tasks.withType(org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask::class.java).configureEach {
+ args.add("--ignore-engines")
}
val ktlintConfig by configurations.creating
diff --git a/gradle.properties b/gradle.properties
index b63d4fd..c0c57ba 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,3 +1,5 @@
+nodeVersion=21.0.0-v8-canary20231024d0ddc81258
+
org.gradle.caching=true
org.gradle.parallel=true
Expand for WASI test output> Task :wasmWasiNodeTest ##teamcity[testSuiteStarted name='com.benasher44.uuid' flowId='wasmTcAdapter1801547762'] ##teamcity[testSuiteStarted name='UuidTest' flowId='wasmTcAdapter1801547762'] ##teamcity[testStarted name='generates_a_UUID' flowId='wasmTcAdapter1801547762'] ##teamcity[testFinished name='generates_a_UUID' flowId='wasmTcAdapter1801547762'] ##teamcity[testStarted name='deprecated_parses_a_UUID_from_a_string' flowId='wasmTcAdapter1801547762'] ##teamcity[testFinished name='deprecated_parses_a_UUID_from_a_string' flowId='wasmTcAdapter1801547762'] ##teamcity[testStarted name='parses_a_UUID_from_a_string' flowId='wasmTcAdapter1801547762'] ##teamcity[testFinished name='parses_a_UUID_from_a_string' flowId='wasmTcAdapter1801547762'] ##teamcity[testStarted name='throws_when_passed_invalid_number_of_bytes' flowId='wasmTcAdapter1801547762'] ##teamcity[testFinished name='throws_when_passed_invalid_number_of_bytes' flowId='wasmTcAdapter1801547762'] ##teamcity[testStarted name='parsing_throws_when_passed_invalid_length_of_string' flowId='wasmTcAdapter1801547762'] ##teamcity[testFinished name='parsing_throws_when_passed_invalid_length_of_string' flowId='wasmTcAdapter1801547762'] ##teamcity[testStarted name='parsing_throws_when_passed_invalid_format_of_string' flowId='wasmTcAdapter1801547762'] ##teamcity[testFinished name='parsing_throws_when_passed_invalid_format_of_string' flowId='wasmTcAdapter1801547762'] ##teamcity[testStarted name='parsing_throws_when_passed_invalid_characters_in_string' flowId='wasmTcAdapter1801547762'] ##teamcity[testFinished name='parsing_throws_when_passed_invalid_characters_in_string' flowId='wasmTcAdapter1801547762'] ##teamcity[testStarted name='deprecated_parse_provides_higher_and_lower_bits' flowId='wasmTcAdapter1801547762'] ##teamcity[testFinished name='deprecated_parse_provides_higher_and_lower_bits' flowId='wasmTcAdapter1801547762'] ##teamcity[testStarted name='provides_higher_and_lower_bits' flowId='wasmTcAdapter1801547762'] ##teamcity[testFinished name='provides_higher_and_lower_bits' flowId='wasmTcAdapter1801547762'] ##teamcity[testStarted name='uuid4_generation' flowId='wasmTcAdapter1801547762'] ##teamcity[testFinished name='uuid4_generation' flowId='wasmTcAdapter1801547762'] ##teamcity[testStarted name='uuid_from_msb_and_lsb' flowId='wasmTcAdapter1801547762'] ##teamcity[testFinished name='uuid_from_msb_and_lsb' flowId='wasmTcAdapter1801547762'] ##teamcity[testStarted name='parse_variants_from_deprecated_parse' flowId='wasmTcAdapter1801547762'] ##teamcity[testFinished name='parse_variants_from_deprecated_parse' flowId='wasmTcAdapter1801547762'] ##teamcity[testStarted name='variants' flowId='wasmTcAdapter1801547762'] ##teamcity[testFinished name='variants' flowId='wasmTcAdapter1801547762'] ##teamcity[testStarted name='versions_from_deprecated_parse' flowId='wasmTcAdapter1801547762'] ##teamcity[testFinished name='versions_from_deprecated_parse' flowId='wasmTcAdapter1801547762'] ##teamcity[testStarted name='versions' flowId='wasmTcAdapter1801547762'] ##teamcity[testFinished name='versions' flowId='wasmTcAdapter1801547762'] ##teamcity[testStarted name='test_comparison' flowId='wasmTcAdapter1801547762'] ##teamcity[testFinished name='test_comparison' flowId='wasmTcAdapter1801547762'] ##teamcity[testSuiteFinished name='UuidTest' flowId='wasmTcAdapter1801547762'] ##teamcity[testSuiteFinished name='com.benasher44.uuid' flowId='wasmTcAdapter1801547762'] (node:73074) ExperimentalWarning: WASI is an experimental feature and might change at any time (Use `node --trace-warnings ...` to show where the warning was created) (node:73076) ExperimentalWarning: WASI is an experimental feature and might change at any time (Use `node --trace-warnings ...` to show where the warning was created) Patch file for download: |
Neat! Will fix this week. Thanks! |
2be3feb
to
504e754
Compare
504e754
to
01cd207
Compare
Fixes or Changes Proposed
Fixes #153
PR Checklist