Skip to content

Commit b374351

Browse files
Use a separate builddir for haddock
1 parent fed2b8d commit b374351

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

‎packcheck.sh‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ EOF
726726
elif test "$BUILD" = "cabal-v2"
727727
then
728728
test -n "$CABAL_BUILD_TARGETS" || CABAL_BUILD_TARGETS=all
729-
test -n "$CABAL_HADDOCK_TARGETS" || CABAL_HADDOCK_TARGETS=.
729+
test -n "$CABAL_HADDOCK_TARGETS" || CABAL_HADDOCK_TARGETS=all
730730

731731
CABAL_BUILD_OPTIONS=$(cat << EOF
732732
$(test -n "$DISABLE_TEST" || echo "--enable-tests")
@@ -2024,17 +2024,28 @@ build_and_test() {
20242024
cabal-v2)
20252025
show_step "Build"
20262026
echo "pwd: $(pwd)"
2027+
2028+
# If we use --enable-documenation cabal compiles once for build
2029+
# and compilation is forced again for documentation it says "Flags
2030+
# Changed". The same thing happens for separate haddock step as
2031+
# well. But in a separate haddock step we can at least change the
2032+
# build-dir to not clobber our pervious build. If haddock clobbers then
2033+
# running tests will build it again.
20272034
run_verbose_errexit $SDIST_CABALCMD v2-build \
20282035
--with-compiler "$COMPILER_EXE_PATH" \
20292036
$GHCJS_FLAG $CABAL_BUILD_OPTIONS $CABAL_BUILD_TARGETS
20302037

2038+
# Haddock build forces recompilation of tests, so we should either do
2039+
# haddock in separate builddir or do them after the tests.
20312040
if test -z "$DISABLE_DOCS"
20322041
then
20332042
show_step "Build haddock docs"
20342043
echo "pwd: $(pwd)"
20352044
run_verbose_errexit $SDIST_CABALCMD v2-haddock \
20362045
--with-compiler "$COMPILER_EXE_PATH" \
2037-
$GHCJS_FLAG $CABAL_BUILD_OPTIONS \
2046+
$GHCJS_FLAG
2047+
--builddir dist-newstyle-haddock \
2048+
$CABAL_BUILD_OPTIONS \
20382049
$HADDOCK_OPTIONS \
20392050
$CABAL_HADDOCK_TARGETS
20402051
fi

0 commit comments

Comments
 (0)