summaryrefslogtreecommitdiff
path: root/hadrian/src
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-02-17 10:20:25 +0000
committerMatthew Pickering <matthewtpickering@gmail.com>2022-06-01 10:32:02 +0100
commit7e470cd6e07d840b032b5249dceb061a4d590fee (patch)
tree6bcf23933733e0842f9f0eed6d2cfd7f326804c7 /hadrian/src
parent15d42a7a1287b0466ea97bedf71f4a0b161b17b4 (diff)
downloadhaskell-wip/tool-args.tar.gz
hadrian/tool-args: Write output to intermediate file rather than via stdoutwip/tool-args
This allows us to see the output of hadrian while it is doing the setup.
Diffstat (limited to 'hadrian/src')
-rw-r--r--hadrian/src/Rules/ToolArgs.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/hadrian/src/Rules/ToolArgs.hs b/hadrian/src/Rules/ToolArgs.hs
index 105ed8f15a..d0905d4548 100644
--- a/hadrian/src/Rules/ToolArgs.hs
+++ b/hadrian/src/Rules/ToolArgs.hs
@@ -12,6 +12,7 @@ import Settings
import Hadrian.Oracles.Cabal
import Hadrian.Haskell.Cabal.Type
import System.Directory (canonicalizePath)
+import System.Environment (lookupEnv)
-- | @tool:@ is used by tooling in order to get the arguments necessary
-- to set up a GHC API session which can compile modules from GHC. When
@@ -48,11 +49,15 @@ mkToolTarget :: [String] -> Package -> Action ()
mkToolTarget es p = do
-- This builds automatically generated dependencies. Not sure how to do
-- this generically yet.
+ putProgressInfo ("Computing arguments for " ++ pkgName p)
allDeps
let fake_target = target (Context stage0InTree p (if windowsHost then vanilla else dynamic))
(Ghc ToolArgs stage0InTree) [] ["ignored"]
arg_list <- interpret fake_target getArgs
- liftIO $ putStrLn (intercalate "\n" (arg_list ++ es))
+ liftIO $ lookupEnv "TOOL_OUTPUT" >>= \case
+ Nothing -> putStrLn (intercalate "\n" (arg_list ++ es))
+ Just out -> writeFile out (intercalate "\n" (arg_list ++ es))
+
allDeps :: Action ()
allDeps = do
do