This repository has been archived by the owner on May 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·79 lines (64 loc) · 1.61 KB
/
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
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
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env bash
set -e # exit when a command fails
set -u # exit when script tries to use undeclared variables
set -x # trace what gets executed (useful for debugging)
trap "echo SOMETHING WENT WRONG - please read the logs above and see if it helps you figure out what is wrong - and also ask an engineer help" ERR
assert_openssl_present() {
if [[ "$(uname)" = "Darwin" ]]; then
OPENSSL_DIR=/usr/local/Cellar/[email protected]
if [ ! -d $OPENSSL_DIR ]; then
echo "It appears that OpenSSL 1.1 is not installed - please install it via Homebrew and try again" 2>&1
exit 1
else
# Pick out the most recent minor OpenSSL 1.1 version that is installed
OPENSSL_PATH=$(find $OPENSSL_DIR/* -type d -maxdepth 0 | sort | tail -n 1)
export LDPATH=$OPENSSL_PATH/lib
export OPENSSL_INCLUDES=$OPENSSL_PATH/include
fi
fi
}
subproject_build() {
assert_openssl_present
mix deps.get
mix compile
}
subproject_setup() {
asdf install
mix local.hex --force
}
subproject_test() {
shellcheck "${0}"
shfmt -ci -i 2 -d "${0}"
# TODO: these tests aren't running successfully on Lindsay's machine and we
# suspect that it is because of missing CPU instrinsics under Rosetta
mix test
}
subproject_clean() {
mix clean
}
subproject_rebuild() {
subproject_clean
subproject_build
}
subcommand="${1:-build}"
case $subcommand in
setup)
subproject_setup
;;
clean)
subproject_clean
;;
test)
subproject_test
;;
rebuild)
subproject_rebuild
;;
build)
subproject_build
;;
*)
echo "Unknown build subcommand '$subcommand'"
exit 1
;;
esac