Skip to content

Commit

Permalink
Merge branch 'master' into fix9151
Browse files Browse the repository at this point in the history
  • Loading branch information
aleeusgr authored Oct 19, 2023
2 parents 19c5100 + eece442 commit 9035a19
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 4 deletions.
14 changes: 11 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,24 @@ build-linux:
TARBALL_EXT: tar.xz
ADD_CABAL_ARGS: "--enable-split-sections"

build-x86_64-linux-alpine:
build-linux-alpine:
extends: .build
parallel:
matrix:
- ARCH: i386
OS: [alpine3_12]
GHC_VERSION: 9.0.2
- ARCH: x86_64
OS: [alpine3_12]
tags:
- x86_64-linux
before_script:
# for cabal build
- sudo apk add --no-cache zlib zlib-dev zlib-static
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-alpine3_12:$DOCKER_REV"
image: "registry.gitlab.haskell.org/ghc/ci-images/$PLATFORM:$DOCKER_REV"
variables:
TARBALL_ARCHIVE_SUFFIX: x86_64-linux-alpine
PLATFORM: "${ARCH}-linux-${OS}"
TARBALL_ARCHIVE_SUFFIX: $PLATFORM
TARBALL_EXT: tar.xz
ADD_CABAL_ARGS: "--enable-split-sections --enable-executable-static"

Expand Down
3 changes: 3 additions & 0 deletions .gitlab/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export BOOTSTRAP_HASKELL_NONINTERACTIVE=1
export BOOTSTRAP_HASKELL_GHC_VERSION=$GHC_VERSION
export BOOTSTRAP_HASKELL_CABAL_VERSION=$CABAL_INSTALL_VERSION
export BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG=yes
# We don't use stack, and it isn't available on i386-deb9
export BOOTSTRAP_HASKELL_INSTALL_NO_STACK=yes

# for some reason the subshell doesn't pick up the arm64 environment on darwin
# and starts installing x86_64 GHC
Expand Down Expand Up @@ -63,6 +65,7 @@ args=(
${ADD_CABAL_ARGS}
)

run cabal update hackage.haskell.org,HEAD
run cabal v2-build ${args[@]} cabal-install

mkdir "$CI_PROJECT_DIR/out"
Expand Down
9 changes: 8 additions & 1 deletion Cabal/src/Distribution/Simple/Haddock.hs
Original file line number Diff line number Diff line change
Expand Up @@ -821,14 +821,21 @@ renderArgs verbosity tmpFileOpts version comp platform args k = do
else k (renderedArgs, result)
where
outputDir = (unDir $ argOutputDir args)
isNotArgContents = isNothing (flagToMaybe $ argContents args)
isNotArgIndex = isNothing (flagToMaybe $ argIndex args)
isArgGenIndex = fromFlagOrDefault False (argGenIndex args)
-- Haddock, when generating HTML, does not generate an index if the options
-- --use-contents or --use-index are passed to it. See
-- https://haskell-haddock.readthedocs.io/en/latest/invoking.html#cmdoption-use-contents
isIndexGenerated = isArgGenIndex && isNotArgContents && isNotArgIndex
result =
intercalate ", "
. map
( \o ->
outputDir
</> case o of
Html
| fromFlagOrDefault False (argGenIndex args) ->
| isIndexGenerated ->
"index.html"
Html
| otherwise ->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cabal-version: 3.6
name: A
synopsis: A minimal test package for testing haddock.
version: 0.0.0

library
build-depends: base
default-language: Haskell2010
exposed-modules: A
hs-source-dirs: .
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- | A minimal test module for testing haddock.
module A (a) where

-- | a is zero.
a :: Int
a = 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# cabal haddock
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
- A-0.0.0 (lib) (first run)
Configuring library for A-0.0.0...
Preprocessing library for A-0.0.0...
Running Haddock on library for A-0.0.0...
Documentation created: <ROOT>/cabal.dist/work/dist/build/<ARCH>/ghc-<GHCVER>/A-0.0.0/doc/html/A-0.0.0-docs/, <ROOT>/cabal.dist/work/dist/build/<ARCH>/ghc-<GHCVER>/A-0.0.0/doc/html/A-0.0.0-docs/A.txt
Documentation tarball created: <ROOT>/cabal.dist/work/./dist/A-0.0.0-docs.tar.gz
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
packages: A
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Test.Cabal.Prelude

-- Test that `cabal haddock --haddock-for-hackage` does not report that it
-- creates an `index.html` file.
main = cabalTest $ do
r <- cabal' "haddock" ["--haddock-for-hackage", "A"]
assertOutputDoesNotContain "index.html" r
1 change: 1 addition & 0 deletions cabal.project.release
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ packages: cabal-install/
tests: False
benchmarks: False
optimization: True
index-state: hackage.haskell.org 2023-10-13T10:16:13Z
4 changes: 4 additions & 0 deletions changelog.d/pr-9332
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
synopsis: Don't report `index.html` file as created, if not created by Haddock
packages: Cabal cabal-install
prs: #9332
issues: #5120

0 comments on commit 9035a19

Please sign in to comment.