Commit 9e247b06 authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Rename (run, terseRun) to (verboseRun, run).

parent 7d42fdac
......@@ -2,7 +2,7 @@
module Oracles.Builder (
Builder (..),
with, run, terseRun, specified
with, run, verboseRun, specified
) where
import Data.Char
......@@ -94,9 +94,8 @@ with builder = do
return [key ++ exe]
-- Run the builder with a given collection of arguments
-- Raises an error if the builder is not uniquely specified in config files
run :: ShowArgs a => Builder -> a -> Action ()
run builder as = do
verboseRun :: ShowArgs a => Builder -> a -> Action ()
verboseRun builder as = do
needBuilder builder
exe <- showArg builder
args <- showArgs as
......@@ -104,17 +103,15 @@ run builder as = do
-- Run the builder with a given collection of arguments printing out a
-- terse commentary with only 'interesting' info for the builder.
-- Raises an error if the builder is not uniquely specified in config files
-- TODO: make this a default 'run', rename current 'run' to verboseRun
terseRun :: ShowArgs a => Builder -> a -> Action ()
terseRun builder as = do
run :: ShowArgs a => Builder -> a -> Action ()
run builder as = do
args <- showArgs as
putColoured White $ "/--------\n" ++
"| Running " ++ show builder ++ " with arguments:"
mapM_ (putColoured White . ("| " ++)) $
interestingInfo builder args
putColoured White $ "\\--------"
quietly $ run builder as
quietly $ verboseRun builder as
interestingInfo :: Builder -> [String] -> [String]
interestingInfo builder ss = case builder of
......
......@@ -66,9 +66,9 @@ buildRule pkg @ (Package name path _) todo @ (stage, dist, _) =
-- Build using appropriate compiler
need $ hDeps ++ cDeps
when (not $ null hSrcs)
$ terseRun (Ghc stage) $ ghcArgs pkg todo way hSrcs obj
$ run (Ghc stage) $ ghcArgs pkg todo way hSrcs obj
when (not $ null cSrcs)
$ terseRun (Gcc stage) $ gccArgs pkg todo cSrcs obj
$ run (Gcc stage) $ gccArgs pkg todo cSrcs obj
argListRule :: Package -> TodoItem -> Rules ()
argListRule pkg todo @ (stage, _, settings) =
......
......@@ -124,9 +124,9 @@ buildRule pkg @ (Package name path _) todo @ (stage, dist, settings) =
] &%> \_ -> do
need [argListPath argListDir pkg stage, cabal]
when (doesFileExist $ configure <.> "ac") $ need [configure]
terseRun GhcCabal $ cabalArgs pkg todo
run GhcCabal $ cabalArgs pkg todo
when (registerPackage settings) $
terseRun (GhcPkg stage) $ ghcPkgArgs pkg todo
run (GhcPkg stage) $ ghcPkgArgs pkg todo
postProcessPackageData $ pathDist </> "package-data.mk"
argListRule :: Package -> TodoItem -> Rules ()
......
......@@ -63,12 +63,7 @@ buildRule pkg @ (Package name path _) todo @ (stage, dist, settings) = do
(buildDir </> "haskell.deps") %> \out -> do
need [argListPath argListDir pkg stage]
terseRun (Ghc stage) $ ghcArgs pkg todo
-- Avoid rebuilding dependecies of out if it hasn't changed:
-- Note: cannot use copyFileChanged as it depends on the source file
--deps <- liftIO $ readFile $ out <.> "new"
--writeFileChanged out deps
--liftIO $ removeFiles "." [out <.> "new"]
run (Ghc stage) $ ghcArgs pkg todo
(buildDir </> "c.deps") %> \out -> do
need [argListPath argListDir pkg stage]
......@@ -76,7 +71,7 @@ buildRule pkg @ (Package name path _) todo @ (stage, dist, settings) = do
deps <- fmap concat $ forM srcs $ \src -> do
let srcPath = path </> src
depFile = buildDir </> takeFileName src <.> "deps"
terseRun (Gcc stage) $ gccArgs srcPath pkg todo
run (Gcc stage) $ gccArgs srcPath pkg todo
liftIO $ readFile depFile
writeFileChanged out deps
liftIO $ removeFiles buildDir ["*.c.deps"]
......
......@@ -25,7 +25,7 @@ arRule pkg @ (Package _ path _) todo @ (stage, dist, _) =
-- Splitting argument list into chunks as otherwise Ar chokes up
maxChunk <- argSizeLimit
forM_ (chunksOfSize maxChunk $ libHsObjs ++ cObjs) $ \os -> do
terseRun Ar $ arArgs os $ toStandard out
run Ar $ arArgs os $ toStandard out
ldArgs :: Package -> TodoItem -> FilePath -> Args
ldArgs (Package _ path _) (stage, dist, _) result = do
......@@ -45,7 +45,7 @@ ldRule pkg @ (Package name path _) todo @ (stage, dist, _) =
in
priority 2 $ (buildDir </> "*.o") %> \out -> do
need [argListPath argListDir pkg stage]
terseRun Ld $ ldArgs pkg todo $ toStandard out
run Ld $ ldArgs pkg todo $ toStandard out
synopsis <- dropWhileEnd isPunctuation <$> showArg (Synopsis pathDist)
putColoured Green $ "/--------\n| Successfully built package "
++ name ++ " (stage " ++ show stage ++ ")."
......
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