summaryrefslogtreecommitdiff
path: root/hadrian/src
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-08-15 22:23:54 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-08-19 00:09:47 -0400
commit2361b3bc08811b0d2fb8f8fc5635b7c2fec157c6 (patch)
treecccb9d1d5b5836b3c0f131d81651cd2589e28502 /hadrian/src
parent4303acba89b26cc3ae05527d701cba7d84edafcb (diff)
downloadhaskell-2361b3bc08811b0d2fb8f8fc5635b7c2fec157c6.tar.gz
haddock docs: Fix links from identifiers to dependent packages
When implementing the base_url changes I made the pretty bad mistake of zipping together two lists which were in different orders. The simpler thing to do is just modify `haddockDependencies` to also return the package identifier so that everything stays in sync. Fixes #22001
Diffstat (limited to 'hadrian/src')
-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"