Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC

Commits:

6 changed files:

Changes:

  • changelog.d/25850
    1
    +section: packaging
    
    2
    +synopsis: Include transitive dependencies when building library documentation with
    
    3
    +  Hadrian, so Haddock can resolve references to indirect dependencies.
    
    4
    +issues: #25850 #27786
    
    5
    +mrs: !16638

  • hadrian/src/Hadrian/Haskell/Cabal/Parse.hs
    ... ... @@ -321,6 +321,7 @@ resolveContextData context@Context {..} = do
    321 321
                                       (C.hsSourceDirs buildInfo)
    
    322 322
               , depIds          = depIds
    
    323 323
               , depNames        = map (C.display . C.mungedName . snd) extDeps
    
    324
    +          , transitiveDepNames = map (C.display . C.mungedName') depPkgs
    
    324 325
               , includeDirs     = map C.getSymbolicPath (C.includeDirs     buildInfo)
    
    325 326
               , includes        = map C.getSymbolicPath (C.includes        buildInfo)
    
    326 327
               , installIncludes = map C.getSymbolicPath (C.installIncludes buildInfo)
    

  • hadrian/src/Hadrian/Haskell/Cabal/Type.hs
    ... ... @@ -48,6 +48,7 @@ data ContextData = ContextData
    48 48
         , srcDirs            :: [String]
    
    49 49
         , depIds             :: [String]
    
    50 50
         , depNames           :: [String]
    
    51
    +    , transitiveDepNames :: [String]
    
    51 52
         , includeDirs        :: [String]
    
    52 53
         , includes           :: [String]
    
    53 54
         , installIncludes    :: [String]
    

  • hadrian/src/Main.hs
    ... ... @@ -68,7 +68,7 @@ main = do
    68 68
                   -- from PackageData or other oracle value types). This forces
    
    69 69
                   -- Shake to wipe the stale database instead of crashing on
    
    70 70
                   -- deserialisation.
    
    71
    -              shakeVersion  = "3"
    
    71
    +              shakeVersion  = "4"
    
    72 72
                 , shakeChange   = ChangeModtimeAndDigest
    
    73 73
                 , shakeFiles    = buildRoot -/- Base.shakeFilesDir
    
    74 74
                 , shakeProgress = Progress.hadrianProgress cwd
    

  • hadrian/src/Rules/Documentation.hs
    ... ... @@ -422,9 +422,12 @@ 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 direct and indirect dependencies of the current library.
    
    426 426
     haddockDependencies :: Context -> Action [(Package, FilePath)]
    
    427 427
     haddockDependencies context = do
    
    428
    -    depNames <- interpretInContext context (getContextData depNames)
    
    428
    +    directDeps <- interpretInContext context (getContextData depNames)
    
    429
    +    transitiveDeps <- interpretInContext context (getContextData transitiveDepNames)
    
    430
    +    -- Preserve the preference for direct dependencies when resolving links.
    
    431
    +    let depNames = nub (directDeps ++ transitiveDeps)
    
    429 432
         sequence [ (,) <$> pure depPkg <*> (pkgHaddockFile $ vanillaContext (stage context) depPkg)
    
    430 433
                  | Just depPkg <- map findPackageByName depNames, (pkgName depPkg) `notElem` haddockExclude ]

  • hadrian/src/Rules/Selftest.hs
    ... ... @@ -8,6 +8,7 @@ import Base
    8 8
     import Context
    
    9 9
     import Oracles.ModuleFiles
    
    10 10
     import Packages
    
    11
    +import Rules.Documentation (haddockDependencies)
    
    11 12
     import Settings
    
    12 13
     import Target
    
    13 14
     import Utilities
    
    ... ... @@ -71,6 +72,11 @@ testDependencies = do
    71 72
         test $ stage1Deps /= stage0Deps
    
    72 73
         test $ stage1Deps == stage2Deps
    
    73 74
     
    
    75
    +    putBuild "==== T25850: Transitive Haddock dependencies"
    
    76
    +    haddockDeps <- map fst <$> haddockDependencies (vanillaContext Stage1 templateHaskell)
    
    77
    +    unless (ghcPrim `elem` haddockDeps) $
    
    78
    +        fail "T25850: Haddock is missing the indirect ghc-prim dependency of template-haskell"
    
    79
    +
    
    74 80
     testLookupAll :: Action ()
    
    75 81
     testLookupAll = do
    
    76 82
         putBuild "==== lookupAll"