diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2023-04-19 11:57:34 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-04-20 11:01:06 -0400 |
commit | f15b0ce530bece8b242941a446fd381614bdd3cf (patch) | |
tree | f31b3a721c20ff64b7c2eef285bf51f15cd98142 /hadrian | |
parent | ab6c1d295cd9f492838dbd481ecc2a66bbd17393 (diff) | |
download | haskell-f15b0ce530bece8b242941a446fd381614bdd3cf.tar.gz |
hadrian: Pass haddock file arguments in a response file
In !10119 CI was failing on windows because the command line was too
long. We can mitigate this by passing the file arguments to haddock in a
response file.
We can't easily pass all the arguments in a response file because the
`+RTS` arguments can't be placed in the response file.
Fixes #23273
Diffstat (limited to 'hadrian')
-rw-r--r-- | hadrian/src/Builder.hs | 13 | ||||
-rw-r--r-- | hadrian/src/Settings/Builders/Haddock.hs | 1 |
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" |