diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..f68f33c --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[build] +target = "wasm32-wasip2" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5f53940..0bce520 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 @@ -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 diff --git a/Makefile b/Makefile index 78ccfe5..f13c71e 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README.md b/README.md index 78d8e5c..7e0f88a 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,7 @@ A collection of utility components that remix wasi:cli 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 diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..daaf687 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "1.89" +targets = [ "wasm32-wasip2" ]