Zubin pushed to branch wip/wip/27786 at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • changelog.d/hadrian-haddock-transitive-deps-27786
    1
    +section: packaging
    
    2
    +synopsis: Hadrian now passes the interfaces of all transitive dependencies to
    
    3
    +  Haddock, so documentation of entities reexported from ``ghc-internal`` via
    
    4
    +  ``base`` (e.g. in ``stm``) is no longer missing.
    
    5
    +issues: #27786
    
    6
    +mrs: !16691

  • hadrian/src/Rules/Documentation.hs
    ... ... @@ -422,9 +422,19 @@ buildManPage = do
    422 422
                 checkSphinxWarnings dir
    
    423 423
                 copyFileUntracked (dir -/- "ghc.1") file
    
    424 424
     
    
    425
    --- | Find the Haddock files for the dependencies of the current library.
    
    425
    +-- | Find the Haddock files for the transitive dependencies of the current
    
    426
    +-- library. Transitive because the package defining a reexported name may not be
    
    427
    +-- a direct dependency (#27786).
    
    426 428
     haddockDependencies :: Context -> Action [(Package, FilePath)]
    
    427 429
     haddockDependencies context = do
    
    428
    -    depNames <- interpretInContext context (getContextData depNames)
    
    429
    -    sequence [ (,) <$> pure depPkg <*> (pkgHaddockFile $ vanillaContext (stage context) depPkg)
    
    430
    -             | Just depPkg <- map findPackageByName depNames, (pkgName depPkg) `notElem` haddockExclude ]
    430
    +    depPkgs <- go [] [Context.package context]
    
    431
    +    sequence [ (,) depPkg <$> pkgHaddockFile (vanillaContext (stage context) depPkg)
    
    432
    +             | depPkg <- depPkgs ]
    
    433
    +  where
    
    434
    +    go seen [] = return seen
    
    435
    +    go seen (pkg:pkgs) = do
    
    436
    +        names <- interpretInContext (context { Context.package = pkg }) (getContextData depNames)
    
    437
    +        let new = [ depPkg | Just depPkg <- map findPackageByName names
    
    438
    +                           , pkgName depPkg `notElem` haddockExclude
    
    439
    +                           , depPkg `notElem` seen ]
    
    440
    +        go (seen ++ new) (pkgs ++ new)