summaryrefslogtreecommitdiff
path: root/hadrian/src/Settings/Builders/Ghc.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2021-10-07 15:59:54 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-10-15 18:16:51 -0400
commitbbb1f6dab34243af0a2841164e33eec451396b3f (patch)
treece76cfc5885e7637e4ad76eb60257d2825d6abf1 /hadrian/src/Settings/Builders/Ghc.hs
parent88e913d443203376454b5242efa5fff0928992a8 (diff)
downloadhaskell-bbb1f6dab34243af0a2841164e33eec451396b3f.tar.gz
Hadrian: display command line above errors (#20490)
Diffstat (limited to 'hadrian/src/Settings/Builders/Ghc.hs')
-rw-r--r--hadrian/src/Settings/Builders/Ghc.hs13
1 files changed, 12 insertions, 1 deletions
diff --git a/hadrian/src/Settings/Builders/Ghc.hs b/hadrian/src/Settings/Builders/Ghc.hs
index c3dad6d4d7..3d5a96efe4 100644
--- a/hadrian/src/Settings/Builders/Ghc.hs
+++ b/hadrian/src/Settings/Builders/Ghc.hs
@@ -196,6 +196,7 @@ commonGhcArgs = do
way <- getWay
path <- getBuildPath
stage <- getStage
+ useColor <- shakeColor <$> expr getShakeOptions
ghcVersion <- expr $ ghcVersionH stage
mconcat [ arg "-hisuf", arg $ hisuf way
, arg "-osuf" , arg $ osuf way
@@ -211,7 +212,17 @@ commonGhcArgs = do
, map ("-optc" ++) <$> getStagedSettingList ConfCcArgs
, map ("-optP" ++) <$> getStagedSettingList ConfCppArgs
, map ("-optP" ++) <$> getContextData cppOpts
- , arg "-outputdir", arg path ]
+ , arg "-outputdir", arg path
+ -- we need to enable color explicitly because the output is
+ -- captured to be displayed after the failed command line in case
+ -- of error (#20490). GHC detects that it doesn't output to a
+ -- terminal and it disables colors if we don't do this.
+ , useColor ?
+ -- N.B. Target.trackArgument ignores this argument from the
+ -- input hash to avoid superfluous recompilation, avoiding
+ -- #18672.
+ arg "-fdiagnostics-color=always"
+ ]
-- TODO: Do '-ticky' in all debug ways?
wayGhcArgs :: Args