From 8f324b5c2b49222f6d7746fce047b81db333db9f Mon Sep 17 00:00:00 2001 From: Ralf Anton Beier Date: Thu, 31 Jul 2025 21:10:31 +0200 Subject: [PATCH] Add `wasip1` and `wasip2` os constraints Adds support for distinguishing WASI Preview 1 and Preview 2: - wasip1: WASI Preview 1 (stable) - wasip2: WASI Preview 2 (ABI-incompatible with Preview 1) - Maintains backward compatibility with 'wasi' alias to 'wasip1' --- os/BUILD | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/os/BUILD b/os/BUILD index 2ba8529..f2af987 100644 --- a/os/BUILD +++ b/os/BUILD @@ -111,10 +111,22 @@ constraint_value( constraint_setting = ":os", ) -# WASI (WebAssembly System Interface) -# https://github.com/bytecodealliance/wasmtime/blob/main/docs/WASI-overview.md +# WASI Preview 1 (WebAssembly System Interface) +# https://github.com/WebAssembly/WASI/blob/main/legacy/preview1/docs.md constraint_value( + name = "wasip1", + constraint_setting = ":os", +) + +alias( name = "wasi", + actual = ":wasip1", +) + +# WASI Preview 2 is ABI-incompatible with Preview 1. +# https://github.com/WebAssembly/WASI/blob/main/preview2/README.md +constraint_value( + name = "wasip2", constraint_setting = ":os", )