summaryrefslogtreecommitdiff
path: root/hadrian
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2023-01-25 16:20:07 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-01-31 15:52:33 -0500
commit93f0e3c49cea484bd6e838892ff8702ec51f34c3 (patch)
treebe46b8c98abdf6dadfb198e4e51b111f3ce68317 /hadrian
parent2e48c19a7faf975318e954faea26f37deb763ac0 (diff)
downloadhaskell-93f0e3c49cea484bd6e838892ff8702ec51f34c3.tar.gz
hadrian: Substitute LIBRARY_*_VERSION variables
This teaches Hadrian to substitute the `LIBRARY_*_VERSION` variables in `libraries/prologue.txt`, fixing #22714. Fixes #22714.
Diffstat (limited to 'hadrian')
-rw-r--r--hadrian/src/Rules/Documentation.hs10
-rw-r--r--hadrian/src/Rules/Generate.hs10
2 files changed, 18 insertions, 2 deletions
diff --git a/hadrian/src/Rules/Documentation.hs b/hadrian/src/Rules/Documentation.hs
index 3c31823889..27aece61d2 100644
--- a/hadrian/src/Rules/Documentation.hs
+++ b/hadrian/src/Rules/Documentation.hs
@@ -78,6 +78,8 @@ needDocDeps = do
, ghci
, libiserv
, compiler
+ , ghcHeap
+ , templateHaskell
]
need templatedCabalFiles
@@ -102,8 +104,6 @@ documentationRules = do
"docs" ~> do
root <- buildRoot
- needDocDeps
-
doctargets <- ghcDocs =<< flavour
let html = htmlRoot -/- "index.html" -- also implies "docs-haddock"
archives = map pathArchive docPaths
@@ -203,6 +203,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]
@@ -314,6 +317,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 f17ff0eb21..a37d69d7d1 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
@@ -303,6 +305,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
@@ -328,6 +337,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