Skip to content

Commit e5817d9

Browse files
authored
Make wasmtime dependency in wiggle and wasi-common optional with a default feature (#7792)
* Make wasmtime dependency in wiggle and wasi-common optional with a default feature * Use wiggle/wasmtime feature in wasmtime-wasi
1 parent 2c86e26 commit e5817d9

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ component-fuzz-util = { path = "crates/misc/component-fuzz-util" }
179179
wiggle = { path = "crates/wiggle", version = "=18.0.0", default-features = false }
180180
wiggle-macro = { path = "crates/wiggle/macro", version = "=18.0.0" }
181181
wiggle-generate = { path = "crates/wiggle/generate", version = "=18.0.0" }
182-
wasi-common = { path = "crates/wasi-common", version = "=18.0.0" }
182+
wasi-common = { path = "crates/wasi-common", version = "=18.0.0", default-features = false }
183183
wasi-tokio = { path = "crates/wasi-common/tokio", version = "=18.0.0" }
184184
wasi-cap-std-sync = { path = "crates/wasi-common/cap-std-sync", version = "=18.0.0" }
185185
wasmtime-fuzzing = { path = "crates/fuzzing" }

crates/wasi-common/Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ workspace = true
2424
anyhow = { workspace = true }
2525
thiserror = { workspace = true }
2626
wiggle = { workspace = true }
27-
wasmtime = { workspace = true }
27+
wasmtime = { workspace = true, optional = true }
2828
tracing = { workspace = true }
2929
cap-std = { workspace = true }
3030
cap-rand = { workspace = true }
@@ -54,11 +54,13 @@ test-programs-artifacts = { workspace = true }
5454
tokio = { workspace = true, features = ['macros', 'rt-multi-thread'] }
5555

5656
[features]
57-
default = ["trace_log"]
57+
default = ["trace_log", "wasmtime"]
5858
# This feature enables the `tracing` logs in the calls to target the `log`
5959
# ecosystem of backends (e.g. `env_logger`. Disable this if you want to use
6060
# `tracing-subscriber`.
6161
trace_log = [ "wiggle/tracing_log", "tracing/log" ]
6262
# Need to make the wiggle_metadata feature available to consumers of this
6363
# crate if they want the snapshots to have metadata available.
6464
wiggle_metadata = ["wiggle/wiggle_metadata"]
65+
# This feature enables integration with wasmtime.
66+
wasmtime = ["dep:wasmtime", "wiggle/wasmtime"]

crates/wasi/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ anyhow = { workspace = true }
2020
wasi-common = { workspace = true }
2121
wasi-cap-std-sync = { workspace = true, optional = true }
2222
wasi-tokio = { workspace = true, optional = true }
23-
wiggle = { workspace = true, optional = true }
23+
wiggle = { workspace = true, optional = true, features = ["wasmtime"] }
2424
libc = { workspace = true }
2525
once_cell = { workspace = true }
2626
log = { workspace = true }

crates/wiggle/Cargo.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ wiggle-macro = { workspace = true }
2020
tracing = { workspace = true }
2121
bitflags = { workspace = true }
2222
async-trait = { workspace = true }
23-
wasmtime = { workspace = true }
23+
wasmtime = { workspace = true, optional = true }
2424
anyhow = { workspace = true }
2525

2626
[dev-dependencies]
2727
wiggle-test = { path = "test-helpers" }
2828
proptest = "1.0.0"
2929
tokio = { version = "1", features = ["rt-multi-thread","time", "macros"] }
30+
wasmtime = { workspace = true }
3031

3132
[[test]]
3233
name = "atoms_async"
@@ -62,7 +63,10 @@ wiggle_metadata = ['witx', "wiggle-macro/wiggle_metadata"]
6263
# the logs out of wiggle-generated libraries.
6364
tracing_log = [ "tracing/log" ]
6465

66+
# This feature enables integration with wasmtime.
67+
wasmtime = ["dep:wasmtime"]
68+
6569
# Support for async in the wasmtime crates.
6670
wasmtime_async = [ "wasmtime/async" ]
6771

68-
default = ["wiggle_metadata", "wasmtime_async" ]
72+
default = ["wiggle_metadata", "wasmtime", "wasmtime_async" ]

crates/wiggle/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ pub mod async_trait_crate {
3232
}
3333

3434
pub mod wasmtime;
35+
#[cfg(feature = "wasmtime")]
3536
pub mod wasmtime_crate {
3637
pub use wasmtime::*;
3738
}

0 commit comments

Comments
 (0)