[Git][ghc/ghc][master] Hadrian: fix doc generation

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Thu Jan 26 17:35:53 UTC 2023



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


Commits:
5640cb1d by Sylvain Henry at 2023-01-26T12:35:36-05:00
Hadrian: fix doc generation

Was missing dependencies on files generated by templates (e.g.
ghc.cabal)

- - - - -


2 changed files:

- hadrian/src/Rules/Documentation.hs
- hadrian/src/Rules/Generate.hs


Changes:

=====================================
hadrian/src/Rules/Documentation.hs
=====================================
@@ -12,7 +12,7 @@ import Hadrian.BuildPath
 import Hadrian.Haskell.Cabal
 import Hadrian.Haskell.Cabal.Type
 
-import Rules.Generate (ghcPrimDependencies)
+import Rules.Generate (ghcPrimDependencies, generateTemplateResults)
 import Base
 import Context
 import Expression (getContextData, interpretInContext, (?), package)
@@ -68,6 +68,12 @@ pathPath "users_guide" = "docs/users_guide"
 pathPath "Haddock" = "utils/haddock/doc"
 pathPath _ = ""
 
+-- Generate files required to build the docs (e.g. ghc.cabal)
+needDocDeps :: Action ()
+needDocDeps = do
+  -- build .cabal files used by the doc engine to list package versions
+  generateTemplateResults
+
 -- | Build all documentation
 documentationRules :: Rules ()
 documentationRules = do
@@ -188,6 +194,9 @@ buildSphinxHtml :: FilePath -> Rules ()
 buildSphinxHtml path = do
     root <- buildRootRules
     root -/- htmlRoot -/- path -/- "index.html" %> \file -> do
+
+        needDocDeps
+
         let dest = takeDirectory file
             rstFilesDir = pathPath path
         rstFiles <- getDirectoryFiles rstFilesDir ["**/*.rst"]
@@ -301,6 +310,9 @@ buildSphinxPdf :: FilePath -> Rules ()
 buildSphinxPdf path = do
     root <- buildRootRules
     root -/- pdfRoot -/- path <.> "pdf" %> \file -> do
+
+        needDocDeps
+
         withTempDir $ \dir -> do
             let rstFilesDir = pathPath path
             rstFiles <- getDirectoryFiles rstFilesDir ["**/*.rst"]


=====================================
hadrian/src/Rules/Generate.hs
=====================================
@@ -2,7 +2,7 @@ module Rules.Generate (
     isGeneratedCmmFile, compilerDependencies, generatePackageCode,
     generateRules, copyRules, generatedDependencies,
     ghcPrimDependencies,
-    templateRules
+    templateRules, generateTemplateResults
     ) where
 
 import qualified Data.Set as Set
@@ -243,7 +243,6 @@ templateResults =
     , "driver/ghci/ghci-wrapper.cabal"
     , "ghc/ghc-bin.cabal"
     , "utils/iserv/iserv.cabal"
-    , "utils/iserv-proxy/iserv-proxy.cabal"
     , "utils/remote-iserv/remote-iserv.cabal"
     , "utils/runghc/runghc.cabal"
     , "libraries/ghc-boot/ghc-boot.cabal"
@@ -256,6 +255,10 @@ templateResults =
     , "libraries/prologue.txt"
     ]
 
+-- | Generate all the files we know we have a template for
+generateTemplateResults :: Action ()
+generateTemplateResults = need templateResults
+
 templateRules :: Rules ()
 templateRules = do
   templateResults |%> \out -> do



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5640cb1d84d3cce4ce0a9e90d29b2b20d2b38c2f

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5640cb1d84d3cce4ce0a9e90d29b2b20d2b38c2f
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230126/f4af55a5/attachment-0001.html>


More information about the ghc-commits mailing list