Skip to content

Fix: Use the build-deps cargo extension #1212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 6, 2022
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ RUN cargo install -f wasm-snip
# Install wasm-bindgen
RUN cargo install -f wasm-bindgen-cli

# Install cargo-build-deps
RUN cargo install -f cargo-build-deps

{{#polywrap_linked_packages.length}}
WORKDIR /linked-packages
{{/polywrap_linked_packages.length}}
Expand Down Expand Up @@ -75,15 +78,16 @@ RUN toml set ./{{dir}}/Cargo.toml package.name "module" > ./{{dir}}/Cargo-local.
mv ./{{dir}}/Cargo-local.toml ./{{dir}}/Cargo.toml && \
true

RUN cargo build --manifest-path ./{{dir}}/Cargo.toml --release
# Prebuild all project dependencies, adding them to the cache
RUN cd ./{{dir}} && cargo build-deps --release && cd /project

# Copy all source files
{{#include}}
COPY {{.}} {{.}}
{{/include}}
RUN mv ./{{dir}}/Cargo.toml ./{{dir}}/Cargo-deps.toml
COPY {{dir}} {{dir}}
RUN mv ./{{dir}}/Cargo-deps.toml ./{{dir}}/Cargo.toml && rm ./target/release/deps/module*
RUN mv ./{{dir}}/Cargo-deps.toml ./{{dir}}/Cargo.toml

# Actual build:

Expand Down