summaryrefslogtreecommitdiff
path: root/hadrian/src/Builder.hs
diff options
context:
space:
mode:
authorAlec Theriault <alec.theriault@gmail.com>2019-01-10 03:45:06 -0800
committerBen Gamari <ben@smart-cactus.org>2019-01-16 14:17:47 -0500
commit2e05912086bbb8eab213d44af300ecc396d912aa (patch)
treeb8b17a3e299f57ffb5bf7eb33049608f00eb19f5 /hadrian/src/Builder.hs
parent46d46ede77ef327966e9364800c7da52c208d8ae (diff)
downloadhaskell-2e05912086bbb8eab213d44af300ecc396d912aa.tar.gz
Hadrian: handle Haddock's resource directory
Fixes #16105 * Require Haddock's resource as runtime dependencies of the Haddock builder. This means we no longer have to `need` particular resources in every other documentation rule. * Do a _tracked_ copy of both the 'html' and 'latex' folder resource folders. * Move resources into `stage1/lib` (NB: the `haddock` binary goes in `stage1/bin`). Besides now actually matching the Haddock script wrapper generated by BinaryDist, this also prepares for Haddock in relocatable build folder detecting its own resources.
Diffstat (limited to 'hadrian/src/Builder.hs')
-rw-r--r--hadrian/src/Builder.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/hadrian/src/Builder.hs b/hadrian/src/Builder.hs
index a3a3f547fd..55dcb3c148 100644
--- a/hadrian/src/Builder.hs
+++ b/hadrian/src/Builder.hs
@@ -23,6 +23,7 @@ import Hadrian.Builder.Sphinx
import Hadrian.Builder.Tar
import Hadrian.Oracles.Path
import Hadrian.Oracles.TextFile
+import Hadrian.Oracles.DirectoryContents
import Hadrian.Utilities
import Base
@@ -187,6 +188,16 @@ instance H.Builder Builder where
Hsc2Hs stage -> (\p -> [p]) <$> templateHscPath stage
Make dir -> return [dir -/- "Makefile"]
+
+ Haddock _ -> do
+ let resdir = "utils/haddock/haddock-api/resources"
+ latexResources <- directoryContents matchAll (resdir -/- "latex")
+ htmlResources <- directoryContents matchAll (resdir -/- "html")
+
+ haddockLib <- stageLibPath Stage1 -- Haddock is built in stage1
+ return $ [ haddockLib -/- makeRelative resdir f
+ | f <- latexResources ++ htmlResources ]
+
_ -> return []
-- query the builder for some information.