From 6c0c9a46f37626a6405d15778411e7b48151c8e6 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 26 Mar 2020 20:31:12 -0700 Subject: [PATCH] Fixes for cargo publish (#1416) * Publishing fixes. * Make WASI a symlink. * More fixes. * Cargo doesn't allow dev-dependencies to have optional features. * Remove the symlink. * Add WASI as another git submodule. --- .github/workflows/main.yml | 4 ++-- .gitmodules | 3 +++ Cargo.toml | 4 ---- crates/wasi-common/Cargo.toml | 1 + crates/wasi-common/README.md | 4 ++-- crates/wasi-common/WASI | 1 + crates/wasi-common/src/wasi.rs | 2 +- docs/contributing-testing.md | 4 ++-- scripts/publish-cranelift.sh | 2 +- scripts/publish-wasmtime.sh | 10 +++++++--- 10 files changed, 20 insertions(+), 15 deletions(-) create mode 160000 crates/wasi-common/WASI diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d4e278e96a..69178353e8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -202,7 +202,7 @@ jobs: - run: cargo run -p run-examples # Build and test all features except for lightbeam - - run: cargo test --features test_programs --all --exclude lightbeam --exclude wasmtime-c-api -- --nocapture + - run: cargo test --features test-programs/test_programs --all --exclude lightbeam --exclude wasmtime-c-api -- --nocapture env: RUST_BACKTRACE: 1 RUSTFLAGS: "-D warnings" @@ -381,7 +381,7 @@ jobs: - run: $CENTOS cargo build --release --manifest-path crates/c-api/Cargo.toml shell: bash # Test what we just built - - run: $CENTOS cargo test --features test_programs --release --all --exclude lightbeam --exclude wasmtime --exclude wasmtime-c-api --exclude wasmtime-fuzzing + - run: $CENTOS cargo test --features test-programs/test_programs --release --all --exclude lightbeam --exclude wasmtime --exclude wasmtime-c-api --exclude wasmtime-fuzzing shell: bash env: RUST_BACKTRACE: 1 diff --git a/.gitmodules b/.gitmodules index 6adfc85afe..5d926a9f86 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "crates/wasi-common/WASI"] path = crates/wasi-common/wig/WASI url = https://github.com/WebAssembly/WASI +[submodule "WASI"] + path = crates/wasi-common/WASI + url = https://github.com/WebAssembly/WASI diff --git a/Cargo.toml b/Cargo.toml index aaf34590c9..e9266c922b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,9 +43,6 @@ rayon = "1.2.1" [dev-dependencies] wasmtime-runtime = { path = "crates/runtime", version = "0.13.0" } more-asserts = "0.2.1" -# This feature requires the wasm32-wasi target be installed. It enables -# wasm32-wasi integration tests. To enable, run -# `cargo test --features test-programs`. test-programs = { path = "crates/test-programs" } tempfile = "3.1.0" filecheck = "0.5.0" @@ -79,7 +76,6 @@ lightbeam = [ "wasmtime/lightbeam", ] jitdump = ["wasmtime/jitdump"] -test_programs = ["test-programs/test_programs"] [badges] maintenance = { status = "actively-developed" } diff --git a/crates/wasi-common/Cargo.toml b/crates/wasi-common/Cargo.toml index 704c92109a..d3e9bcf642 100644 --- a/crates/wasi-common/Cargo.toml +++ b/crates/wasi-common/Cargo.toml @@ -9,6 +9,7 @@ keywords = ["webassembly", "wasm"] repository = "https://github.com/bytecodealliance/wasmtime" readme = "README.md" edition = "2018" +include = ["src/**/*", "LICENSE", "WASI/phases"] [dependencies] anyhow = "1.0" diff --git a/crates/wasi-common/README.md b/crates/wasi-common/README.md index 6ec6caa989..ea31be2323 100644 --- a/crates/wasi-common/README.md +++ b/crates/wasi-common/README.md @@ -60,10 +60,10 @@ rustup target add wasm32-wasi [rustup]: https://rustup.rs Now, you should be able to run the integration testsuite by running `cargo test` on the -`test-programs` package with `test_programs` feature enabled: +`test-programs` package with `test-programs/test_programs` feature enabled: ``` -cargo test --features test_programs --package test-programs +cargo test --features test-programs/test_programs --package test-programs ``` ## Third-Party Code diff --git a/crates/wasi-common/WASI b/crates/wasi-common/WASI new file mode 160000 index 0000000000..068b282abf --- /dev/null +++ b/crates/wasi-common/WASI @@ -0,0 +1 @@ +Subproject commit 068b282abfe3510973fb1917892c1f6665f9b462 diff --git a/crates/wasi-common/src/wasi.rs b/crates/wasi-common/src/wasi.rs index 879388189d..5c634518bc 100644 --- a/crates/wasi-common/src/wasi.rs +++ b/crates/wasi-common/src/wasi.rs @@ -4,7 +4,7 @@ use crate::WasiCtx; wiggle::from_witx!({ - witx: ["wig/WASI/phases/snapshot/witx/wasi_snapshot_preview1.witx"], + witx: ["WASI/phases/snapshot/witx/wasi_snapshot_preview1.witx"], ctx: WasiCtx, }); diff --git a/docs/contributing-testing.md b/docs/contributing-testing.md index 65e45df7f0..188a0d06a3 100644 --- a/docs/contributing-testing.md +++ b/docs/contributing-testing.md @@ -25,7 +25,7 @@ rustup target add wasm32-wasi Next, to run all tests including the WASI integration tests, execute this command: ```shell -cargo test --features test_programs --all +cargo test --features test-programs/test_programs --all ``` You can also exclude a particular crate from testing with `--exclude`. For @@ -78,7 +78,7 @@ can be useful when working on the `wasi-common` crate. This can be done by executing this command: ```shell -cargo test --features test_programs -p test-programs +cargo test --features test-programs/test_programs -p test-programs ``` ## Adding New Tests diff --git a/scripts/publish-cranelift.sh b/scripts/publish-cranelift.sh index 10fe6ce72d..78a639dea2 100755 --- a/scripts/publish-cranelift.sh +++ b/scripts/publish-cranelift.sh @@ -36,7 +36,7 @@ do # Sleep for a few seconds to allow the server to update the index. # https://internals.rust-lang.org/t/changes-to-how-crates-io-handles-index-updates/9608 - echo sleep 10 + echo sleep 20 done echo git tag cranelift-v$(grep version cranelift/Cargo.toml | head -n 1 | cut -d '"' -f 2) diff --git a/scripts/publish-wasmtime.sh b/scripts/publish-wasmtime.sh index d9e7c4626c..6b9de573a8 100755 --- a/scripts/publish-wasmtime.sh +++ b/scripts/publish-wasmtime.sh @@ -11,7 +11,7 @@ topdir=$(dirname "$0")/.. cd "$topdir" # Publishing Wasmtime requires publishing any local Cranelift changes. -./publish-cranelift.sh +scripts/publish-cranelift.sh # Commands needed to publish. # @@ -21,12 +21,16 @@ for cargo_toml in \ crates/wasi-common/winx/Cargo.toml \ crates/wasi-common/yanix/Cargo.toml \ crates/wasi-common/wig/Cargo.toml \ + crates/wiggle/crates/runtime/Cargo.toml \ + crates/wiggle/crates/generate/Cargo.toml \ + crates/wiggle/crates/test/Cargo.toml \ + crates/wiggle/Cargo.toml \ crates/wasi-common/Cargo.toml \ crates/lightbeam/Cargo.toml \ - crates/profiling/Cargo.toml \ crates/environ/Cargo.toml \ crates/obj/Cargo.toml \ crates/runtime/Cargo.toml \ + crates/profiling/Cargo.toml \ crates/debug/Cargo.toml \ crates/jit/Cargo.toml \ crates/api/Cargo.toml \ @@ -47,7 +51,7 @@ for cargo_toml in \ # Sleep for a few seconds to allow the server to update the index. # https://internals.rust-lang.org/t/changes-to-how-crates-io-handles-index-updates/9608 - echo sleep 10 + echo sleep 20 done echo echo git tag v$(grep "version =" Cargo.toml | head -n 1 | cut -d '"' -f 2)