diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2021-09-23 09:00:27 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-09-28 01:53:36 -0400 |
commit | 2896369067027f2b283a9d2e902560c822defc4e (patch) | |
tree | 4168d5f3afcc87dee14453e3f7d63bba5713fa2a /hadrian/src/Hadrian | |
parent | 219f7f5060e64f5f88e65019daa1811342e8b8af (diff) | |
download | haskell-2896369067027f2b283a9d2e902560c822defc4e.tar.gz |
hadrian: Rework the verbosity levels
Before we really only had two verbosity levels, normal and verbose.
There are now three levels:
Normal: Commands show stderr (no stdout) and minimal build failure messages.
Verbose (-V): Commands also show stdout, build failure message contains
callstack and additional information
Diagnostic (-VV): Very verbose output showing all command lines and passing -v3 to cabal commands.
-V is similar to the default verbosity from before (but a little more
verbose)
Diffstat (limited to 'hadrian/src/Hadrian')
-rw-r--r-- | hadrian/src/Hadrian/Builder.hs | 4 | ||||
-rw-r--r-- | hadrian/src/Hadrian/Expression.hs | 8 | ||||
-rw-r--r-- | hadrian/src/Hadrian/Haskell/Cabal/Parse.hs | 6 |
3 files changed, 6 insertions, 12 deletions
diff --git a/hadrian/src/Hadrian/Builder.hs b/hadrian/src/Hadrian/Builder.hs index 4a3b63b88e..1f8f8595fa 100644 --- a/hadrian/src/Hadrian/Builder.hs +++ b/hadrian/src/Hadrian/Builder.hs @@ -121,8 +121,8 @@ doWith f info rs opts target args = do argList <- interpret target args trackArgsHash target -- Rerun the rule if the hash of argList has changed. info target - verbose <- interpret target verboseCommand - let quietlyUnlessVerbose = if verbose then withVerbosity Verbose else quietly + verbose <- getVerbosity + let quietlyUnlessVerbose = if verbose >= Diagnostic then withVerbosity Diagnostic else quietly quietlyUnlessVerbose $ f (builder target) $ BuildInfo { buildArgs = argList , buildInputs = inputs target diff --git a/hadrian/src/Hadrian/Expression.hs b/hadrian/src/Hadrian/Expression.hs index 6630a65c7a..6effc968d7 100644 --- a/hadrian/src/Hadrian/Expression.hs +++ b/hadrian/src/Hadrian/Expression.hs @@ -7,7 +7,7 @@ module Hadrian.Expression ( expr, exprIO, arg, remove, -- ** Predicates - (?), input, inputs, output, outputs, VerboseCommand (..), verboseCommand, + (?), input, inputs, output, outputs, ToPredicate(..), -- ** Evaluation @@ -145,9 +145,3 @@ output f = any (f ?==) <$> getOutputs -- | Does any of the output files match any of the given patterns? outputs :: [FilePattern] -> Predicate c b outputs = anyM output - -newtype VerboseCommand c b = VerboseCommand { predicate :: Predicate c b } - deriving Typeable - -verboseCommand :: (ShakeValue c, ShakeValue b) => Predicate c b -verboseCommand = predicate =<< expr (userSetting . VerboseCommand $ return False) diff --git a/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs b/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs index 49f5aa8802..d34951a5ef 100644 --- a/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs +++ b/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs @@ -154,7 +154,7 @@ configurePackage context@Context {..} = do verbosity <- getVerbosity when (verbosity >= Verbose) $ putProgressInfo $ "| Package " ++ quote (pkgName package) ++ " configuration flags: " ++ unwords argList - let v = if verbosity >= Verbose then "-v3" else "-v0" + let v = if verbosity >= Diagnostic then "-v3" else "-v0" traced "cabal-configure" $ C.defaultMainWithHooksNoReadArgs hooks gpd (argList ++ ["--flags=" ++ unwords flagList, v]) @@ -175,7 +175,7 @@ copyPackage context@Context {..} = do ctxPath <- Context.contextPath context pkgDbPath <- packageDbPath stage verbosity <- getVerbosity - let v = if verbosity >= Verbose then "-v3" else "-v0" + let v = if verbosity >= Diagnostic then "-v3" else "-v0" traced "cabal-copy" $ C.defaultMainWithHooksNoReadArgs C.autoconfUserHooks gpd [ "copy", "--builddir", ctxPath, "--target-package-db", pkgDbPath, v ] @@ -187,7 +187,7 @@ registerPackage context@Context {..} = do ctxPath <- Context.contextPath context gpd <- pkgGenericDescription package verbosity <- getVerbosity - let v = if verbosity >= Verbose then "-v3" else "-v0" + let v = if verbosity >= Diagnostic then "-v3" else "-v0" traced "cabal-register" $ C.defaultMainWithHooksNoReadArgs C.autoconfUserHooks gpd [ "register", "--builddir", ctxPath, v ] |