diff --git a/lib/wasix/Cargo.toml b/lib/wasix/Cargo.toml index c8728fdeabc..5a713d52959 100644 --- a/lib/wasix/Cargo.toml +++ b/lib/wasix/Cargo.toml @@ -202,7 +202,8 @@ webc_runner_rt_dproxy = [ "tower-http", "journal", ] - +# the minimal sys implementation +sys-minimal = ["wasmer/sys", "sys-thread", "tokio/fs"] sys = [ "webc/mmap", "time", diff --git a/lib/wasix/src/lib.rs b/lib/wasix/src/lib.rs index 0ce952562dc..61aee0cd9be 100644 --- a/lib/wasix/src/lib.rs +++ b/lib/wasix/src/lib.rs @@ -14,12 +14,21 @@ //! [WASI plugin example](https://github.com/wasmerio/wasmer/blob/main/examples/plugin.rs) //! for an example of how to extend WASI using the WASI FS API. -#[cfg(all(not(feature = "sys"), not(feature = "js")))] -compile_error!("At least the `sys` or the `js` feature must be enabled. Please, pick one."); +#[cfg(all( + not(feature = "sys"), + not(feature = "js"), + not(feature = "sys-minimal") +))] +compile_error!( + "At least the `sys` or the `js` or `sys-minimal` feature must be enabled. Please, pick one." +); -#[cfg(all(feature = "sys", feature = "js"))] +#[cfg(any( + all(feature = "js", feature = "sys"), + all(feature = "js", feature = "sys-minimal") +))] compile_error!( - "Cannot have both `sys` and `js` features enabled at the same time. Please, pick one." + "Cannot have both `sys` and `js` or `sys-minimal` and `sys` features enabled at the same time. Please, pick one." ); #[cfg(all(feature = "sys", target_arch = "wasm32"))] diff --git a/lib/wasix/src/state/handles/mod.rs b/lib/wasix/src/state/handles/mod.rs index 77a67014e89..4a37397d14a 100644 --- a/lib/wasix/src/state/handles/mod.rs +++ b/lib/wasix/src/state/handles/mod.rs @@ -1,7 +1,7 @@ mod global; mod thread_local; -#[cfg(feature = "sys")] +#[cfg(any(feature = "sys", feature = "sys-minimal"))] pub(crate) use global::*; #[cfg(feature = "js")] pub(crate) use thread_local::*; diff --git a/lib/wasix/src/state/handles/thread_local.rs b/lib/wasix/src/state/handles/thread_local.rs index f7dc80c7e49..fb2f31c46d3 100644 --- a/lib/wasix/src/state/handles/thread_local.rs +++ b/lib/wasix/src/state/handles/thread_local.rs @@ -1,4 +1,4 @@ -#![cfg_attr(feature = "sys", allow(unused))] +#![cfg_attr(any(feature = "sys", feature = "sys-minimal"), allow(unused))] use std::cell::{Ref, RefCell, RefMut}; use std::ops::{Deref, DerefMut}; use std::{