Skip to content

Commit

Permalink
Merge pull request #1773 from polywrap/nefzael-use-cargo-wasm-opt
Browse files Browse the repository at this point in the history
Use cargo version of wasm-opt instead of npx
  • Loading branch information
dOrgJelli authored Jun 15, 2023
2 parents de421e1 + 3ee78c0 commit 38283c0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const CONFIGS: Record<BuildableLanguage, VMConfig> = {
"wasm/rust": {
defaultIncludes: ["Cargo.toml", "Cargo.lock"],
baseImage: "polywrap/vm-base-rs",
version: "0.2.0",
version: "0.2.1",
},
"wasm/assemblyscript": {
defaultIncludes: ["package.json", "package-lock.json", "yarn.lock"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ RUN apk add curl pkgconfig openssl-dev bash
RUN apk add clang llvm build-base

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

# Install the toml-cli
RUN cargo install toml-cli
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ cargo install wasm-bindgen-cli
# Install wasm-tools
cargo install wasm-tools

# Install wasm-opt
cargo install wasm-opt

# Ensure the module at {{dir}} has the crate-type = ["cdylib"]
toml set "$1"/Cargo.toml lib.crate-type ["cdylib"] > "$1"/Cargo-local.toml && \
mv "$1"/Cargo.toml "$1"/Cargo-bak.toml && \
Expand Down Expand Up @@ -56,5 +59,5 @@ rm -rf "$2"/strip_module.wasm

# Use wasm-opt to perform the "asyncify" post-processing step over all modules
export ASYNCIFY_STACK_SIZE=24576
npx wasm-opt --asyncify -Os "$2"/snipped_module.wasm -o "$2"/wrap.wasm
wasm-opt --asyncify -Os "$2"/snipped_module.wasm -o "$2"/wrap.wasm
rm -rf "$2"/snipped_module.wasm
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ RUN apk add curl pkgconfig openssl-dev bash
RUN apk add clang llvm build-base

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

# Install the toml-cli
RUN cargo install toml-cli
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.0
0.2.1

0 comments on commit 38283c0

Please sign in to comment.