Skip to content

Commit d3d0903

Browse files
authored
Merge pull request #3276 from tschneidereit/update-example-deps
chore(examples): Update Spin Rust SDK and other dependencies
2 parents 5430ac1 + 069d9fa commit d3d0903

File tree

19 files changed

+2312
-376
lines changed

19 files changed

+2312
-376
lines changed

.devcontainer/bootstrap.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
rustup update stable && rustup default stable && rustup component add clippy rustfmt
33

44
# Installs wasm32 compiler targets
5-
rustup target add wasm32-wasip1 wasm32-unknown-unknown
5+
rustup target add wasm32-wasip1 wasm32-wasip2 wasm32-unknown-unknown

.github/actions/spin-ci-dependencies/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ runs:
9595
rustup default ${{ inputs.rust-version }}
9696
9797
- name: "Install Wasm Rust target"
98-
run: rustup target add wasm32-wasip1 wasm32-unknown-unknown
98+
run: rustup target add wasm32-wasip1 wasm32-wasip2 wasm32-unknown-unknown
9999
if: ${{ inputs.rust-wasm == 'true' }}
100100
shell: bash
101101

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ jobs:
201201

202202
# Install all the toolchain dependencies
203203
- name: Install Rust wasm target
204-
run: rustup target add wasm32-wasip1 wasm32-unknown-unknown
204+
run: rustup target add wasm32-wasip1 wasm32-wasip2 wasm32-unknown-unknown
205205
- uses: mlugg/setup-zig@v2
206206
with:
207207
version: '0.14.1'
@@ -289,7 +289,7 @@ jobs:
289289
run: rustup target add --toolchain ${{ env.RUST_VERSION }} ${{ matrix.config.target }}
290290

291291
- name: "Install Wasm Rust target"
292-
run: rustup target add wasm32-wasip1 wasm32-unknown-unknown --toolchain ${{ env.RUST_VERSION }}
292+
run: rustup target add wasm32-wasip1 wasm32-wasip2 wasm32-unknown-unknown --toolchain ${{ env.RUST_VERSION }}
293293

294294
- name: setup for cross-compiled linux aarch64 build
295295
if: matrix.config.target == 'aarch64-unknown-linux-gnu'

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ jobs:
104104
run: rustup target add --toolchain ${{ env.RUST_VERSION }} ${{ matrix.config.target }}
105105

106106
- name: "Install Wasm Rust target"
107-
run: rustup target add wasm32-wasip1 wasm32-unknown-unknown --toolchain ${{ env.RUST_VERSION }}
107+
run: rustup target add wasm32-wasip1 wasm32-wasip2 wasm32-unknown-unknown --toolchain ${{ env.RUST_VERSION }}
108108

109109
- name: setup for cross-compiled linux aarch64 build
110110
if: matrix.config.target == 'aarch64-unknown-linux-gnu'

build.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ fn main() {
5858

5959
println!(
6060
r#"
61-
error: the `wasm32-wasip1` target is not installed
62-
= help: consider downloading the target with `rustup{toolchain_override} target add wasm32-wasip1`"#
61+
error: the `wasm32-wasip2` target is not installed
62+
= help: consider downloading the target with `rustup{toolchain_override} target add wasm32-wasip2`"#
6363
);
6464
process::exit(1);
6565
}
@@ -74,7 +74,7 @@ error: the `wasm32-wasip1` target is not installed
7474
fn build_wasm_test_program(name: &'static str, root: &'static str) {
7575
build_target_dep(root, Path::new("target/test-programs").join(name))
7676
.release()
77-
.target("wasm32-wasip1")
77+
.target("wasm32-wasip2")
7878
.build();
7979
println!("cargo:rerun-if-changed={root}/Cargo.toml");
8080
println!("cargo:rerun-if-changed={root}/Cargo.lock");
@@ -84,7 +84,7 @@ fn build_wasm_test_program(name: &'static str, root: &'static str) {
8484
fn has_wasm32_wasi_target() -> bool {
8585
// Using rustc here for systems that don't have rustup
8686
let output = run(
87-
vec!["rustc", "--print=target-libdir", "--target=wasm32-wasip1"],
87+
vec!["rustc", "--print=target-libdir", "--target=wasm32-wasip2"],
8888
None,
8989
None,
9090
);
@@ -109,7 +109,7 @@ fn cargo_build(dir: &str) {
109109
"cargo",
110110
"build",
111111
"--target",
112-
"wasm32-wasip1",
112+
"wasm32-wasip2",
113113
"--release",
114114
// Ensure that even if `CARGO_TARGET_DIR` is set
115115
// that we're still building into the right dir.

crates/core/tests/integration_test.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ async fn run_test(
152152

153153
let module_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
154154
.join("../../target/test-programs/core-wasi-test.wasm");
155-
let component = spin_componentize::componentize_command(&fs::read(module_path).await?)?;
155+
let module_bytes = fs::read(module_path).await?;
156+
let component = spin_componentize::componentize_if_necessary(&module_bytes)?;
156157
let component = Component::new(engine.as_ref(), &component)?;
157158
let instance_pre = engine.instantiate_pre(&component)?;
158159
let instance = instance_pre.instantiate_async(&mut store).await?;

0 commit comments

Comments
 (0)