Skip to content

Commit

Permalink
Merge pull request haskell#9319 from haskell/fix9318
Browse files Browse the repository at this point in the history
Fix haskell#9318 Avoid Haddock warning with `haddock --for-hackage`
  • Loading branch information
mergify[bot] authored Oct 11, 2023
2 parents 285a293 + 730095c commit 2794dd8
Showing 1 changed file with 26 additions and 15 deletions.
41 changes: 26 additions & 15 deletions Cabal/src/Distribution/Simple/Haddock.hs
Original file line number Diff line number Diff line change
Expand Up @@ -866,25 +866,32 @@ renderPureArgs version comp platform args =
, ["--since-qual=external" | isVersion 2 20]
, [ "--quickjump" | isVersion 2 19, True <- flagToList . argQuickJump $ args
]
, [ "--hyperlinked-source" | isVersion 2 17, True <- flagToList . argLinkedSource $ args
]
, ["--hyperlinked-source" | isHyperlinkedSource]
, (\(All b, xs) -> bool (map (("--hide=" ++) . prettyShow) xs) [] b)
. argHideModules
$ args
, bool ["--ignore-all-exports"] [] . getAny . argIgnoreExports $ args
, maybe
[]
( \(m, e, l) ->
[ "--source-module=" ++ m
, "--source-entity=" ++ e
]
++ if isVersion 2 14
then ["--source-entity-line=" ++ l]
else []
)
. flagToMaybe
. argLinkSource
$ args
, -- Haddock's --source-* options are ignored once --hyperlinked-source is
-- set.
-- See https://haskell-haddock.readthedocs.io/en/latest/invoking.html#cmdoption-hyperlinked-source
-- To avoid Haddock's warning, we only set --source-* options if
-- --hyperlinked-source is not set.
if isHyperlinkedSource
then []
else
maybe
[]
( \(m, e, l) ->
[ "--source-module=" ++ m
, "--source-entity=" ++ e
]
++ if isVersion 2 14
then ["--source-entity-line=" ++ l]
else []
)
. flagToMaybe
. argLinkSource
$ args
, maybe [] ((: []) . ("--css=" ++)) . flagToMaybe . argCssFile $ args
, maybe [] ((: []) . ("--use-contents=" ++)) . flagToMaybe . argContents $ args
, bool ["--gen-contents"] [] . fromFlagOrDefault False . argGenContents $ args
Expand Down Expand Up @@ -965,6 +972,10 @@ renderPureArgs version comp platform args =
| otherwise = "--verbose"
haddockSupportsVisibility = version >= mkVersion [2, 26, 1]
haddockSupportsPackageName = version > mkVersion [2, 16]
haddockSupportsHyperlinkedSource = isVersion 2 17
isHyperlinkedSource =
haddockSupportsHyperlinkedSource
&& fromFlagOrDefault False (argLinkedSource args)

---------------------------------------------------------------------------------

Expand Down

0 comments on commit 2794dd8

Please sign in to comment.