Skip to content

Commit 38283c0

Browse files
authored
Merge pull request #1773 from polywrap/nefzael-use-cargo-wasm-opt
Use cargo version of wasm-opt instead of npx
2 parents de421e1 + 3ee78c0 commit 38283c0

5 files changed

Lines changed: 8 additions & 11 deletions

File tree

packages/cli/src/lib/build-strategies/strategies/DockerVMStrategy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const CONFIGS: Record<BuildableLanguage, VMConfig> = {
3636
"wasm/rust": {
3737
defaultIncludes: ["Cargo.toml", "Cargo.lock"],
3838
baseImage: "polywrap/vm-base-rs",
39-
version: "0.2.0",
39+
version: "0.2.1",
4040
},
4141
"wasm/assemblyscript": {
4242
defaultIncludes: ["package.json", "package-lock.json", "yarn.lock"],

packages/cli/src/lib/defaults/build-strategies/wasm/rust/image/Dockerfile.mustache

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ RUN apk add curl pkgconfig openssl-dev bash
1212
RUN apk add clang llvm build-base
1313

1414
# Install wasm-opt
15-
RUN curl -L https://github.com/WebAssembly/binaryen/releases/download/version_101/binaryen-version_101-x86_64-linux.tar.gz | tar -xz \
16-
&& chmod +x binaryen-version_101/bin/wasm-opt \
17-
&& cp binaryen-version_101/bin/wasm-opt /usr/local/bin/ \
18-
&& rm -rf binary-version_101
15+
RUN cargo install wasm-opt
1916

2017
# Install the toml-cli
2118
RUN cargo install toml-cli

packages/cli/src/lib/defaults/build-strategies/wasm/rust/local/local.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ cargo install wasm-bindgen-cli
1515
# Install wasm-tools
1616
cargo install wasm-tools
1717

18+
# Install wasm-opt
19+
cargo install wasm-opt
20+
1821
# Ensure the module at {{dir}} has the crate-type = ["cdylib"]
1922
toml set "$1"/Cargo.toml lib.crate-type ["cdylib"] > "$1"/Cargo-local.toml && \
2023
mv "$1"/Cargo.toml "$1"/Cargo-bak.toml && \
@@ -56,5 +59,5 @@ rm -rf "$2"/strip_module.wasm
5659

5760
# Use wasm-opt to perform the "asyncify" post-processing step over all modules
5861
export ASYNCIFY_STACK_SIZE=24576
59-
npx wasm-opt --asyncify -Os "$2"/snipped_module.wasm -o "$2"/wrap.wasm
62+
wasm-opt --asyncify -Os "$2"/snipped_module.wasm -o "$2"/wrap.wasm
6063
rm -rf "$2"/snipped_module.wasm

packages/cli/src/lib/defaults/build-strategies/wasm/rust/vm/Dockerfile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ RUN apk add curl pkgconfig openssl-dev bash
1212
RUN apk add clang llvm build-base
1313

1414
# Install wasm-opt
15-
RUN curl -L https://github.com/WebAssembly/binaryen/releases/download/version_101/binaryen-version_101-x86_64-linux.tar.gz | tar -xz \
16-
&& chmod +x binaryen-version_101/bin/wasm-opt \
17-
&& cp binaryen-version_101/bin/wasm-opt /usr/local/bin/ \
18-
&& rm -rf binary-version_101
15+
RUN cargo install wasm-opt
1916

2017
# Install the toml-cli
2118
RUN cargo install toml-cli
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.2.0
1+
0.2.1

0 commit comments

Comments
 (0)