-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sh
executable file
·48 lines (38 loc) · 1.19 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
#!/usr/bin/env bash
set -e
PRETTY_COMMAND="brittany"
PRETTY_COMMAND_ARGS="--write-mode inplace"
check_stack() {
if ! hash stack 2>/dev/null; then
echo "Please install stack first. See https://docs.haskellstack.org/en/stable/README/"
exit 1
fi
}
check_hlint() {
if ! hash hlint 2>/dev/null; then
echo "Please install hlint first. Run the command, stack install hlint"
exit 1
fi
}
prettify() {
if hash $PRETTY_COMMAND 2>/dev/null; then
echo "Prettifying code with $PRETTY_COMMAND..."
find src app app-windows test benchmark -name "*.hs" | xargs -n1 $PRETTY_COMMAND $PRETTY_COMMAND_ARGS
else
echo "Warning: $PRETTY_COMMAND command not found. Try: stack install $PRETTY_COMMAND"
fi
}
get_next_version() {
echo `cat package.yaml | awk -F ":" '/version/ {print $2}' | sed 's/ //g'`
}
maybe_update_version() {
sed -i.backup "s/appVersion =.*/appVersion = \"$(get_next_version)\"/" src/Version.hs
rm -rf src/Version.hs.backup
}
check_stack
check_hlint
prettify
maybe_update_version
hlint -i "Eta reduce" -X QuasiQuotes src app app-windows test benchmark --color
stack build --test
stack install --local-bin-path bin/