Skip to content

Commit

Permalink
Leverage Cargo's workspace inheritance feature (bytecodealliance#4905)
Browse files Browse the repository at this point in the history
* Leverage Cargo's workspace inheritance feature

This commit is an attempt to reduce the complexity of the Cargo
manifests in this repository with Cargo's workspace-inheritance feature
becoming stable in Rust 1.64.0. This feature allows specifying fields in
the root workspace `Cargo.toml` which are then reused throughout the
workspace. For example this PR shares definitions such as:

* All of the Wasmtime-family of crates now use `version.workspace =
  true` to have a single location which defines the version number.
* All crates use `edition.workspace = true` to have one default edition
  for the entire workspace.
* Common dependencies are listed in `[workspace.dependencies]` to avoid
  typing the same version number in a lot of different places (e.g. the
  `wasmparser = "0.89.0"` is now in just one spot.

Currently the workspace-inheritance feature doesn't allow having two
different versions to inherit, so all of the Cranelift-family of crates
still manually specify their version. The inter-crate dependencies,
however, are shared amongst the root workspace.

This feature can be seen as a method of "preprocessing" of sorts for
Cargo manifests. This will help us develop Wasmtime but shouldn't have
any actual impact on the published artifacts -- everything's dependency
lists are still the same.

* Fix wasi-crypto tests
  • Loading branch information
alexcrichton authored Sep 26, 2022
1 parent af226d3 commit 7b31100
Show file tree
Hide file tree
Showing 63 changed files with 520 additions and 446 deletions.
15 changes: 6 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
submodules: true
- uses: ./.github/actions/install-rust
with:
toolchain: nightly-2022-04-27
toolchain: nightly-2022-09-07

# Build C API documentation
- run: sudo apt-get update -y && sudo apt-get install -y libclang1-9 libclang-cpp9
Expand Down Expand Up @@ -194,7 +194,7 @@ jobs:
# flags to rustc.
- uses: ./.github/actions/install-rust
with:
toolchain: nightly-2022-04-27
toolchain: nightly-2022-09-07
- run: cargo install cargo-fuzz --vers "^0.11"
# Install the OCaml packages necessary for fuzz targets that use the
# `wasm-spec-interpreter`.
Expand Down Expand Up @@ -345,9 +345,8 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- run: rustup update stable && rustup default stable
- run: rustup target add wasm32-wasi
- name: Install Rust
run: rustup update stable && rustup default stable
- run: ./ci/run-wasi-crypto-example.sh
env:
RUST_BACKTRACE: 1
Expand All @@ -359,9 +358,8 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- uses: ./.github/actions/install-rust
- run: rustup target add wasm32-wasi
- name: Install Rust
run: rustup update stable && rustup default stable
- run: cargo test --benches --release

# Verify that cranelift's code generation is deterministic
Expand All @@ -372,8 +370,7 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- name: Install Rust
run: rustup update stable && rustup default stable
- uses: ./.github/actions/install-rust
- run: cd cranelift/codegen && cargo build --features all-arch
- run: ci/ensure_deterministic_build.sh

Expand Down Expand Up @@ -408,11 +405,11 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- uses: ./.github/actions/install-rust
# On one builder produce the source tarball since there's no need to produce
# it everywhere
- run: ./ci/build-src-tarball.sh
if: matrix.build == 'x86_64-linux'
- uses: ./.github/actions/install-rust
- uses: ./.github/actions/binary-compatible-builds
with:
name: ${{ matrix.build }}
Expand Down
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

127 changes: 98 additions & 29 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[package]
name = "wasmtime-cli"
version = "2.0.0"
authors = ["The Wasmtime Project Developers"]
version.workspace = true
authors.workspace = true
description = "Command-line interface for Wasmtime"
license = "Apache-2.0 WITH LLVM-exception"
documentation = "https://bytecodealliance.github.io/wasmtime/cli.html"
categories = ["wasm"]
keywords = ["webassembly", "wasm"]
repository = "https://github.com/bytecodealliance/wasmtime"
readme = "README.md"
edition = "2021"
edition.workspace = true
default-run = "wasmtime"

[lib]
Expand All @@ -21,54 +21,53 @@ path = "src/bin/wasmtime.rs"
doc = false

[dependencies]
wasmtime = { path = "crates/wasmtime", version = "2.0.0", default-features = false, features = ['cache', 'cranelift'] }
wasmtime-cache = { path = "crates/cache", version = "=2.0.0" }
wasmtime-cli-flags = { path = "crates/cli-flags", version = "=2.0.0" }
wasmtime-cranelift = { path = "crates/cranelift", version = "=2.0.0" }
wasmtime-environ = { path = "crates/environ", version = "=2.0.0" }
wasmtime-wast = { path = "crates/wast", version = "=2.0.0" }
wasmtime-wasi = { path = "crates/wasi", version = "2.0.0" }
wasmtime-wasi-crypto = { path = "crates/wasi-crypto", version = "2.0.0", optional = true }
wasmtime-wasi-nn = { path = "crates/wasi-nn", version = "2.0.0", optional = true }
clap = { version = "3.2.0", features = ["color", "suggestions", "derive"] }
anyhow = "1.0.19"
target-lexicon = { version = "0.12.0", default-features = false }
wasmtime = { workspace = true, features = ['cache', 'cranelift'] }
wasmtime-cache = { workspace = true }
wasmtime-cli-flags = { workspace = true }
wasmtime-cranelift = { workspace = true }
wasmtime-environ = { workspace = true }
wasmtime-wast = { workspace = true }
wasmtime-wasi = { workspace = true }
wasmtime-wasi-crypto = { workspace = true, optional = true }
wasmtime-wasi-nn = { workspace = true, optional = true }
clap = { workspace = true, features = ["color", "suggestions", "derive"] }
anyhow = { workspace = true }
target-lexicon = { workspace = true }
libc = "0.2.60"
humantime = "2.0.0"
once_cell = "1.12"
once_cell = { workspace = true }
listenfd = "1.0.0"

[target.'cfg(unix)'.dependencies]
rustix = { version = "0.35.10", features = ["mm", "param"] }
rustix = { workspace = true, features = ["mm", "param"] }

[dev-dependencies]
# depend again on wasmtime to activate its default features for tests
wasmtime = { path = "crates/wasmtime", version = "2.0.0", features = ['component-model'] }
env_logger = "0.9.0"
log = "0.4.8"
wasmtime = { workspace = true, features = ['component-model', 'async', 'default'] }
env_logger = { workspace = true }
log = { workspace = true }
filecheck = "0.5.0"
tempfile = "3.1.0"
test-programs = { path = "crates/test-programs" }
wasmtime-runtime = { path = "crates/runtime" }
wasmtime-runtime = { workspace = true }
tokio = { version = "1.8.0", features = ["rt", "time", "macros", "rt-multi-thread"] }
wast = "46.0.0"
wast = { workspace = true }
criterion = "0.3.4"
num_cpus = "1.13.0"
memchr = "2.4"
async-trait = "0.1"
wat = "1.0.48"
once_cell = "1.9.0"
wat = { workspace = true }
rayon = "1.5.0"
wasmtime-wast = { workspace = true, features = ['component-model'] }
wasmtime-component-util = { workspace = true }
component-macro-test = { path = "crates/misc/component-macro-test" }
wasmtime-wast = { path = "crates/wast", version = "=2.0.0", features = ['component-model'] }
component-test-util = { path = "crates/misc/component-test-util" }
wasmtime-component-util = { path = "crates/component-util" }
component-test-util = { workspace = true }

[target.'cfg(windows)'.dev-dependencies]
windows-sys = { version = "0.36.0", features = ["Win32_System_Memory"] }
windows-sys = { workspace = true, features = ["Win32_System_Memory"] }

[build-dependencies]
anyhow = "1.0.19"
anyhow = { workspace = true }

[profile.release.build-override]
opt-level = 0
Expand All @@ -95,6 +94,76 @@ exclude = [
'docs/rust_wasi_markdown_parser'
]

[workspace.package]
version = "2.0.0"
authors = ["The Wasmtime Project Developers"]
edition = "2021"

[workspace.dependencies]
wasmtime = { path = "crates/wasmtime", version = "2.0.0", default-features = false }
wasmtime-cache = { path = "crates/cache", version = "=2.0.0" }
wasmtime-cli-flags = { path = "crates/cli-flags", version = "=2.0.0" }
wasmtime-cranelift = { path = "crates/cranelift", version = "=2.0.0" }
wasmtime-environ = { path = "crates/environ", version = "=2.0.0" }
wasmtime-fiber = { path = "crates/fiber", version = "=2.0.0" }
wasmtime-types = { path = "crates/types", version = "2.0.0" }
wasmtime-jit = { path = "crates/jit", version = "=2.0.0" }
wasmtime-jit-debug = { path = "crates/jit-debug", version = "=2.0.0" }
wasmtime-runtime = { path = "crates/runtime", version = "=2.0.0" }
wasmtime-wast = { path = "crates/wast", version = "=2.0.0" }
wasmtime-wasi = { path = "crates/wasi", version = "2.0.0" }
wasmtime-wasi-crypto = { path = "crates/wasi-crypto", version = "2.0.0" }
wasmtime-wasi-nn = { path = "crates/wasi-nn", version = "2.0.0" }
wasmtime-component-util = { path = "crates/component-util", version = "=2.0.0" }
wasmtime-component-macro = { path = "crates/component-macro", version = "=2.0.0" }
wasmtime-asm-macros = { path = "crates/asm-macros", version = "=2.0.0" }
component-test-util = { path = "crates/misc/component-test-util" }
component-fuzz-util = { path = "crates/misc/component-fuzz-util" }
wiggle = { path = "crates/wiggle", version = "=2.0.0", default-features = false }
wiggle-macro = { path = "crates/wiggle/macro", version = "=2.0.0" }
wiggle-generate = { path = "crates/wiggle/generate", version = "=2.0.0" }
wasi-common = { path = "crates/wasi-common", version = "=2.0.0" }
wasi-tokio = { path = "crates/wasi-common/tokio", version = "=2.0.0" }
wasi-cap-std-sync = { path = "crates/wasi-common/cap-std-sync", version = "=2.0.0" }
wasmtime-fuzzing = { path = "crates/fuzzing" }

cranelift-wasm = { path = "cranelift/wasm", version = "0.89.0" }
cranelift-codegen = { path = "cranelift/codegen", version = "0.89.0" }
cranelift-frontend = { path = "cranelift/frontend", version = "0.89.0" }
cranelift-entity = { path = "cranelift/entity", version = "0.89.0" }
cranelift-native = { path = "cranelift/native", version = "0.89.0" }
cranelift-module = { path = "cranelift/module", version = "0.89.0" }
cranelift-interpreter = { path = "cranelift/interpreter", version = "0.89.0" }
cranelift-reader = { path = "cranelift/reader", version = "0.89.0" }
cranelift-filetests = { path = "cranelift/filetests" }
cranelift-object = { path = "cranelift/object", version = "0.89.0" }
cranelift-jit = { path = "cranelift/jit", version = "0.89.0" }
cranelift-preopt = { path = "cranelift/preopt", version = "0.89.0" }
cranelift-fuzzgen = { path = "cranelift/fuzzgen" }
cranelift-bforest = { path = "cranelift/bforest", version = "0.89.0" }
cranelift = { path = "cranelift/umbrella", version = "0.89.0" }

target-lexicon = { version = "0.12.3", default-features = false }
anyhow = "1.0.22"
wasmparser = "0.89.0"
wat = "1.0.48"
wast = "46.0.0"
wasmprinter = "0.2.39"
wasm-encoder = "0.16.0"
wasm-smith = "0.11.4"
wasm-mutate = "0.2.7"
windows-sys = "0.36.0"
env_logger = "0.9"
rustix = "0.35.10"
log = { version = "0.4.8", default-features = false }
object = { version = "0.29", default-features = false, features = ['read_core', 'elf', 'std'] }
gimli = { version = "0.26.0", default-features = false, features = ['read', 'std'] }
clap = { version = "3.2.0", features = ["color", "suggestions", "derive"] }
hashbrown = "0.12"
cap-std = "0.26.0"
once_cell = "1.12.0"
smallvec = { version = "1.6.1", features = ["union"] }

[features]
default = [
"jitdump",
Expand Down
38 changes: 19 additions & 19 deletions cranelift/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license = "Apache-2.0 WITH LLVM-exception"
documentation = "https://github.com/bytecodealliance/wasmtime/blob/main/cranelift/docs/index.md"
repository = "https://github.com/bytecodealliance/wasmtime"
publish = false
edition = "2021"
edition.workspace = true

[[bin]]
name = "clif-util"
Expand All @@ -20,32 +20,32 @@ harness = false

[dependencies]
cfg-if = "1.0"
cranelift-codegen = { path = "codegen", version = "0.89.0" }
cranelift-entity = { path = "entity", version = "0.89.0" }
cranelift-interpreter = { path = "interpreter", version = "0.89.0" }
cranelift-reader = { path = "reader", version = "0.89.0" }
cranelift-frontend = { path = "frontend", version = "0.89.0" }
cranelift-wasm = { path = "wasm", version = "0.89.0", optional = true }
cranelift-native = { path = "native", version = "0.89.0" }
cranelift-filetests = { path = "filetests", version = "0.73.0" }
cranelift-module = { path = "module", version = "0.89.0" }
cranelift-object = { path = "object", version = "0.89.0" }
cranelift-jit = { path = "jit", version = "0.89.0" }
cranelift-preopt = { path = "preopt", version = "0.89.0" }
cranelift = { path = "umbrella", version = "0.89.0" }
cranelift-codegen = { workspace = true }
cranelift-entity = { workspace = true }
cranelift-interpreter = { workspace = true }
cranelift-reader = { workspace = true }
cranelift-frontend = { workspace = true }
cranelift-wasm = { workspace = true, optional = true }
cranelift-native = { workspace = true }
cranelift-filetests = { workspace = true }
cranelift-module = { workspace = true }
cranelift-object = { workspace = true }
cranelift-jit = { workspace = true }
cranelift-preopt = { workspace = true }
cranelift = { workspace = true }
filecheck = "0.5.0"
log = "0.4.8"
log = { workspace = true }
termcolor = "1.1.2"
capstone = { version = "0.9.0", optional = true }
wat = { version = "1.0.47", optional = true }
target-lexicon = { version = "0.12", features = ["std"] }
wat = { workspace = true, optional = true }
target-lexicon = { workspace = true, features = ["std"] }
pretty_env_logger = "0.4.0"
rayon = { version = "1", optional = true }
indicatif = "0.13.0"
thiserror = "1.0.15"
walkdir = "2.2"
anyhow = "1.0.32"
clap = { version = "3.2.0", features = ["derive"] }
anyhow = { workspace = true }
clap = { workspace = true }

[features]
default = ["disas", "wasm", "cranelift-codegen/all-arch", "cranelift-codegen/trace-log", "souper-harvest"]
Expand Down
2 changes: 1 addition & 1 deletion cranelift/bforest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repository = "https://github.com/bytecodealliance/wasmtime"
categories = ["no-std"]
readme = "README.md"
keywords = ["btree", "forest", "set", "map"]
edition = "2021"
edition.workspace = true

[dependencies]
cranelift-entity = { path = "../entity", version = "0.89.0", default-features = false }
Expand Down
Loading

0 comments on commit 7b31100

Please sign in to comment.