Skip to content

Commit c4fb486

Browse files
authored
Update WIT vendoring source and wit-bindgen (#137)
* Update WIT vendoring source and wit-bindgen This commit updates how WITs are vendored here to use `wkg` the same way that bytecodealliance/wasmtime#12327 does. This then updated to use the latest `wit-bindgen` to be able to process the WITs which had a few extra artifacts in them that made it necessary. Generated bindings are changing here, but it's just things moving around. * Update wit-bindgen * Update other CI tools * Update MSRV to 1.87.0 * Update/pin more tools
1 parent 79b1ddf commit c4fb486

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+5352
-5663
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ jobs:
2323
- name: Install Wasmtime
2424
uses: bytecodealliance/actions/wasmtime/setup@v1
2525
with:
26-
version: "v30.0.2"
26+
version: "v40.0.2"
2727
- name: Install wasm-tools
2828
uses: bytecodealliance/actions/wasm-tools/setup@v1
2929
with:
30-
version: "1.224.0"
30+
version: "1.244.0"
3131

3232
- run: cargo build -p wasip2 --examples --target wasm32-wasip2 --no-default-features
3333
- run: wasmtime run ./target/wasm32-wasip2/debug/examples/hello-world-no_std.wasm
@@ -83,14 +83,18 @@ jobs:
8383
steps:
8484
- uses: actions/checkout@v5
8585
- uses: ./.github/actions/install-rust
86+
- name: Install wkg
87+
run: |
88+
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
89+
cargo binstall --no-confirm wkg
8690
# Re-vendor all WIT files and ensure that they're all up-to-date by ensuring
8791
# that there's no git changes.
8892
- name: Re-vendor WIT
8993
run: |
9094
./ci/vendor-wit.sh
9195
git diff --exit-code
9296
- run: |
93-
version=0.48.0
97+
version=0.51.0
9498
9599
mkdir wit-bindgen
96100
cd wit-bindgen
@@ -119,7 +123,7 @@ jobs:
119123
toolchain: ${{ matrix.rust }}
120124
- run: rustup target add wasm32-wasip2 wasm32-unknown-unknown
121125
- run: |
122-
version=v0.5.19
126+
version=v0.5.20
123127
124128
mkdir ld
125129
cd ld
@@ -130,11 +134,11 @@ jobs:
130134
- name: Install wasmtime
131135
uses: bytecodealliance/actions/wasmtime/setup@v1
132136
with:
133-
version: "dev"
137+
version: "40.0.2"
134138
- name: Install wasm-tools
135139
uses: bytecodealliance/actions/wasm-tools/setup@v1
136140
with:
137-
version: "1.241.2"
141+
version: "1.244.0"
138142

139143
- run: cargo build -p wasip3 --examples --target wasm32-wasip2
140144
- run: wasmtime run -Sp3 -Wcomponent-model-async ./target/wasm32-wasip2/debug/examples/cli_command.wasm

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ exclude = ["/.github", "/ci/", "/examples/"]
1616
edition = "2021"
1717
license = "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT"
1818
repository = "https://github.com/bytecodealliance/wasi-rs"
19-
rust-version = "1.82.0"
19+
rust-version = "1.87.0"
2020

2121
[workspace.dependencies]
2222
rand = { version = "0.8.5", default-features = false }
2323
wasi = { version = "0.14.6", path = ".", default-features = false }
24-
wit-bindgen = { version = "0.48.1", default-features = false }
24+
wit-bindgen = { version = "0.51.0", default-features = false }
2525
wasip1 = { version = "1.0.0", path = "crates/wasip1", default-features = false }
2626
wasip2 = { version = "1.0.1", path = "crates/wasip2", default-features = false }
2727
wasip3 = { version = "0.1.1", path = "crates/wasip3", default-features = false }

ci/vendor-wit.sh

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,29 @@
66
# This script is executed on CI to ensure that everything is up-to-date.
77
set -ex
88

9-
# Space-separated list of wasi proposals that are vendored here along with the
10-
# tag that they're all vendored at.
11-
#
12-
# This assumes that the repositories all have the pattern:
13-
# https://github.com/WebAssembly/wasi-$repo
14-
# and every repository has a tag `v$tag` here. That is currently done as part
15-
# of the WASI release process.
16-
tag=0.2.4
17-
dst=wit/deps
189

19-
vendor() {
20-
dst="$1"
21-
tag="$2"
22-
subdir="$3"
23-
repos="$4"
10+
rm -rf crates/wasip2/wit/deps
11+
mkdir -p crates/wasip2/wit/deps
2412

25-
rm -rf $dst
26-
mkdir -p $dst
13+
p2=0.2.4
14+
wkg get --overwrite --format wit "wasi:cli@${p2}" -o crates/wasip2/wit/deps/cli.wit
15+
wkg get --overwrite --format wit "wasi:clocks@${p2}" -o crates/wasip2/wit/deps/clocks.wit
16+
wkg get --overwrite --format wit "wasi:filesystem@${p2}" -o crates/wasip2/wit/deps/filesystem.wit
17+
wkg get --overwrite --format wit "wasi:http@${p2}" -o crates/wasip2/wit/deps/http.wit
18+
wkg get --overwrite --format wit "wasi:io@${p2}" -o crates/wasip2/wit/deps/io.wit
19+
wkg get --overwrite --format wit "wasi:random@${p2}" -o crates/wasip2/wit/deps/random.wit
20+
wkg get --overwrite --format wit "wasi:sockets@${p2}" -o crates/wasip2/wit/deps/sockets.wit
2721

28-
for repo in $repos; do
29-
mkdir $dst/$repo
30-
curl -L https://github.com/WebAssembly/wasi-$repo/archive/refs/tags/v$tag.tar.gz | \
31-
tar xzf - --strip-components=2 -C $dst/$repo wasi-$repo-$tag/$subdir
32-
rm -rf $dst/$repo/deps*
33-
done
34-
}
22+
rm -rf crates/wasip3/wit/deps
23+
mkdir -p crates/wasip3/wit/deps
3524

36-
vendor crates/wasip2/wit/deps 0.2.4 wit "cli clocks filesystem http io random sockets"
37-
vendor crates/wasip3/wit/deps 0.3.0-rc-2025-09-16 wit-0.3.0-draft "cli clocks filesystem http random sockets"
25+
p3=0.3.0-rc-2025-09-16
26+
wkg get --overwrite --format wit "wasi:cli@${p3}" -o crates/wasip3/wit/deps/cli.wit
27+
wkg get --overwrite --format wit "wasi:clocks@${p3}" -o crates/wasip3/wit/deps/clocks.wit
28+
wkg get --overwrite --format wit "wasi:filesystem@${p3}" -o crates/wasip3/wit/deps/filesystem.wit
29+
wkg get --overwrite --format wit "wasi:http@${p3}" -o crates/wasip3/wit/deps/http.wit
30+
wkg get --overwrite --format wit "wasi:random@${p3}" -o crates/wasip3/wit/deps/random.wit
31+
wkg get --overwrite --format wit "wasi:sockets@${p3}" -o crates/wasip3/wit/deps/sockets.wit
3832

3933
# WASIp1 vendoring logic
4034
wasip1_rev="0ba0c5e2"

crates/wasip2/src/command.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Generated by `wit-bindgen` 0.48.0. DO NOT EDIT!
1+
// Generated by `wit-bindgen` 0.51.0. DO NOT EDIT!
22
// Options used:
33
// * std_feature
44
// * with "wasi:cli/environment@0.2.4" = "crate::cli::environment"
@@ -133,7 +133,7 @@ pub mod exports {
133133
}
134134
#[rustfmt::skip]
135135
mod _rt {
136-
#![allow(dead_code, clippy::all)]
136+
#![allow(dead_code, unused_imports, clippy::all)]
137137
#[cfg(target_arch = "wasm32")]
138138
pub fn run_ctors_once() {
139139
wit_bindgen::rt::run_ctors_once();
@@ -167,7 +167,7 @@ macro_rules! __export_command_impl {
167167
exports::wasi::cli::run::__export_wasi_cli_run_0_2_4_cabi!($ty with_types_in
168168
$($path_to_types_root)*:: exports::wasi::cli::run); const _ : () = {
169169
#[rustfmt::skip] #[cfg(target_arch = "wasm32")] #[unsafe (link_section =
170-
"component-type:wit-bindgen:0.48.0:wasi:cli@0.2.4:command:imports and exportsrust-wasip2-1.0.1+wasi-0.2.4-from-crates-io-command-world")]
170+
"component-type:wit-bindgen:0.51.0:wasi:cli@0.2.4:command:imports and exportsrust-wasip2-1.0.1+wasi-0.2.4-from-crates-io-command-world")]
171171
#[doc(hidden)] #[allow(clippy::octal_escapes)] pub static
172172
__WIT_BINDGEN_COMPONENT_TYPE : [u8; 10773] = *
173173
b"\
@@ -387,8 +387,8 @@ nsecure-random-u64\x01\x02\x03\0\x1awasi:random/insecure@0.2.4\x05*\x01B\x03\x01
387387
o\x02ww\x01@\0\0\0\x04\0\x0dinsecure-seed\x01\x01\x03\0\x1fwasi:random/insecure-\
388388
seed@0.2.4\x05+\x01B\x03\x01j\0\0\x01@\0\0\0\x04\0\x03run\x01\x01\x04\0\x12wasi:\
389389
cli/run@0.2.4\x05,\x04\0\x16wasi:cli/command@0.2.4\x04\0\x0b\x0d\x01\0\x07comman\
390-
d\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.241.2\x10\
391-
wit-bindgen-rust\x060.48.0";
390+
d\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.244.0\x10\
391+
wit-bindgen-rust\x060.51.0";
392392
};
393393
};
394394
}
@@ -397,8 +397,8 @@ pub use __export_command_impl as _export_command;
397397
#[rustfmt::skip]
398398
#[cfg(target_arch = "wasm32")]
399399

