Skip to content

Commit

Permalink
Bump WASI version to 0.2.1 (#95)
Browse files Browse the repository at this point in the history
* Bump WASI version to 0.2.1

* Bump wasi-rs version to 0.13.2+wasi-0.2.1
  • Loading branch information
iawia002 authored Aug 12, 2024
1 parent 94e5000 commit c8c4f20
Show file tree
Hide file tree
Showing 41 changed files with 4,354 additions and 4,110 deletions.
23 changes: 10 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ jobs:
- name: Install Wasmtime
uses: bytecodealliance/actions/wasmtime/setup@v1
with:
version: "v19.0.0"
version: "v23.0.1"
- name: Install wasm-tools
uses: bytecodealliance/actions/wasm-tools/setup@v1
with:
version: "1.202.0"
- run: curl -LO https://github.com/bytecodealliance/wasmtime/releases/download/v19.0.0/wasi_snapshot_preview1.command.wasm
version: "1.215.0"
- run: curl -LO https://github.com/bytecodealliance/wasmtime/releases/download/v23.0.1/wasi_snapshot_preview1.command.wasm

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

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

rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable && rustup default stable && rustup component add rustfmt
- run: cargo fmt -- --check

generate:
name: Ensure generated code up-to-date
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable && rustup default stable
- run: cargo install [email protected] --locked
# Re-vendor all WIT files and ensure that they're all up-to-date by ensuring
# that there's no git changes.
- name: Re-vendor WIT
run: |
./ci/vendor-wit.sh
git diff --exit-code
- run: cargo install [email protected] --locked
- run: ./ci/regenerate.sh
- run: git diff --exit-code
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wasi"
version = "0.13.1+wasi-0.2.0"
version = "0.13.2+wasi-0.2.1"
authors = ["The Cranelift Project Developers"]
description = "WASI API bindings for Rust"
categories = ["no-std", "wasm"]
Expand All @@ -24,7 +24,7 @@ wasi = { version = "0.13", path = ".", default-features = false }
members = ["./crates/*"]

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

# When built as part of libstd
compiler_builtins = { version = "0.1", optional = true }
Expand Down
81 changes: 41 additions & 40 deletions ci/regenerate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,46 @@ set -ex
generate() {
file="$1"
shift
wit-bindgen rust wit --out-dir src --std-feature "$@" --rustfmt \
wit-bindgen rust wit --out-dir src --std-feature "$@" --format \
--runtime-path wit_bindgen_rt
}

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

# Generate bindings for the `wasi:cli/command` world specifically, namely the
# macro `export_command`.
#
# Note that `--with` is used to point at the previously generated bindings.
with="wasi:cli/[email protected].0=crate::cli::environment"
with="$with,wasi:cli/[email protected].0=crate::cli::exit"
with="$with,wasi:cli/[email protected].0=crate::cli::stdin"
with="$with,wasi:cli/[email protected].0=crate::cli::stdout"
with="$with,wasi:cli/[email protected].0=crate::cli::stderr"
with="$with,wasi:cli/[email protected].0=crate::cli::terminal_input"
with="$with,wasi:cli/[email protected].0=crate::cli::terminal_output"
with="$with,wasi:cli/[email protected].0=crate::cli::terminal_stdin"
with="$with,wasi:cli/[email protected].0=crate::cli::terminal_stdout"
with="$with,wasi:cli/[email protected].0=crate::cli::terminal_stderr"
with="$with,wasi:clocks/[email protected].0=crate::clocks::monotonic_clock"
with="$with,wasi:clocks/[email protected].0=crate::clocks::wall_clock"
with="$with,wasi:filesystem/[email protected].0=crate::filesystem::types"
with="$with,wasi:filesystem/[email protected].0=crate::filesystem::preopens"
with="$with,wasi:io/[email protected].0=crate::io::error"
with="$with,wasi:io/[email protected].0=crate::io::poll"
with="$with,wasi:io/[email protected].0=crate::io::streams"
with="$with,wasi:random/[email protected].0=crate::random::random"
with="$with,wasi:random/[email protected].0=crate::random::insecure"
with="$with,wasi:random/[email protected].0=crate::random::insecure_seed"
with="$with,wasi:sockets/[email protected].0=crate::sockets::network"
with="$with,wasi:sockets/[email protected].0=crate::sockets::instance_network"
with="$with,wasi:sockets/[email protected].0=crate::sockets::tcp"
with="$with,wasi:sockets/[email protected].0=crate::sockets::tcp_create_socket"
with="$with,wasi:sockets/[email protected].0=crate::sockets::udp"
with="$with,wasi:sockets/[email protected].0=crate::sockets::udp_create_socket"
with="$with,wasi:sockets/[email protected].0=crate::sockets::ip_name_lookup"
with="wasi:cli/[email protected].1=crate::cli::environment"
with="$with,wasi:cli/[email protected].1=crate::cli::exit"
with="$with,wasi:cli/[email protected].1=crate::cli::stdin"
with="$with,wasi:cli/[email protected].1=crate::cli::stdout"
with="$with,wasi:cli/[email protected].1=crate::cli::stderr"
with="$with,wasi:cli/[email protected].1=crate::cli::terminal_input"
with="$with,wasi:cli/[email protected].1=crate::cli::terminal_output"
with="$with,wasi:cli/[email protected].1=crate::cli::terminal_stdin"
with="$with,wasi:cli/[email protected].1=crate::cli::terminal_stdout"
with="$with,wasi:cli/[email protected].1=crate::cli::terminal_stderr"
with="$with,wasi:clocks/[email protected].1=crate::clocks::monotonic_clock"
with="$with,wasi:clocks/[email protected].1=crate::clocks::wall_clock"
with="$with,wasi:filesystem/[email protected].1=crate::filesystem::types"
with="$with,wasi:filesystem/[email protected].1=crate::filesystem::preopens"
with="$with,wasi:io/[email protected].1=crate::io::error"
with="$with,wasi:io/[email protected].1=crate::io::poll"
with="$with,wasi:io/[email protected].1=crate::io::streams"
with="$with,wasi:random/[email protected].1=crate::random::random"
with="$with,wasi:random/[email protected].1=crate::random::insecure"
with="$with,wasi:random/[email protected].1=crate::random::insecure_seed"
with="$with,wasi:sockets/[email protected].1=crate::sockets::network"
with="$with,wasi:sockets/[email protected].1=crate::sockets::instance_network"
with="$with,wasi:sockets/[email protected].1=crate::sockets::tcp"
with="$with,wasi:sockets/[email protected].1=crate::sockets::tcp_create_socket"
with="$with,wasi:sockets/[email protected].1=crate::sockets::udp"
with="$with,wasi:sockets/[email protected].1=crate::sockets::udp_create_socket"
with="$with,wasi:sockets/[email protected].1=crate::sockets::ip_name_lookup"
generate src/command.rs \
--world wasi:cli/command \
--with "$with" \
Expand All @@ -53,17 +54,17 @@ generate src/command.rs \
--export-macro-name _export_command

# Same as the `command` world, but for the proxy world.
with="wasi:cli/[email protected].0=crate::cli::stdin"
with="$with,wasi:cli/[email protected].0=crate::cli::stdout"
with="$with,wasi:cli/[email protected].0=crate::cli::stderr"
with="$with,wasi:clocks/[email protected].0=crate::clocks::monotonic_clock"
with="$with,wasi:clocks/[email protected].0=crate::clocks::wall_clock"
with="$with,wasi:io/[email protected].0=crate::io::error"
with="$with,wasi:io/[email protected].0=crate::io::poll"
with="$with,wasi:io/[email protected].0=crate::io::streams"
with="$with,wasi:random/[email protected].0=crate::random::random"
with="$with,wasi:http/[email protected].0=crate::http::types"
with="$with,wasi:http/[email protected].0=crate::http::outgoing_handler"
with="wasi:cli/[email protected].1=crate::cli::stdin"
with="$with,wasi:cli/[email protected].1=crate::cli::stdout"
with="$with,wasi:cli/[email protected].1=crate::cli::stderr"
with="$with,wasi:clocks/[email protected].1=crate::clocks::monotonic_clock"
with="$with,wasi:clocks/[email protected].1=crate::clocks::wall_clock"
with="$with,wasi:io/[email protected].1=crate::io::error"
with="$with,wasi:io/[email protected].1=crate::io::poll"
with="$with,wasi:io/[email protected].1=crate::io::streams"
with="$with,wasi:random/[email protected].1=crate::random::random"
with="$with,wasi:http/[email protected].1=crate::http::types"
with="$with,wasi:http/[email protected].1=crate::http::outgoing_handler"
generate src/proxy.rs \
--world wasi:http/proxy \
--with "$with" \
Expand Down
28 changes: 28 additions & 0 deletions ci/vendor-wit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

# Script to re-vendor the WIT files that wasi-rs uses as defined by a
# particular tag in upstream repositories.
#
# This script is executed on CI to ensure that everything is up-to-date.
set -ex

# Space-separated list of wasi proposals that are vendored here along with the
# tag that they're all vendored at.
#
# This assumes that the repositories all have the pattern:
# https://github.com/WebAssembly/wasi-$repo
# and every repository has a tag `v$tag` here. That is currently done as part
# of the WASI release process.
repos="cli clocks filesystem http io random sockets"
tag=0.2.1
dst=wit/deps

rm -rf $dst
mkdir -p $dst

for repo in $repos; do
mkdir $dst/$repo
curl -L https://github.com/WebAssembly/wasi-$repo/archive/refs/tags/v$tag.tar.gz | \
tar xzf - --strip-components=2 -C $dst/$repo wasi-$repo-$tag/wit
rm -rf $dst/$repo/deps*
done
Loading

0 comments on commit c8c4f20

Please sign in to comment.