Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build]
target = "wasm32-wasip2"
10 changes: 0 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,8 @@ jobs:
steps:
- uses: actions/checkout@v5
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.84.1
components: rustfmt
target: wasm32-unknown-unknown,wasm32-wasip2
- name: Install cargo binstall
uses: cargo-bins/cargo-binstall@main
- name: Install cargo component
run: cargo binstall --force cargo-component
- name: Install wkg
run: cargo binstall --force wkg
- name: Fetch wit
Expand Down Expand Up @@ -51,10 +45,6 @@ jobs:
steps:
- uses: actions/checkout@v5
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.84.1
components: rustfmt
target: wasm32-unknown-unknown
- name: Install cargo binstall
uses: cargo-bins/cargo-binstall@main
- name: Install wkg
Expand Down
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@ components: $(foreach component,$(COMPONENTS),lib/$(component).wasm $(foreach co
define BUILD_COMPONENT

lib/$1.wasm: Cargo.toml Cargo.lock wit/deps $(shell find components/$1 -type f)
@$(eval TARGET := $(if $(findstring $1,keyvalue-to-filesystem),wasm32-wasip2,wasm32-unknown-unknown))
cargo component build -p $1 --target $(TARGET) --release
cp target/$(TARGET)/release/$(subst -,_,$1).wasm lib/$1.wasm
cargo build -p $1 --release
cp target/wasm32-wasip2/release/$(subst -,_,$1).wasm lib/$1.wasm
cp components/$1/README.md lib/$1.wasm.md

lib/$1.debug.wasm: Cargo.toml Cargo.lock wit/deps $(shell find components/$1 -type f)
cargo component build -p $1 --target wasm32-wasip2
cargo build -p $1
cp target/wasm32-wasip2/debug/$(subst -,_,$1).wasm lib/$1.debug.wasm
cp components/$1/README.md lib/$1.debug.wasm.md

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ A collection of utility components that remix wasi:config types and interfaces.
## Build

Prereqs:
- a rust toolchain with a recent nightly (`rustup toolchain install nightly`)
- [`cargo component`](https://github.com/bytecodealliance/cargo-component)
- a rust toolchain with wasm32-wasip2 (`rustup target add wasm32-wasip2`)
- [`wkg`](https://github.com/bytecodealliance/wasm-pkg-tools)

```sh
Expand Down
3 changes: 3 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "1.89"
targets = [ "wasm32-wasip2" ]