Commit 48746fff authored by thomie's avatar thomie

Docs: make sure all libs are included in index.html (#10879)

During the build, when HADDOCK_DOCS=YES, the command 'cd libraries && sh
gen_contents_index --intree' is run, which calls haddock to generate the
haddock index at 'libraries/dist-haddock/index.html'.

What it did before was check the ./packages file for all libraries. The
problem is that 'base' and 'ghc-prim' were folded into the main repo
some time ago, hence don't have an entry in the ./packages file anymore.
As a result, 'base' and 'ghc-prim' were missing from the index.html
file.

It now simply runs haddock on all the all the `.haddock` files in the
libraries directory.

The only risk is that this could include the extra libraries in the
index.html, if you ever built them in the past (with
BUILD_EXTRA_PKGS=YES), even though now you want to exclude them (with
BUILD_EXTRA_PKGS=NO). gen_contents_index doesn't have access to build
system variables though (PACKAGES_STAGE1+PACKAGES_STAGE2), so fixing
this would be a little bit fiddly.

Test Plan:
'make libraries/dist-haddock/index.html && grep -q base
libraries/dist-haddock/index.html && echo ok'

Reviewed by: austin

Differential Revision: https://phabricator.haskell.org/D1247
parent 77662e13
......@@ -33,22 +33,10 @@ then
cd dist-haddock
HADDOCK=../../inplace/bin/haddock
HADDOCK_FILES=`find ../ -name *.haddock | sort`
HADDOCK_ARGS="-p ../prologue.txt"
for REPO in `grep '^libraries/[^ ]* *- ' ../../packages | sed -e 's#libraries/##' -e 's/ .*//'`
for HADDOCK_FILE in $HADDOCK_FILES
do
if [ -f "../$REPO/ghc-packages" ]
then
LIBS="`cat ../$REPO/ghc-packages`"
LIBROOT="../$REPO"
else
LIBS="$REPO"
LIBROOT=".."
fi
for LIB in $LIBS
do
HADDOCK_FILE="$LIBROOT/$LIB/dist-install/doc/html/$LIB/$LIB.haddock"
if [ -f "$HADDOCK_FILE" ]
then
LIBPATH=`echo "$HADDOCK_FILE" | sed 's#/dist-install.*##'`
NAME=`echo "$HADDOCK_FILE" | sed 's#.*/##' | sed 's#\.haddock$##'`
# It's easier to portably remove tabs with tr than to try to get
......@@ -56,8 +44,6 @@ then
VERSION=`grep -i '^version:' $LIBPATH/$NAME.cabal | sed 's/.*://' | tr -d ' \t'`
HADDOCK_ARG="--read-interface=${NAME}-${VERSION},$HADDOCK_FILE"
HADDOCK_ARGS="$HADDOCK_ARGS $HADDOCK_ARG"
fi
done
done
else
HADDOCK=../../../../../bin/haddock
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment