diff options
author | Ben Gamari <ben@smart-cactus.org> | 2023-01-25 16:20:07 -0500 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2023-02-01 13:18:47 +0000 |
commit | 653c75130773cbbb092a35a021a1bf25d4ccaf68 (patch) | |
tree | e8ed34a09abc8bde012e9847f9d300a38fd1fc4a | |
parent | 1f42664c26e552c477741d0abf1988cee0c5b8a6 (diff) | |
download | haskell-653c75130773cbbb092a35a021a1bf25d4ccaf68.tar.gz |
hadrian: Substitute LIBRARY_*_VERSION variables
This teaches Hadrian to substitute the `LIBRARY_*_VERSION` variables
in `libraries/prologue.txt`, fixing #22714.
Fixes #22714.
(cherry picked from commit 93f0e3c49cea484bd6e838892ff8702ec51f34c3)
-rw-r--r-- | hadrian/src/Rules/Documentation.hs | 10 | ||||
-rw-r--r-- | hadrian/src/Rules/Generate.hs | 10 |
2 files changed, 18 insertions, 2 deletions
diff --git a/hadrian/src/Rules/Documentation.hs b/hadrian/src/Rules/Documentation.hs index 85408a1104..9beef97c79 100644 --- a/hadrian/src/Rules/Documentation.hs +++ b/hadrian/src/Rules/Documentation.hs @@ -76,6 +76,8 @@ needDocDeps = do , ghci , libiserv , compiler + , ghcHeap + , templateHaskell ] need templatedCabalFiles @@ -100,8 +102,6 @@ documentationRules = do "docs" ~> do root <- buildRoot - needDocDeps - doctargets <- ghcDocs =<< flavour let html = htmlRoot -/- "index.html" -- also implies "docs-haddock" archives = map pathArchive docPaths @@ -201,6 +201,9 @@ buildSphinxHtml path = do root -/- htmlRoot -/- path -/- "index.html" %> \file -> do let dest = takeDirectory file rstFilesDir = pathPath path + + needDocDeps + rstFiles <- getDirectoryFiles rstFilesDir ["**/*.rst"] need (map (rstFilesDir -/-) rstFiles) build $ target docContext (Sphinx HtmlMode) [pathPath path] [dest] @@ -312,6 +315,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"] diff --git a/hadrian/src/Rules/Generate.hs b/hadrian/src/Rules/Generate.hs index c576019ebb..b04bfb15da 100644 --- a/hadrian/src/Rules/Generate.hs +++ b/hadrian/src/Rules/Generate.hs @@ -13,6 +13,8 @@ import Hadrian.Oracles.TextFile (lookupSystemConfig) import Oracles.Flag import Oracles.ModuleFiles import Oracles.Setting +import Hadrian.Haskell.Cabal.Type (PackageData(version)) +import Hadrian.Oracles.Cabal (readPackageData) import Packages import Rules.Libffi import Settings @@ -302,6 +304,13 @@ rtsCabalFlags = mconcat where flag = interpolateCabalFlag +packageVersions :: Interpolations +packageVersions = foldMap f [ base, ghcPrim, ghc, cabal, templateHaskell, ghcCompact, array ] + where + f :: Package -> Interpolations + f pkg = interpolateVar var $ show . version <$> readPackageData pkg + where var = "LIBRARY_" <> pkgName pkg <> "_VERSION" + templateRule :: FilePath -> Interpolations -> Rules () templateRule outPath interps = do outPath %> \_ -> do @@ -327,6 +336,7 @@ templateRules = do templateRule "utils/ghc-pkg/ghc-pkg.cabal" $ projectVersion templateRule "libraries/libiserv/libiserv.cabal" $ projectVersion templateRule "libraries/template-haskell/template-haskell.cabal" $ projectVersion + templateRule "libraries/prologue.txt" $ packageVersions -- Generators |