summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hadrian/src/Rules/Documentation.hs6
-rw-r--r--hadrian/src/Settings/Builders/Haddock.hs5
2 files changed, 5 insertions, 6 deletions
diff --git a/hadrian/src/Rules/Documentation.hs b/hadrian/src/Rules/Documentation.hs
index 7f6e62c414..b81690dbb3 100644
--- a/hadrian/src/Rules/Documentation.hs
+++ b/hadrian/src/Rules/Documentation.hs
@@ -249,7 +249,7 @@ buildPackageDocumentation = do
vanillaSrcs <- hsSources context
let srcs = vanillaSrcs `union` generatedSrcs
- need $ srcs ++ haddocks
+ need $ srcs ++ (map snd haddocks)
-- Build Haddock documentation
-- TODO: Pass the correct way from Rules via Context.
@@ -364,8 +364,8 @@ buildManPage = do
copyFileUntracked (dir -/- "ghc.1") file
-- | Find the Haddock files for the dependencies of the current library.
-haddockDependencies :: Context -> Action [FilePath]
+haddockDependencies :: Context -> Action [(Package, FilePath)]
haddockDependencies context = do
depNames <- interpretInContext context (getContextData depNames)
- sequence [ pkgHaddockFile $ vanillaContext Stage1 depPkg
+ sequence [ (,) <$> pure depPkg <*> (pkgHaddockFile $ vanillaContext Stage1 depPkg)
| Just depPkg <- map findPackageByName depNames, depPkg /= rts ]
diff --git a/hadrian/src/Settings/Builders/Haddock.hs b/hadrian/src/Settings/Builders/Haddock.hs
index 29032d0b78..38c786de43 100644
--- a/hadrian/src/Settings/Builders/Haddock.hs
+++ b/hadrian/src/Settings/Builders/Haddock.hs
@@ -43,9 +43,8 @@ haddockBuilderArgs = mconcat
context <- getContext
version <- expr $ pkgVersion pkg
synopsis <- expr $ pkgSynopsis pkg
- trans_deps <- expr $ contextDependencies context
- pkgs <- expr $ mapM (pkgIdentifier . C.package) $ trans_deps
haddocks <- expr $ haddockDependencies context
+ haddocks_with_versions <- expr $ sequence $ [(,h) <$> pkgIdentifier p | (p, h) <- haddocks]
hVersion <- expr $ pkgVersion haddock
statsDir <- expr $ haddockStatsFilesDir
baseUrlTemplate <- expr (docsBaseUrl <$> userSetting defaultDocArgs)
@@ -69,7 +68,7 @@ haddockBuilderArgs = mconcat
, map ("--hide=" ++) <$> getContextData otherModules
, pure [ "--read-interface=../" ++ p
++ "," ++ baseUrl p ++ "/src/%{MODULE}.html#%{NAME},"
- ++ haddock | (p, haddock) <- zip pkgs haddocks ]
+ ++ haddock | (p, haddock) <- haddocks_with_versions ]
, pure [ "--optghc=" ++ opt | opt <- ghcOpts, not ("--package-db" `isInfixOf` opt) ]
, getInputs
, arg "+RTS"