Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

haddock-project fixes (backport #8919) #9088

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ register.sh
# windows test artifacts
cabal-testsuite/**/*.exe
cabal-testsuite/**/*.bat
cabal-testsuite/**/haddocks

# python artifacts from documentation builds
*.pyc
Expand Down
69 changes: 38 additions & 31 deletions Cabal/src/Distribution/Simple/Haddock.hs
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,10 @@ createHaddockIndex :: Verbosity
-> HaddockProjectFlags
-> IO ()
createHaddockIndex verbosity programDb comp platform flags = do
let args = fromHaddockProjectFlags flags
(haddockProg, _version) <-
getHaddockProg verbosity programDb comp args (haddockProjectQuickJump flags)
runHaddock verbosity defaultTempFileOptions comp platform haddockProg False args
let args = fromHaddockProjectFlags flags
(haddockProg, _version) <-
getHaddockProg verbosity programDb comp args (Flag True)
runHaddock verbosity defaultTempFileOptions comp platform haddockProg False args

-- ------------------------------------------------------------------------------
-- Contributions to HaddockArgs (see also Doctest.hs for very similar code).
Expand Down Expand Up @@ -403,17 +403,16 @@ fromFlags env flags =

fromHaddockProjectFlags :: HaddockProjectFlags -> HaddockArgs
fromHaddockProjectFlags flags =
mempty
{ argOutputDir = Dir (fromFlag $ haddockProjectDir flags)
, argQuickJump = haddockProjectQuickJump flags
, argGenContents = haddockProjectGenContents flags
, argGenIndex = haddockProjectGenIndex flags
, argPrologueFile = haddockProjectPrologue flags
, argInterfaces = fromFlagOrDefault [] (haddockProjectInterfaces flags)
, argLinkedSource = haddockProjectLinkedSource flags
, argLib = haddockProjectLib flags
}

mempty
{ argOutputDir = Dir (fromFlag $ haddockProjectDir flags)
, argQuickJump = Flag True
, argGenContents = Flag True
, argGenIndex = Flag True
, argPrologueFile = haddockProjectPrologue flags
, argInterfaces = fromFlagOrDefault [] (haddockProjectInterfaces flags)
, argLinkedSource = Flag True
, argLib = haddockProjectLib flags
}

fromPackageDescription :: HaddockTarget -> PackageDescription -> HaddockArgs
fromPackageDescription haddockTarget pkg_descr = mempty
Expand Down Expand Up @@ -677,22 +676,30 @@ renderArgs verbosity tmpFileOpts version comp platform args k = do
(if haddockSupportsUTF8 then Just utf8 else Nothing)
renderedArgs
(\responseFileName -> k (["@" ++ responseFileName], result))
else
k (renderedArgs, result)
where
outputDir = (unDir $ argOutputDir args)
result = intercalate ", "
. map (\o -> outputDir </>
case o of
Html -> "index.html"
Hoogle -> pkgstr <.> "txt")
. fromFlagOrDefault [Html]
. argOutput
$ args
where
pkgstr = prettyShow $ packageName pkgid
pkgid = arg argPackageName
arg f = fromFlag $ f args
else k (renderedArgs, result)
where
outputDir = (unDir $ argOutputDir args)
result =
intercalate ", "
. map
( \o ->
outputDir
</> case o of
Html
| fromFlagOrDefault False (argGenIndex args) ->
"index.html"
Html
| otherwise ->
mempty
Hoogle -> pkgstr <.> "txt"
)
. fromFlagOrDefault [Html]
. argOutput
$ args
where
pkgstr = prettyShow $ packageName pkgid
pkgid = arg argPackageName
arg f = fromFlag $ f args

renderPureArgs :: Version -> Compiler -> Platform -> HaddockArgs -> [String]
renderPureArgs version comp platform args = concat
Expand Down
Loading
Loading