forked from google/proto-lens
-
Notifications
You must be signed in to change notification settings - Fork 0
/
travis-cabal.sh
executable file
·68 lines (61 loc) · 1.92 KB
/
travis-cabal.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
# A script for running Cabal on all the individual packages in this project.
set -euo pipefail
set -x
echo Installing hpack
curl -L https://github.com/sol/hpack/releases/download/0.28.2/hpack_linux.gz \
| gunzip > $HOME/.local/bin/hpack
chmod +x $HOME/.local/bin/hpack
# List all the packages in this repo. Put certain ones first since
# they're dependencies of the others. (Unfortunately, "stack query" doesn't
# give them to us in the right order.)
PACKAGES="
lens-labels
proto-lens
proto-lens-protoc
proto-lens-protobuf-types
proto-lens-arbitrary
proto-lens-combinators
proto-lens-optparse
proto-lens-tests-dep
proto-lens-tests
proto-lens-benchmarks
"
echo Building: $PACKAGES
# Needed by haskell-src-exts which is a dependency of proto-lens-protoc.
# Sadly, Cabal won't install such build-tools automatically.
cabal install happy
# Unregister the already-installed packages, since otherwise they may
# propagate between builds.
# TODO: use a Cabal sandbox for this.
for p in $PACKAGES
do
echo "Unregistering $p"
ghc-pkg unregister --force $p || true
done
for p in $PACKAGES
do
echo "Cabal building $p"
(cd $p &&
hpack # Generate the .cabal file
cabal clean
cabal install --enable-tests --only-dependencies
cabal configure --enable-tests --enable-benchmarks
cabal build
cabal sdist
SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz"; exit}')
cd dist
if [ -f "$SRC_TGZ" ]; then
cabal install --force-reinstalls "$SRC_TGZ"
else
echo "expected '$SRC_TGZ' not found"
exit 1
fi
)
done
# Check that "cabal repl" works on a simple test.
cd proto-lens-tests
# Get rid of the previous dist/autogen to make sure "cabal repl" rebuilds it.
cabal clean # Get rid of previous dist/autogen
cabal configure --enable-tests
printf "main\n:quit\n" | cabal repl canonical_test