-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
project.sh
executable file
·85 lines (67 loc) · 1.05 KB
/
project.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
80
81
82
83
84
85
#!/usr/bin/env bash
CABAL_FLAGS="-j8"
cmd="$1"
shift
cabal-install() {
cabal v2-install \
-j8 \
--installdir="$HOME/.local/bin" \
--overwrite-policy=always \
--disable-documentation \
$CABAL_FLAGS "$@"
}
cabal-build() {
cabal v2-build \
--enable-tests \
--enable-benchmarks \
--write-ghc-environment-files=ghc8.4.4+ \
$CABAL_FLAGS "$@"
}
cabal-test() {
cabal v2-test \
--enable-tests \
--test-show-details=direct \
--test-options='+RTS -g1' \
$CABAL_FLAGS "$@"
}
cabal-exec() {
cabal v2-exec "$(echo *.cabal | cut -d . -f 1)" "$@"
}
cabal-bench() {
cabal v2-bench -j8 \
$CABAL_FLAGS "$@"
}
cabal-repl() {
cabal v2-repl \
$CABAL_FLAGS "$@"
}
cabal-clean() {
cabal v2-clean
}
case "$cmd" in
install)
cabal-install
;;
build)
cabal-build
;;
exec)
cabal-exec
;;
test)
cabal-build
cabal-test
;;
bench)
cabal-bench
;;
repl)
cabal-repl
;;
clean)
cabal-clean
;;
*)
echo "Unrecognised command: $cmd"
exit 1
esac