-
Notifications
You must be signed in to change notification settings - Fork 267
/
bootstrap.sh
executable file
·68 lines (57 loc) · 1.62 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env bash
# Usage:
# Bootstraps the repo. End to end tests should be runnable after a bootstrap:
# ./bootstrap.sh
# Run a second time to perform a "light bootstrap", rebuilds code that's changed:
# ./bootstrap.sh
# Force a clean of the repo before performing a full bootstrap, erases untracked files, be careful!
# ./bootstrap.sh clean
set -eu
cd "$(dirname "$0")"
CMD=${1:-}
if [ -n "$CMD" ]; then
if [ "$CMD" = "clean" ]; then
echo "WARNING: This will erase *all* untracked files, including hooks and submodules."
echo -n "Continue? [y/n] "
read user_input
if [ "$user_input" != "y" ] && [ "$user_input" != "Y" ]; then
exit 1
fi
# Remove hooks and submodules.
rm -rf .git/hooks/*
rm -rf .git/modules/*
for SUBMODULE in $(git config --file .gitmodules --get-regexp path | awk '{print $2}'); do
rm -rf $SUBMODULE
done
# Remove all untracked files, directories, nested repos, and .gitignore files.
git clean -ffdx
exit 0
else
echo "Unknown command: $CMD"
exit 1
fi
fi
# if [ ! -f ~/.nvm/nvm.sh ]; then
# echo "Nvm not found at ~/.nvm"
# exit 1
# fi
# Install pre-commit git hooks.
HOOKS_DIR=$(git rev-parse --git-path hooks)
echo "(cd barretenberg/cpp && ./format.sh staged)" > $HOOKS_DIR/pre-commit
chmod +x $HOOKS_DIR/pre-commit
git submodule update --init --recursive
PROJECTS=(
barretenberg
noir
l1-contracts
yarn-project
)
for P in "${PROJECTS[@]}"; do
echo "**************************************"
echo -e "\033[1mBootstrapping $P...\033[0m"
echo "**************************************"
echo
$P/bootstrap.sh
echo
echo
done