[Git][ghc/ghc][wip/andreask/hadrian_ghc_rsp_file] hadrian: Use a response file to invoke GHC for dep gathering.
Andreas Klebinger pushed to branch wip/andreask/hadrian_ghc_rsp_file at Glasgow Haskell Compiler / GHC Commits: 4e7ca1f4 by Matthew Pickering at 2025-11-11T12:25:00+01:00 hadrian: Use a response file to invoke GHC for dep gathering. In some cases we construct an argument list too long for GHC to handle directly on windows. This happens when we generate the dependency file because the command line will contain references to a large number of .hs files. To avoid this we now invoke GHC using a response file when generating dependencies to sidestep length limitations. Note that we only pass the actual file names in the dependency file. Why? Because this side-steps #26560 - - - - - 2 changed files: - hadrian/src/Builder.hs - hadrian/src/Settings/Builders/Ghc.hs Changes: ===================================== hadrian/src/Builder.hs ===================================== @@ -361,6 +361,9 @@ instance H.Builder Builder where Haddock BuildPackage -> runHaddock path buildArgs buildInputs + Ghc FindHsDependencies _ -> do + runGhcWithResponse path buildArgs buildInputs + HsCpp -> captureStdout Make dir -> cmd' buildOptions path ["-C", dir] buildArgs @@ -403,6 +406,15 @@ runHaddock haddockPath flagArgs fileInputs = withTempFile $ \tmp -> do writeFile' tmp $ escapeArgs fileInputs cmd [haddockPath] flagArgs ('@' : tmp) +runGhcWithResponse :: FilePath -> [String] -> [FilePath] -> Action () +runGhcWithResponse ghcPath flagArgs fileInputs = withTempFile $ \tmp -> do + + writeFile' tmp $ escapeArgs fileInputs + + -- Cannot put everything into a response file due to #26560 + cmd [ghcPath] 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. ===================================== hadrian/src/Settings/Builders/Ghc.hs ===================================== @@ -182,7 +182,7 @@ findHsDependencies = builder (Ghc FindHsDependencies) ? do , arg "-include-pkg-deps" , arg "-dep-makefile", arg =<< getOutput , pure $ concat [ ["-dep-suffix", wayPrefix w] | w <- Set.toList ways ] - , getInputs ] + ] haddockGhcArgs :: Args haddockGhcArgs = mconcat [ commonGhcArgs View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4e7ca1f496d1b0c384cd694467cddffd... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4e7ca1f496d1b0c384cd694467cddffd... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Andreas Klebinger (@AndreasK)