From 73200b9d465523693b6f952ee771a83bbbb7df7d Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Wed, 20 Jul 2022 16:31:22 +0300 Subject: [PATCH] Remove cranelift dependency from wasmer-wasi --- Cargo.toml | 1 + lib/api/Cargo.toml | 2 +- lib/api/src/sys/mod.rs | 2 +- lib/api/src/sys/store.rs | 6 +++++- lib/wasi/Cargo.toml | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9ef617abf14..52cddda5730 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -64,6 +64,7 @@ glob = "0.3" rustc_version = "0.4" [dev-dependencies] +wasmer = { version = "=2.3.0", path = "lib/api", default-features = false, features = ["default-cranelift"] } anyhow = "1.0" criterion = "0.3" lazy_static = "1.4" diff --git a/lib/api/Cargo.toml b/lib/api/Cargo.toml index db2916ebe03..687d8690e49 100644 --- a/lib/api/Cargo.toml +++ b/lib/api/Cargo.toml @@ -89,7 +89,7 @@ core = ["hashbrown"] # Features for `sys`. sys = [] -sys-default = ["sys", "wat", "default-cranelift", "default-universal"] +sys-default = ["sys", "wat", "default-universal"] # - Compilers. compiler = [ "sys", diff --git a/lib/api/src/sys/mod.rs b/lib/api/src/sys/mod.rs index 9eca8454d15..f9a27e6158f 100644 --- a/lib/api/src/sys/mod.rs +++ b/lib/api/src/sys/mod.rs @@ -95,7 +95,7 @@ pub use wasmer_compiler_cranelift::{Cranelift, CraneliftOptLevel}; #[cfg(feature = "llvm")] pub use wasmer_compiler_llvm::{LLVMOptLevel, LLVM}; -#[cfg(feature = "universal")] +#[cfg(all(feature = "universal", feature = "compiler"))] pub use wasmer_compiler::{Universal, UniversalArtifact, UniversalEngine}; /// Version number of this crate. diff --git a/lib/api/src/sys/store.rs b/lib/api/src/sys/store.rs index bf0fce4b5d6..1e5f78079d7 100644 --- a/lib/api/src/sys/store.rs +++ b/lib/api/src/sys/store.rs @@ -1,8 +1,11 @@ use crate::sys::tunables::BaseTunables; use std::fmt; use std::sync::Arc; +#[cfg(feature = "compiler")] use wasmer_compiler::CompilerConfig; -use wasmer_compiler::{Engine, Tunables, Universal}; +#[cfg(feature = "compiler")] +use wasmer_compiler::Universal; +use wasmer_compiler::{Engine, Tunables}; use wasmer_vm::{init_traps, TrapHandlerFn}; use wasmer_vm::StoreObjects; @@ -32,6 +35,7 @@ pub struct Store { } impl Store { + #[cfg(feature = "compiler")] /// Creates a new `Store` with a specific [`CompilerConfig`]. pub fn new(compiler_config: Box) -> Self { let engine = Universal::new(compiler_config).engine(); diff --git a/lib/wasi/Cargo.toml b/lib/wasi/Cargo.toml index 2f0d97193fa..e2a12fffe23 100644 --- a/lib/wasi/Cargo.toml +++ b/lib/wasi/Cargo.toml @@ -49,7 +49,7 @@ tracing-wasm = "0.2" default = ["sys-default"] sys = ["wasmer/sys"] -sys-default = ["wasmer/sys-default", "sys", "logging", "host-fs", "sys-poll", "host-vnet" ] +sys-default = ["wasmer/wat", "wasmer/default-universal", "sys", "logging", "host-fs", "sys-poll", "host-vnet" ] sys-poll = [] js = ["wasmer/js", "mem-fs", "wasmer-vfs/no-time", "getrandom/js", "chrono"]