forked from AztecProtocol/aztec-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·51 lines (42 loc) · 1.18 KB
/
bootstrap.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
[ -n "${BUILD_SYSTEM_DEBUG:-}" ] && set -x # conditionally trace
set -eu
YELLOW="\033[93m"
BLUE="\033[34m"
GREEN="\033[32m"
BOLD="\033[1m"
RESET="\033[0m"
cd "$(dirname "$0")"
CMD=${1:-}
if [ "$CMD" = "clean" ]; then
git clean -fdx
exit 0
fi
# Generate l1-artifacts before creating lock file
(cd l1-artifacts && bash ./scripts/generate-artifacts.sh)
if [ "$CMD" = "full" ]; then
yarn install --immutable
yarn build
exit 0
elif [ "$CMD" = "fast-only" ]; then
# Unlike fast build below, we don't fall back to a normal build.
# This is used when we want to ensure that fast build works.
yarn install --immutable
yarn build:fast
exit 0
elif [[ -n "$CMD" && "$CMD" != "fast" ]]; then
echo "Unknown command: $CMD"
exit 1
fi
# Fast build does not delete everything first.
# It regenerates all generated code, then performs an incremental tsc build.
echo -e "${BLUE}${BOLD}Attempting fast incremental build...${RESET}"
echo
yarn install --immutable
if ! yarn build:fast; then
echo -e "${YELLOW}${BOLD}Incremental build failed for some reason, attempting full build...${RESET}"
echo
yarn build
fi
echo
echo -e "${GREEN}Yarn project successfully built!${RESET}"