Commit 9d2868b1 authored by Ben Gamari's avatar Ben Gamari 🐢
Browse files

Actions: Factor out box drawing

Also add (currently broken) Unicode support although this is broken by
Shake, the console output interface of which is badly broken (see
Shake #364)
parent 8e8cc532
......@@ -7,6 +7,22 @@ import Settings.Args
import Settings.Builders.Ar
import qualified Target
insideBox :: [String] -> String
insideBox ls =
unlines $ [begin] ++ map (bar++) ls ++ [end]
where
(begin,bar,end)
| useUnicode = ( "╭──────────"
, "│ "
, "╰──────────"
)
| otherwise = ( "/----------"
, "| "
, "\\----------"
)
-- FIXME: See Shake #364.
useUnicode = False
-- Build a given target using an appropriate builder and acquiring necessary
-- resources. Force a rebuilt if the argument list has changed since the last
-- built (that is, track changes in the build system).
......@@ -17,15 +33,14 @@ buildWithResources rs target = do
path <- builderPath builder
argList <- interpret target getArgs
verbose <- interpret target verboseCommands
let quitelyUnlessVerbose = if verbose then withVerbosity Loud else quietly
let quietlyUnlessVerbose = 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
unless verbose $ do
putBuild $ "/--------\n| Running " ++ show builder ++ " with arguments:"
mapM_ (putBuild . ("| " ++)) $ interestingInfo builder argList
putBuild $ "\\--------"
quitelyUnlessVerbose $ case builder of
putBuild $ insideBox $ [ "Running " ++ show builder ++ " with arguments:" ]
++ map (" "++) (interestingInfo builder argList)
quietlyUnlessVerbose $ case builder of
Ar -> arCmd path argList
HsCpp -> do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment