[commit: ghc] wip/nfs-locking: adds putBuildInfo (ade3088)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 00:40:11 UTC 2017


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

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

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

commit ade30882bd45c0f4e4747ba9c6d19b2ec08846de
Author: Moritz Angermann <moritz.angermann at gmail.com>
Date:   Fri Jan 15 15:31:23 2016 +0800

    adds putBuildInfo


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

ade30882bd45c0f4e4747ba9c6d19b2ec08846de
 src/Base.hs          | 13 ++++++++-----
 src/Rules/Actions.hs |  6 +++---
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/Base.hs b/src/Base.hs
index 07b21e4..68a223b 100644
--- a/src/Base.hs
+++ b/src/Base.hs
@@ -20,8 +20,8 @@ module Base (
     bootPackageConstraints, packageDependencies,
 
     -- * Output
-    putColoured, putOracle, putBuild, putSuccess, putError, renderAction,
-    renderLibrary, renderProgram,
+    putColoured, putOracle, putBuild, putBuildInfo, putSuccess, putError,
+    renderAction, renderLibrary, renderProgram,
 
     -- * Miscellaneous utilities
     bimap, minusOrd, intersectOrd, replaceEq, quote, replaceSeparators,
@@ -129,9 +129,12 @@ putOracle = putColoured Blue
 
 -- | Make build output more distinguishable
 putBuild :: String -> Action ()
-putBuild = if buildInfo /= None
-    then putColoured White
-    else const (pure ())
+putBuild = putColoured White
+
+-- | Switch for @putBuild@ filtered through @buildInfo@
+putBuildInfo :: String -> Action ()
+putBuildInfo s | buildInfo /= None = putBuild s
+putBuildInfo _                     = pure ()
 
 -- | A more colourful version of success message
 putSuccess :: String -> Action ()
diff --git a/src/Rules/Actions.hs b/src/Rules/Actions.hs
index eb37630..77d283b 100644
--- a/src/Rules/Actions.hs
+++ b/src/Rules/Actions.hs
@@ -64,7 +64,7 @@ captureStdout target path argList = do
 
 copyFile :: FilePath -> FilePath -> Action ()
 copyFile source target = do
-    putBuild $ renderAction "Copy file" source target
+    putBuildInfo $ renderAction "Copy file" source target
     copyFileChanged source target
 
 createDirectory :: FilePath -> Action ()
@@ -80,7 +80,7 @@ removeDirectory dir = do
 -- Note, the source directory is untracked
 moveDirectory :: FilePath -> FilePath -> Action ()
 moveDirectory source target = do
-    putBuild $ renderAction "Move directory" source target
+    putBuildInfo $ renderAction "Move directory" source target
     liftIO $ IO.renameDirectory source target
 
 -- Transform a given file by applying a function to its contents
@@ -123,7 +123,7 @@ makeExecutable file = do
 
 -- Print out key information about the command being executed
 putInfo :: Target.Target -> Action ()
-putInfo Target.Target {..} = putBuild $ renderAction
+putInfo Target.Target {..} = putBuildInfo $ renderAction
     ("Run " ++ show builder ++ " (" ++ stageInfo
     ++ "package = " ++ pkgNameString package ++ wayInfo ++ ")")
     (digest inputs)



More information about the ghc-commits mailing list