Add simple verbose mode (-v) for debugging

This commit is contained in:
Chris Done 2014-12-31 22:17:45 +01:00
parent 335fa91385
commit 5712c2172a
3 changed files with 9 additions and 2 deletions

View File

@ -30,6 +30,7 @@ data BuildFlags = BuildFlags
{ bfEnableTests :: !Bool
, bfDoUpload :: !Bool
, bfEnableLibProfile :: !Bool
, bfVerbose :: !Bool
} deriving (Show)
data BuildType = Nightly | LTS BumpType
@ -182,6 +183,7 @@ completeBuild buildType buildFlags = withManager tlsManagerSettings $ \man -> do
, pbGlobalInstall = False
, pbEnableTests = bfEnableTests buildFlags
, pbEnableLibProfiling = bfEnableLibProfile buildFlags
, pbVerbose = bfVerbose buildFlags
}
performBuild pb >>= mapM_ putStrLn

View File

@ -63,6 +63,7 @@ data PerformBuild = PerformBuild
-- ^ Register packages in the global database
, pbEnableTests :: Bool
, pbEnableLibProfiling :: Bool
, pbVerbose :: Bool
}
data PackageInfo = PackageInfo
@ -316,7 +317,8 @@ singleBuild pb@PerformBuild {..} SingleBuild {..} =
PackageConstraints {..} = ppConstraints $ piPlan sbPackageInfo
buildLibrary = wf libOut $ \outH -> do
let run = runChild outH
let run a b = do when pbVerbose $ log' (unwords (a : b))
runChild outH a b
log' $ "Unpacking " ++ namever
runParent outH "cabal" ["unpack", namever]

View File

@ -69,4 +69,7 @@ main =
help "Skip uploading bundle, docs, etc.")) <*>
switch
(long "enable-library-profiling" <>
help "Enable profiling when building")
help "Enable profiling when building") <*>
switch
(long "verbose" <> short 'v' <>
help "Output verbose detail about the build steps")