400-
#[cfg_attr(feature = "rustc-dep-of-std", unsafe(link_section = "component-type:wit-bindgen:0.48.0:wasi:cli@0.2.4:command-with-all-of-its-exports-removed:encoded worldrust-wasip2-1.0.1+wasi-0.2.4-from-crates-io-command-world-in-libstd"))]
401-
#[cfg_attr(not(feature = "rustc-dep-of-std"), unsafe(link_section = "component-type:wit-bindgen:0.48.0:wasi:cli@0.2.4:command-with-all-of-its-exports-removed:encoded worldrust-wasip2-1.0.1+wasi-0.2.4-from-crates-io-command-world"))]
400+
#[cfg_attr(feature = "rustc-dep-of-std", unsafe(link_section = "component-type:wit-bindgen:0.51.0:wasi:cli@0.2.4:command-with-all-of-its-exports-removed:encoded worldrust-wasip2-1.0.1+wasi-0.2.4-from-crates-io-command-world-in-libstd"))]
401+
#[cfg_attr(not(feature = "rustc-dep-of-std"), unsafe(link_section = "component-type:wit-bindgen:0.51.0:wasi:cli@0.2.4:command-with-all-of-its-exports-removed:encoded worldrust-wasip2-1.0.1+wasi-0.2.4-from-crates-io-command-world"))]
402402

403403
#[doc(hidden)]
404404
#[allow(clippy::octal_escapes)]
@@ -619,7 +619,7 @@ nsecure-random-u64\x01\x02\x03\0\x1awasi:random/insecure@0.2.4\x05*\x01B\x03\x01
619619
o\x02ww\x01@\0\0\0\x04\0\x0dinsecure-seed\x01\x01\x03\0\x1fwasi:random/insecure-\
620620
seed@0.2.4\x05+\x04\06wasi:cli/command-with-all-of-its-exports-removed@0.2.4\x04\
621621
\0\x0b-\x01\0'command-with-all-of-its-exports-removed\x03\0\0\0G\x09producers\x01\
622-
\x0cprocessed-by\x02\x0dwit-component\x070.241.2\x10wit-bindgen-rust\x060.48.0";
622+
\x0cprocessed-by\x02\x0dwit-component\x070.244.0\x10wit-bindgen-rust\x060.51.0";
623623
#[inline(never)]
624624
#[doc(hidden)]
625625
pub fn __link_custom_section_describing_imports() {

0 commit comments

Comments
 (0)