-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·30 lines (23 loc) · 951 Bytes
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash
set -e
name="$1"
package="$2"
app_root="$(dirname "$0")/$name"
did_file="$app_root/$package.did"
# This script generates the did file, build the project (passed as $1) and then run the ic-wasm to shrink and attach metadata.
cargo build --manifest-path="$app_root/Cargo.toml" \
--target wasm32-unknown-unknown \
--release \
--package "$package"
candid-extractor "./target/wasm32-unknown-unknown/release/$package.wasm" > $did_file
cargo build --manifest-path="$app_root/Cargo.toml" \
--target wasm32-unknown-unknown \
--release \
--package "$package"
ic-wasm "./target/wasm32-unknown-unknown/release/$package.wasm" \
-o "./target/wasm32-unknown-unknown/release/$package.wasm" \
metadata candid:service -v public -f $did_file
ic-wasm "./target/wasm32-unknown-unknown/release/$package.wasm" \
-o "./target/wasm32-unknown-unknown/release/$package-opt.wasm" \
shrink
dfx generate "$package"