[Git][ghc/ghc][wip/wip/27786] hadrian: pass transitive dependencies to haddock
Zubin pushed to branch wip/wip/27786 at Glasgow Haskell Compiler / GHC Commits: 37c4aee1 by Zubin Duggal at 2026-09-15T17:13:55+05:30 hadrian: pass transitive dependencies to haddock Haddock looks up the docs of a reexported name in the interface of the package defining it, which may not be a direct dependency. Since base reexports ghc-internal, packages reexporting from base (e.g. stm) couldn't find docs from transitive dependencies. Fixes #27786 - - - - - 2 changed files: - + changelog.d/hadrian-haddock-transitive-deps-27786 - hadrian/src/Rules/Documentation.hs Changes: ===================================== changelog.d/hadrian-haddock-transitive-deps-27786 ===================================== @@ -0,0 +1,6 @@ +section: packaging +synopsis: Hadrian now passes the interfaces of all transitive dependencies to + Haddock, so documentation of entities reexported from ``ghc-internal`` via + ``base`` (e.g. in ``stm``) is no longer missing. +issues: #27786 +mrs: !16691 ===================================== hadrian/src/Rules/Documentation.hs ===================================== @@ -422,9 +422,19 @@ buildManPage = do checkSphinxWarnings dir copyFileUntracked (dir -/- "ghc.1") file --- | Find the Haddock files for the dependencies of the current library. +-- | Find the Haddock files for the transitive dependencies of the current +-- library. Transitive because the package defining a reexported name may not be +-- a direct dependency (#27786). haddockDependencies :: Context -> Action [(Package, FilePath)] haddockDependencies context = do - depNames <- interpretInContext context (getContextData depNames) - sequence [ (,) <$> pure depPkg <*> (pkgHaddockFile $ vanillaContext (stage context) depPkg) - | Just depPkg <- map findPackageByName depNames, (pkgName depPkg) `notElem` haddockExclude ] + depPkgs <- go [] [Context.package context] + sequence [ (,) depPkg <$> pkgHaddockFile (vanillaContext (stage context) depPkg) + | depPkg <- depPkgs ] + where + go seen [] = return seen + go seen (pkg:pkgs) = do + names <- interpretInContext (context { Context.package = pkg }) (getContextData depNames) + let new = [ depPkg | Just depPkg <- map findPackageByName names + , pkgName depPkg `notElem` haddockExclude + , depPkg `notElem` seen ] + go (seen ++ new) (pkgs ++ new) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/37c4aee1c36919778f805dc1f46f7e01... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/37c4aee1c36919778f805dc1f46f7e01... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
participants (1)
-
Zubin (@wz1000)