summaryrefslogtreecommitdiff
path: root/hadrian/src
diff options
context:
space:
mode:
Diffstat (limited to 'hadrian/src')
-rw-r--r--hadrian/src/Builder.hs13
-rw-r--r--hadrian/src/Settings/Builders/Haddock.hs1
2 files changed, 13 insertions, 1 deletions
diff --git a/hadrian/src/Builder.hs b/hadrian/src/Builder.hs
index 77c0f514d6..39cc33ee3c 100644
--- a/hadrian/src/Builder.hs
+++ b/hadrian/src/Builder.hs
@@ -41,6 +41,7 @@ import Packages
import GHC.IO.Encoding (getFileSystemEncoding)
import qualified Data.ByteString as BS
import qualified GHC.Foreign as GHC
+import GHC.ResponseFile
-- | C compiler can be used in two different modes:
-- * Compile or preprocess a source file.
@@ -353,6 +354,8 @@ instance H.Builder Builder where
Exit _ <- cmd' [path] (buildArgs ++ [input])
return ()
+ Haddock BuildPackage -> runHaddock path buildArgs buildInputs
+
HsCpp -> captureStdout
Make dir -> cmd' path ["-C", dir] buildArgs
@@ -385,6 +388,16 @@ instance H.Builder Builder where
_ -> cmd' [path] buildArgs
+-- | Invoke @haddock@ given a path to it and a list of arguments. The arguments
+-- are passed in a response file.
+runHaddock :: FilePath -- ^ path to @haddock@
+ -> [String]
+ -> [FilePath] -- ^ input file paths
+ -> Action ()
+runHaddock haddockPath flagArgs fileInputs = withTempFile $ \tmp -> do
+ writeFile' tmp $ escapeArgs fileInputs
+ cmd [haddockPath] flagArgs ('@' : tmp)
+
-- TODO: Some builders are required only on certain platforms. For example,
-- 'Objdump' is only required on OpenBSD and AIX. Add support for platform
-- specific optional builders as soon as we can reliably test this feature.
diff --git a/hadrian/src/Settings/Builders/Haddock.hs b/hadrian/src/Settings/Builders/Haddock.hs
index 9ecdabfec7..3d1fb28fc5 100644
--- a/hadrian/src/Settings/Builders/Haddock.hs
+++ b/hadrian/src/Settings/Builders/Haddock.hs
@@ -68,7 +68,6 @@ haddockBuilderArgs = mconcat
++ "," ++ baseUrl p ++ "/src/%{MODULE}.html#%{NAME},"
++ haddock | (p, haddock) <- haddocks_with_versions ]
, pure [ "--optghc=" ++ opt | opt <- ghcOpts, not ("--package-db" `isInfixOf` opt) ]
- , getInputs
, arg "+RTS"
, arg $ "-t" ++ (statsDir -/- pkgName pkg ++ ".t")
, arg "--machine-readable"