Commit 9dbdf072 authored by bardur.arantsson's avatar bardur.arantsson Committed by GitHub
Browse files

Merge pull request #3785 from ezyang/pr/why-rebuild

Make default install plan printing more chatty
parents 54057e6e da388222
......@@ -22,7 +22,7 @@ module Distribution.Simple.Utils (
die,
dieWithLocation,
topHandler, topHandlerWith,
warn, notice, setupMessage, info, debug,
warn, notice, noticeNoWrap, setupMessage, info, debug,
debugNoWrap, chattyTry,
printRawCommandAndArgs, printRawCommandAndArgsAndEnv,
......@@ -318,6 +318,11 @@ notice verbosity msg =
when (verbosity >= normal) $
putStr (wrapText msg)
noticeNoWrap :: Verbosity -> String -> IO ()
noticeNoWrap verbosity msg =
when (verbosity >= normal) $
putStr msg
setupMessage :: Verbosity -> String -> PackageIdentifier -> IO ()
setupMessage verbosity msg pkgid =
notice verbosity (msg ++ ' ': display pkgid ++ "...")
......
......@@ -79,7 +79,7 @@ import qualified Distribution.PackageDescription as PD
import Distribution.PackageDescription (FlagAssignment)
import Distribution.Simple.Setup (HaddockFlags)
import Distribution.Simple.Utils (die, notice, debug)
import Distribution.Simple.Utils (die, notice, noticeNoWrap, debug)
import Distribution.Verbosity
import Distribution.Text
......@@ -427,34 +427,36 @@ printPlan verbosity
| null pkgs
= notice verbosity "Up to date"
| verbosity >= verbose
= notice verbosity $ unlines $
("In order, the following " ++ wouldWill ++ " be built:")
| otherwise
= noticeNoWrap verbosity $ unlines $
("In order, the following " ++ wouldWill ++ " be built" ++
ifNormal " (use -v for more details)" ++ ":")
: map showPkgAndReason pkgs
| otherwise
= notice verbosity $ unlines $
("In order, the following " ++ wouldWill
++ " be built (use -v for more details):")
: map (\(ReadyPackage pkg) -> showPkg pkg (elabPkgOrComp pkg)) pkgs
where
pkgs = InstallPlan.executionOrder elaboratedPlan
ifVerbose s | verbosity >= verbose = s
| otherwise = ""
ifNormal s | verbosity >= verbose = ""
| otherwise = s
wouldWill | buildSettingDryRun = "would"
| otherwise = "will"
showPkg elab (ElabPackage _) = display (packageId elab)
showPkg elab (ElabComponent comp) =
display (packageId elab) ++
" (" ++ maybe "custom" display (compComponentName comp) ++ ")"
showPkgAndReason :: ElaboratedReadyPackage -> String
showPkgAndReason (ReadyPackage elab) =
display (installedUnitId elab) ++
" - " ++
(if verbosity >= verbose
then display (installedUnitId elab)
else display (packageId elab)
) ++
(case elabPkgOrComp elab of
ElabPackage pkg -> showTargets elab ++ showStanzas pkg
ElabPackage pkg -> showTargets elab ++ ifVerbose (showStanzas pkg)
ElabComponent comp ->
" (" ++ maybe "custom" display (compComponentName comp) ++ ")") ++
" (" ++ maybe "custom" display (compComponentName comp) ++ ")"
) ++
showFlagAssignment (nonDefaultFlags elab) ++
let buildStatus = pkgsBuildStatus Map.! installedUnitId elab in
" (" ++ showBuildStatus buildStatus ++ ")"
......@@ -471,7 +473,7 @@ printPlan verbosity
showTargets elab
| null (elabBuildTargets elab) = ""
| otherwise
= " (" ++ unwords [ showComponentTarget (packageId elab) t | t <- elabBuildTargets elab ]
= " (" ++ intercalate ", " [ showComponentTarget (packageId elab) t | t <- elabBuildTargets elab ]
++ ")"
-- TODO: [code cleanup] this should be a proper function in a proper place
......@@ -491,15 +493,13 @@ printPlan verbosity
BuildStatusConfigure mreason -> showMonitorChangedReason mreason
BuildStatusBuild _ buildreason -> case buildreason of
BuildReasonDepsRebuilt -> "dependency rebuilt"
BuildReasonFilesChanged
(MonitoredFileChanged _) -> "files changed"
BuildReasonFilesChanged
mreason -> showMonitorChangedReason mreason
BuildReasonExtraTargets _ -> "additional components to build"
BuildReasonEphemeralTargets -> "ephemeral targets"
BuildStatusUpToDate {} -> "up to date" -- doesn't happen
showMonitorChangedReason (MonitoredFileChanged file) = "file " ++ file
showMonitorChangedReason (MonitoredFileChanged file) = "file " ++ file ++ " changed"
showMonitorChangedReason (MonitoredValueChanged _) = "value changed"
showMonitorChangedReason MonitorFirstRun = "first run"
showMonitorChangedReason MonitorCorruptCache = "cannot read state cache"
......
Supports Markdown
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