Skip to content

Commit c8c4f20

Browse files
authored
Bump WASI version to 0.2.1 (#95)
* Bump WASI version to 0.2.1 * Bump wasi-rs version to 0.13.2+wasi-0.2.1
1 parent 94e5000 commit c8c4f20

Some content is hidden

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

41 files changed

+4354
-4110
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ jobs:
2121
- name: Install Wasmtime
2222
uses: bytecodealliance/actions/wasmtime/setup@v1
2323
with:
24-
version: "v19.0.0"
24+
version: "v23.0.1"
2525
- name: Install wasm-tools
2626
uses: bytecodealliance/actions/wasm-tools/setup@v1
2727
with:
28-
version: "1.202.0"
29-
- run: curl -LO https://github.com/bytecodealliance/wasmtime/releases/download/v19.0.0/wasi_snapshot_preview1.command.wasm
28+
version: "1.215.0"
29+
- run: curl -LO https://github.com/bytecodealliance/wasmtime/releases/download/v23.0.1/wasi_snapshot_preview1.command.wasm
3030

3131
- run: cargo build --examples --target wasm32-wasip1 --no-default-features
3232

@@ -59,22 +59,19 @@ jobs:
5959
- run: wasm-tools component new ./target/wasm32-wasip1/debug/examples/rand.wasm --adapt ./wasi_snapshot_preview1.command.wasm -o component.wasm
6060
- run: wasmtime run component.wasm
6161

62-
rustfmt:
63-
name: Rustfmt
64-
runs-on: ubuntu-latest
65-
steps:
66-
- uses: actions/checkout@v4
67-
- name: Install Rust
68-
run: rustup update stable && rustup default stable && rustup component add rustfmt
69-
- run: cargo fmt -- --check
70-
7162
generate:
7263
name: Ensure generated code up-to-date
7364
runs-on: ubuntu-latest
7465
steps:
7566
- uses: actions/checkout@v4
7667
- name: Install Rust
7768
run: rustup update stable && rustup default stable
78-
- run: cargo install [email protected] --locked
69+
# Re-vendor all WIT files and ensure that they're all up-to-date by ensuring
70+
# that there's no git changes.
71+
- name: Re-vendor WIT
72+
run: |
73+
./ci/vendor-wit.sh
74+
git diff --exit-code
75+
- run: cargo install [email protected] --locked
7976
- run: ./ci/regenerate.sh
8077
- run: git diff --exit-code

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "wasi"
3-
version = "0.13.1+wasi-0.2.0"
3+
version = "0.13.2+wasi-0.2.1"
44
authors = ["The Cranelift Project Developers"]
55
description = "WASI API bindings for Rust"
66
categories = ["no-std", "wasm"]
@@ -24,7 +24,7 @@ wasi = { version = "0.13", path = ".", default-features = false }
2424
members = ["./crates/*"]
2525

2626
[dependencies]
27-
wit-bindgen-rt = { version = "0.24.0", features = ["bitflags"] }
27+
wit-bindgen-rt = { version = "0.29.0", features = ["bitflags"] }
2828

2929
# When built as part of libstd
3030
compiler_builtins = { version = "0.1", optional = true }

ci/regenerate.sh

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,45 +5,46 @@ set -ex
55
generate() {
66
file="$1"
77
shift
8-
wit-bindgen rust wit --out-dir src --std-feature "$@" --rustfmt \
8+
wit-bindgen rust wit --out-dir src --std-feature "$@" --format \
99
--runtime-path wit_bindgen_rt
1010
}
1111

1212
# Generate the main body of the bindings which includes all imports from the two
1313
# worlds below.
14-
generate src/bindings.rs --type-section-suffix rust-wasi-from-crates-io
14+
generate src/bindings.rs --type-section-suffix rust-wasi-from-crates-io \
15+
--generate-all
1516

1617
# Generate bindings for the `wasi:cli/command` world specifically, namely the
1718
# macro `export_command`.
1819
#
1920
# Note that `--with` is used to point at the previously generated bindings.
20-
with="wasi:cli/[email protected].0=crate::cli::environment"
21-
with="$with,wasi:cli/[email protected].0=crate::cli::exit"
22-
with="$with,wasi:cli/[email protected].0=crate::cli::stdin"
23-
with="$with,wasi:cli/[email protected].0=crate::cli::stdout"
24-
with="$with,wasi:cli/[email protected].0=crate::cli::stderr"
25-
with="$with,wasi:cli/[email protected].0=crate::cli::terminal_input"
26-
with="$with,wasi:cli/[email protected].0=crate::cli::terminal_output"
27-
with="$with,wasi:cli/[email protected].0=crate::cli::terminal_stdin"
28-
with="$with,wasi:cli/[email protected].0=crate::cli::terminal_stdout"
29-
with="$with,wasi:cli/[email protected].0=crate::cli::terminal_stderr"
30-
with="$with,wasi:clocks/[email protected].0=crate::clocks::monotonic_clock"
31-
with="$with,wasi:clocks/[email protected].0=crate::clocks::wall_clock"
32-
with="$with,wasi:filesystem/[email protected].0=crate::filesystem::types"
33-
with="$with,wasi:filesystem/[email protected].0=crate::filesystem::preopens"
34-
with="$with,wasi:io/[email protected].0=crate::io::error"
35-
with="$with,wasi:io/[email protected].0=crate::io::poll"
36-
with="$with,wasi:io/[email protected].0=crate::io::streams"
37-
with="$with,wasi:random/[email protected].0=crate::random::random"
38-
with="$with,wasi:random/[email protected].0=crate::random::insecure"
39-
with="$with,wasi:random/[email protected].0=crate::random::insecure_seed"
40-
with="$with,wasi:sockets/[email protected].0=crate::sockets::network"
41-
with="$with,wasi:sockets/[email protected].0=crate::sockets::instance_network"
42-
with="$with,wasi:sockets/[email protected].0=crate::sockets::tcp"
43-
with="$with,wasi:sockets/[email protected].0=crate::sockets::tcp_create_socket"
44-
with="$with,wasi:sockets/[email protected].0=crate::sockets::udp"
45-
with="$with,wasi:sockets/[email protected].0=crate::sockets::udp_create_socket"
46-
with="$with,wasi:sockets/[email protected].0=crate::sockets::ip_name_lookup"
21+
with="wasi:cli/[email protected].1=crate::cli::environment"
22+
with="$with,wasi:cli/[email protected].1=crate::cli::exit"
23+
with="$with,wasi:cli/[email protected].1=crate::cli::stdin"
24+
with="$with,wasi:cli/[email protected].1=crate::cli::stdout"
25+
with="$with,wasi:cli/[email protected].1=crate::cli::stderr"
26+
with="$with,wasi:cli/[email protected].1=crate::cli::terminal_input"
27+
with="$with,wasi:cli/[email protected].1=crate::cli::terminal_output"
28+
with="$with,wasi:cli/[email protected].1=crate::cli::terminal_stdin"
29+
with="$with,wasi:cli/[email protected].1=crate::cli::terminal_stdout"
30+
with="$with,wasi:cli/[email protected].1=crate::cli::terminal_stderr"
31+
with="$with,wasi:clocks/[email protected].1=crate::clocks::monotonic_clock"
32+
with="$with,wasi:clocks/[email protected].1=crate::clocks::wall_clock"
33+
with="$with,wasi:filesystem/[email protected].1=crate::filesystem::types"
34+
with="$with,wasi:filesystem/[email protected].1=crate::filesystem::preopens"
35+
with="$with,wasi:io/[email protected].1=crate::io::error"
36+
with="$with,wasi:io/[email protected].1=crate::io::poll"
37+
with="$with,wasi:io/[email protected].1=crate::io::streams"
38+
with="$with,wasi:random/[email protected].1=crate::random::random"
39+
with="$with,wasi:random/[email protected].1=crate::random::insecure"
40+
with="$with,wasi:random/[email protected].1=crate::random::insecure_seed"
41+
with="$with,wasi:sockets/[email protected].1=crate::sockets::network"
42+
with="$with,wasi:sockets/[email protected].1=crate::sockets::instance_network"
43+
with="$with,wasi:sockets/[email protected].1=crate::sockets::tcp"
44+
with="$with,wasi:sockets/[email protected].1=crate::sockets::tcp_create_socket"
45+
with="$with,wasi:sockets/[email protected].1=crate::sockets::udp"
46+
with="$with,wasi:sockets/[email protected].1=crate::sockets::udp_create_socket"
47+
with="$with,wasi:sockets/[email protected].1=crate::sockets::ip_name_lookup"
4748
generate src/command.rs \
4849
--world wasi:cli/command \
4950
--with "$with" \
@@ -53,17 +54,17 @@ generate src/command.rs \
5354
--export-macro-name _export_command
5455

5556
# Same as the `command` world, but for the proxy world.
56-
with="wasi:cli/[email protected].0=crate::cli::stdin"
57-
with="$with,wasi:cli/[email protected].0=crate::cli::stdout"
58-
with="$with,wasi:cli/[email protected].0=crate::cli::stderr"
59-
with="$with,wasi:clocks/[email protected].0=crate::clocks::monotonic_clock"
60-
with="$with,wasi:clocks/[email protected].0=crate::clocks::wall_clock"
61-
with="$with,wasi:io/[email protected].0=crate::io::error"
62-
with="$with,wasi:io/[email protected].0=crate::io::poll"
63-
with="$with,wasi:io/[email protected].0=crate::io::streams"
64-
with="$with,wasi:random/[email protected].0=crate::random::random"
65-
with="$with,wasi:http/[email protected].0=crate::http::types"
66-
with="$with,wasi:http/[email protected].0=crate::http::outgoing_handler"
57+
with="wasi:cli/[email protected].1=crate::cli::stdin"
58+
with="$with,wasi:cli/[email protected].1=crate::cli::stdout"
59+
with="$with,wasi:cli/[email protected].1=crate::cli::stderr"
60+
with="$with,wasi:clocks/[email protected].1=crate::clocks::monotonic_clock"
61+
with="$with,wasi:clocks/[email protected].1=crate::clocks::wall_clock"
62+
with="$with,wasi:io/[email protected].1=crate::io::error"
63+
with="$with,wasi:io/[email protected].1=crate::io::poll"
64+
with="$with,wasi:io/[email protected].1=crate::io::streams"
65+
with="$with,wasi:random/[email protected].1=crate::random::random"
66+
with="$with,wasi:http/[email protected].1=crate::http::types"
67+
with="$with,wasi:http/[email protected].1=crate::http::outgoing_handler"
6768
generate src/proxy.rs \
6869
--world wasi:http/proxy \
6970
--with "$with" \

ci/vendor-wit.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
3+
# Script to re-vendor the WIT files that wasi-rs uses as defined by a
4+
# particular tag in upstream repositories.
5+
#
6+
# This script is executed on CI to ensure that everything is up-to-date.
7+
set -ex
8+
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+
repos="cli clocks filesystem http io random sockets"
17+
tag=0.2.1
18+
dst=wit/deps
19+
20+
rm -rf $dst
21+
mkdir -p $dst
22+
23+
for repo in $repos; do
24+
mkdir $dst/$repo
25+
curl -L https://github.com/WebAssembly/wasi-$repo/archive/refs/tags/v$tag.tar.gz | \
26+
tar xzf - --strip-components=2 -C $dst/$repo wasi-$repo-$tag/wit
27+
rm -rf $dst/$repo/deps*
28+
done

0 commit comments

Comments
 (0)