-
Notifications
You must be signed in to change notification settings - Fork 24
/
haddockbundle.sh
executable file
·38 lines (27 loc) · 977 Bytes
/
haddockbundle.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
#!/bin/sh
# First we build haddocks for each package
# We build them separately, as apparently cabal haddock doesn't link
# to other /local/ packages.
#
# Therefore you need first to upload packages to Hackage before docs
# can be built.
#
# NOTE: actually this doesn't work either, but it was a good try.
# Same GHC as hackage doc builder (apparently) uses
GHC=ghc-8.10.7
TOPDIR=$(pwd)
PACKAGES="optics optics-core optics-th optics-extra"
for PKG in $PACKAGES; do
echo "$PKG"
cd "$PKG" || exit
pwd
# We create a cabal.project, so the root project is not used.
# Apparently cabal haddock --ignore-project doesn't ignore project after all.
echo 'packages: .' > cabal.project
cabal haddock --enable-documentation --haddock-for-hackage --with-compiler "$GHC"
cp dist-newstyle/*-docs.tar.gz "$TOPDIR/dist-newstyle/"
rm -f cabal.project
cd "$TOPDIR" || exit
done
# Create haddock bundle
cabal run --project-file=cabal.haddockbundle.project optics-haddockbundle