[commit: ghc] wip/nfs-locking: Add verboseCommands predicate to show executed commands in full when needed. (f48da18)

git at git.haskell.org git at git.haskell.org
Thu Oct 26 23:26:00 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/f48da1844187e9dab91be2038d0675b6d1eb90b8/ghc

>---------------------------------------------------------------

commit f48da1844187e9dab91be2038d0675b6d1eb90b8
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Sun Dec 20 18:41:44 2015 +0000

    Add verboseCommands predicate to show executed commands in full when needed.


>---------------------------------------------------------------

f48da1844187e9dab91be2038d0675b6d1eb90b8
 src/Rules/Actions.hs | 11 +++++++----
 src/Settings/User.hs |  9 ++++++++-
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/Rules/Actions.hs b/src/Rules/Actions.hs
index cdc2e17..805c771 100644
--- a/src/Rules/Actions.hs
+++ b/src/Rules/Actions.hs
@@ -16,13 +16,16 @@ buildWithResources rs target = do
     needBuilder laxDependencies builder
     path    <- builderPath builder
     argList <- interpret target getArgs
+    verbose <- interpret target verboseCommands
+    let quitelyUnlessVerbose = if verbose then withVerbosity Loud else quietly
     -- The line below forces the rule to be rerun if the args hash has changed
     checkArgsHash target
     withResources rs $ do
-        putBuild $ "/--------\n| Running " ++ show builder ++ " with arguments:"
-        mapM_ (putBuild . ("|   " ++)) $ interestingInfo builder argList
-        putBuild $ "\\--------"
-        quietly $ case builder of
+        unless verbose $ do
+            putBuild $ "/--------\n| Running " ++ show builder ++ " with arguments:"
+            mapM_ (putBuild . ("|   " ++)) $ interestingInfo builder argList
+            putBuild $ "\\--------"
+        quitelyUnlessVerbose $ case builder of
             Ar -> arCmd path argList
 
             HsCpp -> do
diff --git a/src/Settings/User.hs b/src/Settings/User.hs
index 0dffbfd..4c7a5f4 100644
--- a/src/Settings/User.hs
+++ b/src/Settings/User.hs
@@ -2,7 +2,8 @@ module Settings.User (
     userArgs, userPackages, userLibWays, userRtsWays, userTargetDirectory,
     userProgramPath, userKnownPackages, integerLibrary,
     trackBuildSystem, buildHaddock, validating, ghciWithDebugger, ghcProfiled,
-    ghcDebugged, dynamicGhcPrograms, laxDependencies, buildSystemConfigFile
+    ghcDebugged, dynamicGhcPrograms, laxDependencies, buildSystemConfigFile,
+    verboseCommands
     ) where
 
 import Expression
@@ -81,3 +82,9 @@ buildHaddock = return True
 
 buildSystemConfigFile :: Bool
 buildSystemConfigFile = False
+
+-- Set to True to print full command lines during the build process. Note, this
+-- is a Predicate, hence you can enable verbose output for a chosen package
+-- only, e.g.: verboseCommands = package ghcPrim
+verboseCommands :: Predicate
+verboseCommands = return False



More information about the ghc-commits mailing list