|
726 | 726 | elif test "$BUILD" = "cabal-v2" |
727 | 727 | then |
728 | 728 | 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 |
730 | 730 |
|
731 | 731 | CABAL_BUILD_OPTIONS=$(cat << EOF |
732 | 732 | $(test -n "$DISABLE_TEST" || echo "--enable-tests") |
@@ -2024,17 +2024,28 @@ build_and_test() { |
2024 | 2024 | cabal-v2) |
2025 | 2025 | show_step "Build" |
2026 | 2026 | 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. |
2027 | 2034 | run_verbose_errexit $SDIST_CABALCMD v2-build \ |
2028 | 2035 | --with-compiler "$COMPILER_EXE_PATH" \ |
2029 | 2036 | $GHCJS_FLAG $CABAL_BUILD_OPTIONS $CABAL_BUILD_TARGETS |
2030 | 2037 |
|
| 2038 | + # Haddock build forces recompilation of tests, so we should either do |
| 2039 | + # haddock in separate builddir or do them after the tests. |
2031 | 2040 | if test -z "$DISABLE_DOCS" |
2032 | 2041 | then |
2033 | 2042 | show_step "Build haddock docs" |
2034 | 2043 | echo "pwd: $(pwd)" |
2035 | 2044 | run_verbose_errexit $SDIST_CABALCMD v2-haddock \ |
2036 | 2045 | --with-compiler "$COMPILER_EXE_PATH" \ |
2037 | | - $GHCJS_FLAG $CABAL_BUILD_OPTIONS \ |
| 2046 | + $GHCJS_FLAG |
| 2047 | + --builddir dist-newstyle-haddock \ |
| 2048 | + $CABAL_BUILD_OPTIONS \ |
2038 | 2049 | $HADDOCK_OPTIONS \ |
2039 | 2050 | $CABAL_HADDOCK_TARGETS |
2040 | 2051 | fi |
|
0 commit comments