From 98caa4e6db396275ef47cce8951b00c03075031f Mon Sep 17 00:00:00 2001 From: Judah Jacobson Date: Tue, 20 Jun 2017 22:22:24 -0700 Subject: [PATCH] Fix #2886: include package names in the haddock contents. It turned out that Haddock expects to see packages with those names in the GHC package DB, and omits the names otherwise. Pointing Haddock to the local and snapshot DBs resolved the issue. --- ChangeLog.md | 2 ++ src/Stack/Build/Haddock.hs | 14 ++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index f9c6570890..425f1781b9 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -84,6 +84,8 @@ Bug fixes: See [#3142](https://github.com/commercialhaskell/stack/issues/3142) * `stack script`'s import parser will now properly parse files that have Windows-style line endings (CRLF) +* `stack haddock` now includes names of all packages in the Haddock + "contents" page. ## 1.4.0 diff --git a/src/Stack/Build/Haddock.hs b/src/Stack/Build/Haddock.hs index 39404c9d47..4c719c9a0c 100644 --- a/src/Stack/Build/Haddock.hs +++ b/src/Stack/Build/Haddock.hs @@ -138,7 +138,7 @@ generateLocalHaddockIndex envOverride wc bco localDumpPkgs locals = do "local packages" envOverride wc - (boptsHaddockOpts (bcoBuildOpts bco)) + bco dumpPackages "." (localDocDir bco) @@ -161,7 +161,7 @@ generateDepsHaddockIndex envOverride wc bco globalDumpPkgs snapshotDumpPkgs loca "local packages and dependencies" envOverride wc - (boptsHaddockOpts (bcoBuildOpts bco)) + bco deps ".." depDocDir @@ -202,7 +202,7 @@ generateSnapHaddockIndex envOverride wc bco globalDumpPkgs snapshotDumpPkgs = "snapshot packages" envOverride wc - (boptsHaddockOpts (bcoBuildOpts bco)) + bco (Map.elems snapshotDumpPkgs ++ Map.elems globalDumpPkgs) "." (snapDocDir bco) @@ -213,12 +213,12 @@ generateHaddockIndex => Text -> EnvOverride -> WhichCompiler - -> HaddockOpts + -> BaseConfigOpts -> [DumpPackage () () ()] -> FilePath -> Path Abs Dir -> m () -generateHaddockIndex descr envOverride wc hdopts dumpPackages docRelFP destDir = do +generateHaddockIndex descr envOverride wc bco dumpPackages docRelFP destDir = do ensureDir destDir interfaceOpts <- (liftIO . fmap nubOrd . mapMaybeM toInterfaceOpt) dumpPackages unless (null interfaceOpts) $ do @@ -239,7 +239,9 @@ generateHaddockIndex descr envOverride wc hdopts dumpPackages docRelFP destDir = (Just destDir) envOverride (haddockExeName wc) - (hoAdditionalArgs hdopts ++ + (map (("--optghc=-package-db=" ++ ) . toFilePathNoTrailingSep) + [bcoSnapDB bco, bcoLocalDB bco] ++ + hoAdditionalArgs (boptsHaddockOpts (bcoBuildOpts bco)) ++ ["--gen-contents", "--gen-index"] ++ [x | (xs,_,_,_) <- interfaceOpts, x <- xs]) else