-
Notifications
You must be signed in to change notification settings - Fork 141
/
bootstrap
executable file
·35 lines (28 loc) · 1.04 KB
/
bootstrap
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
31
32
33
34
35
#!/usr/bin/env bash
# install build dependencies (rustup + ic-wasm)
set -euo pipefail
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPTS_DIR/.."
function run() {
1>&2 echo "running $@"
rc=0 && "$@" || rc="$?"
if ! [ "$rc" -eq 0 ]
then
1>&2 echo "Bootstrap command failed: $@"
exit "$rc"
fi
}
rust_version=$(cat ./rust-toolchain.toml | sed -n 's/^channel[[:space:]]*=[[:space:]]"\(.*\)"/\1/p')
echo "using rust version '$rust_version'"
# here we set the toolchain to 'none' and rustup will pick up on ./rust-toolchain.toml
run curl --fail https://sh.rustup.rs -sSf | run sh -s -- -y --default-toolchain "none" --no-modify-path
echo "looking for ic-wasm 0.8.5"
if [[ ! "$(command -v ic-wasm)" || "$(ic-wasm --version)" != "ic-wasm 0.8.5" ]]
then
echo "installing ic-wasm 0.8.5"
run cargo install ic-wasm --version 0.8.5 --force
fi
# make sure the packages are actually installed (rustup waits for the first invoke to lazyload)
cargo --version
cargo clippy --version
cargo fmt --version