summaryrefslogtreecommitdiff
path: root/hadrian
diff options
context:
space:
mode:
authorGHC GitLab CI <ghc-ci@gitlab-haskell.org>2020-09-09 16:47:18 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-09-10 10:36:09 -0400
commit95455982df1ef15c6d4585a7d3e93b5e75146a07 (patch)
tree008c341e3eac5139bc8ef1b71f1d2c9affbcc18a /hadrian
parent1207576ac0cfdd3fe1ea00b5505f7c874613451e (diff)
downloadhaskell-95455982df1ef15c6d4585a7d3e93b5e75146a07.tar.gz
hadrian: Don't include -fdiagnostics-color in argument hash
Otherwise the input hash will vary with whether colors are requested, which changed with `isatty`. Fixes #18672.
Diffstat (limited to 'hadrian')
-rw-r--r--hadrian/src/Settings/Builders/Ghc.hs3
-rw-r--r--hadrian/src/Target.hs3
2 files changed, 5 insertions, 1 deletions
diff --git a/hadrian/src/Settings/Builders/Ghc.hs b/hadrian/src/Settings/Builders/Ghc.hs
index 26ebffc326..8b3074752e 100644
--- a/hadrian/src/Settings/Builders/Ghc.hs
+++ b/hadrian/src/Settings/Builders/Ghc.hs
@@ -35,6 +35,9 @@ compileAndLinkHs = (builder (Ghc CompileHs) ||^ builder (Ghc LinkHs)) ? do
hasDynamic = elem dynamic ways
mconcat [ arg "-Wall"
, not useColor ? builder (Ghc CompileHs) ?
+ -- N.B. Target.trackArgument ignores this argument from the
+ -- input hash to avoid superfluous recompilation, avoiding
+ -- #18672.
arg "-fdiagnostics-color=never"
, (hasVanilla && hasDynamic) ? builder (Ghc CompileHs) ?
platformSupportsSharedLibs ? way vanilla ?
diff --git a/hadrian/src/Target.hs b/hadrian/src/Target.hs
index 2fb12f8c7c..07a31fc464 100644
--- a/hadrian/src/Target.hs
+++ b/hadrian/src/Target.hs
@@ -21,11 +21,12 @@ type Target = H.Target Context Builder
trackArgument :: Target -> String -> Bool
trackArgument target arg = case builder target of
Make _ -> not $ threadArg arg
- Ghc _ _ -> not $ verbosityArg arg
+ Ghc _ _ -> not $ verbosityArg arg || diagnosticsColorArg arg
Cabal _ _ -> not $ verbosityArg arg || cabal_configure_ignore arg
_ -> True
where
threadArg s = dropWhileEnd isDigit s `elem` ["-j", "MAKEFLAGS=-j", "THREADS="]
verbosityArg s = dropWhileEnd isDigit s == "-v"
+ diagnosticsColorArg s = "-fdiagnostics-color=" `isPrefixOf` s -- N.B. #18672
cabal_configure_ignore s =
s `elem` [ "--configure-option=--quiet", "--configure-option=--disable-option-checking" ]