Skip to content

Commit

Permalink
Improve debug logging for stack build (#2348)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjakobi authored Jul 8, 2016
1 parent b726bb5 commit 4304711
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Stack/Build.hs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ instance Exception CabalVersionException
-- | See https://github.com/commercialhaskell/stack/issues/1198.
warnIfExecutablesWithSameNameCouldBeOverwritten
:: MonadLogger m => [LocalPackage] -> Plan -> m ()
warnIfExecutablesWithSameNameCouldBeOverwritten locals plan =
warnIfExecutablesWithSameNameCouldBeOverwritten locals plan = do
$logDebug "Checking if we are going to build multiple executables with the same name"
forM_ (Map.toList warnings) $ \(exe,(toBuild,otherLocals)) -> do
let exe_s
| length toBuild > 1 = "several executables with the same name:"
Expand Down
1 change: 1 addition & 0 deletions src/Stack/Build/ConstructPlan.hs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ constructPlan :: forall env m.
-> InstalledMap
-> m Plan
constructPlan mbp0 baseConfigOpts0 locals extraToBuild0 localDumpPkgs loadPackage0 sourceMap installedMap = do
$logDebug "Constructing the build plan"
let locallyRegistered = Map.fromList $ map (dpGhcPkgId &&& dpPackageIdent) localDumpPkgs
getVersions0 <- getPackageVersionsIO

Expand Down
1 change: 1 addition & 0 deletions src/Stack/Build/Execute.hs
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ executePlan :: M env m
-> Plan
-> m ()
executePlan menv boptsCli baseConfigOpts locals globalPackages snapshotPackages localPackages installedMap targets plan = do
$logDebug "Executing the build plan"
bopts <- asks (configBuild . getConfig)
withExecuteEnv menv bopts boptsCli baseConfigOpts locals globalPackages snapshotPackages localPackages (executePlan' installedMap targets plan)

Expand Down
1 change: 1 addition & 0 deletions src/Stack/Build/Installed.hs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ getInstalled :: (M env m, PackageInstallInfo pii)
, [DumpPackage () ()] -- locally installed
)
getInstalled menv opts sourceMap = do
$logDebug "Finding out which packages are already installed"
snapDBPath <- packageDatabaseDeps
localDBPath <- packageDatabaseLocal
extraDBPaths <- packageDatabaseExtra
Expand Down
2 changes: 2 additions & 0 deletions src/Stack/Build/Source.hs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ parseTargetsFromBuildOpts
-> BuildOptsCLI
-> m (MiniBuildPlan, M.Map PackageName Version, M.Map PackageName SimpleTarget)
parseTargetsFromBuildOpts needTargets boptscli = do
$logDebug "Parsing the targets"
bconfig <- asks getBuildConfig
mbp0 <-
case bcResolver bconfig of
Expand Down Expand Up @@ -258,6 +259,7 @@ convertSnapshotToExtra snapshot extra0 locals = go Map.empty
getLocalPackageViews :: (MonadThrow m, MonadIO m, MonadReader env m, HasEnvConfig env, MonadLogger m)
=> m (Map PackageName (LocalPackageView, GenericPackageDescription))
getLocalPackageViews = do
$logDebug "Parsing the cabal files of the local packages"
econfig <- asks getEnvConfig
locals <- forM (Map.toList $ envConfigPackages econfig) $ \(dir, treatLikeExtraDep) -> do
cabalfp <- findOrGenerateCabalFile dir
Expand Down
1 change: 1 addition & 0 deletions src/main/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,7 @@ withBuildConfigExt go@GlobalOpts{..} mbefore inner mafter = do
withUserFileLock go dir $ \lk2 -> do
liftIO $ writeIORef curLk lk2
liftIO $ munlockFile lk
$logDebug "Starting to execute command inside EnvConfig"
inner lk2

let inner'' lk = do
Expand Down

0 comments on commit 4304711

Please sign in to comment.