Skip to content

Commit

Permalink
Gate wasmprinter's component support behind a feature (#1848)
Browse files Browse the repository at this point in the history
* Gate wasmprinter's component support behind a feature

Similar to other recent PRs there's now a `component-model` feature for
the `wasmprinter` crate which is enabled-by-default but can be disabled
if component printing is not desired.

* Fix fuzzer build

* Fix feature'd build
  • Loading branch information
alexcrichton authored Oct 7, 2024
1 parent f34cfc8 commit 0710f58
Show file tree
Hide file tree
Showing 11 changed files with 1,398 additions and 1,306 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ jobs:
- run: cargo check --no-default-features -p wasmparser --features component-model,validate
- run: cargo check --no-default-features -p wasmparser --features std,component-model
- run: cargo check --no-default-features -p wasmparser --features std,component-model,validate
- run: cargo check --no-default-features -p wasmprinter
- run: cargo check --no-default-features -p wasmprinter --features component-model
- run: cargo check --no-default-features -p wast
- run: cargo check --no-default-features -p wast --features wasm-module
- run: cargo check --no-default-features -p wast --features wasm-module,component-model
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ wasm-mutate = { version = "0.218.0", path = "crates/wasm-mutate" }
wasm-shrink = { version = "0.218.0", path = "crates/wasm-shrink" }
wasm-smith = { version = "0.218.0", path = "crates/wasm-smith" }
wasmparser = { version = "0.218.0", path = "crates/wasmparser", default-features = false, features = ['std'] }
wasmprinter = { version = "0.218.0", path = "crates/wasmprinter" }
wasmprinter = { version = "0.218.0", path = "crates/wasmprinter", default-features = false }
wast = { version = "218.0.0", path = "crates/wast" }
wat = { version = "1.218.0", path = "crates/wat" }
wit-component = { version = "0.218.0", path = "crates/wit-component" }
Expand All @@ -122,7 +122,7 @@ wat = { workspace = true, features = ['dwarf'] }
termcolor = { workspace = true }

# Dependencies of `validate`
wasmparser = { workspace = true, optional = true }
wasmparser = { workspace = true, optional = true, features = ['component-model'] }
rayon = { workspace = true, optional = true }
bitflags = { workspace = true, optional = true }

Expand Down
2 changes: 1 addition & 1 deletion ci/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ use std::time::Duration;
// note that this list must be topologically sorted by dependencies
const CRATES_TO_PUBLISH: &[&str] = &[
"wasmparser",
"wasm-encoder",
"wasmprinter",
"wasm-encoder",
"wast",
"wat",
"wasm-smith",
Expand Down
2 changes: 1 addition & 1 deletion crates/wasm-encoder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ wasmparser = { optional = true, workspace = true }
anyhow = { workspace = true }
tempfile = "3.2.0"
wasmparser = { path = "../wasmparser" }
wasmprinter = { path = "../wasmprinter" }
wasmprinter = { workspace = true }

[features]
default = ['component-model']
Expand Down
4 changes: 2 additions & 2 deletions crates/wasm-mutate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ egg = "0.6.0"

[dev-dependencies]
anyhow = { workspace = true }
wat = { path = "../wat" }
wasmprinter = { path = "../wasmprinter" }
wat = { workspace = true }
wasmprinter = { workspace = true }
env_logger = { workspace = true }
wasmparser = { workspace = true, features = ['validate', 'features'] }
4 changes: 2 additions & 2 deletions crates/wasm-shrink/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ wasmparser = { workspace = true, features = ['validate', 'features'] }

[dev-dependencies]
env_logger = { workspace = true }
wasmprinter = { path = "../wasmprinter" }
wat = { path = "../wat" }
wasmprinter = { workspace = true }
wat = { workspace = true }
4 changes: 2 additions & 2 deletions crates/wasm-smith/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ wat = { workspace = true, optional = true }
criterion = { workspace = true }
rand = { workspace = true }
wasmparser = { workspace = true, features = ["validate", "features"] }
wasmprinter = { path = "../wasmprinter" }
wat = { path = "../wat" }
wasmprinter = { workspace = true }
wat = { workspace = true }

[target.'cfg(not(target_family = "wasm"))'.dev-dependencies]
libfuzzer-sys = { workspace = true }
Expand Down
6 changes: 5 additions & 1 deletion crates/wasmprinter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ workspace = true

[dependencies]
anyhow = { workspace = true }
wasmparser = { workspace = true, features = ['std', 'component-model'] }
wasmparser = { workspace = true, features = ['std'] }
termcolor = { workspace = true }

[dev-dependencies]
wat = { path = "../wat" }

[features]
default = ['component-model']
component-model = ['wasmparser/component-model']
Loading

0 comments on commit 0710f58

Please sign in to comment.