Fix platform validation for wasm32-wasip1 target (#2894)
This fix validation errors for the new `wasm32-wasip1` target. The older
`wasm32-wasi` is already covered. Fixes #2782
Signed-off-by: Chaitanya Munukutla <chaitanya.m61292@gmail.com>
Co-authored-by: UebelAndre <github@uebelandre.com>
diff --git a/rust/platform/triple.bzl b/rust/platform/triple.bzl
index 673240e..60f38de 100644
--- a/rust/platform/triple.bzl
+++ b/rust/platform/triple.bzl
@@ -21,11 +21,11 @@
- abi (str, optional): The abi to use or None if abi does not apply.
- str (str): Original string representation of the triple
"""
- if triple == "wasm32-wasi":
+ if triple in ("wasm32-wasi", "wasm32-wasip1"):
return struct(
- arch = "wasm32",
- system = "wasi",
- vendor = "wasi",
+ arch = triple.split("-")[0],
+ system = triple.split("-")[1],
+ vendor = triple.split("-")[1],
abi = None,
str = triple,
)
diff --git a/test/unit/platform_triple/platform_triple_test.bzl b/test/unit/platform_triple/platform_triple_test.bzl
index 037379d..68b5d55 100644
--- a/test/unit/platform_triple/platform_triple_test.bzl
+++ b/test/unit/platform_triple/platform_triple_test.bzl
@@ -126,6 +126,7 @@
_assert_parts(env, triple("thumbv8m.main-none-eabi"), "thumbv8m.main", None, "none", "eabi")
_assert_parts(env, triple("wasm32-unknown-unknown"), "wasm32", "unknown", "unknown", None)
_assert_parts(env, triple("wasm32-wasi"), "wasm32", "wasi", "wasi", None)
+ _assert_parts(env, triple("wasm32-wasip1"), "wasm32", "wasip1", "wasip1", None)
_assert_parts(env, triple("x86_64-fuchsia"), "x86_64", "fuchsia", "fuchsia", None)
return unittest.end(env)