From 4304711d91f41a137931502ac4b1d00b3a4bc842 Mon Sep 17 00:00:00 2001 From: Simon Jakobi Date: Fri, 8 Jul 2016 06:54:46 +0200 Subject: [PATCH] Improve debug logging for `stack build` (#2348) --- src/Stack/Build.hs | 3 ++- src/Stack/Build/ConstructPlan.hs | 1 + src/Stack/Build/Execute.hs | 1 + src/Stack/Build/Installed.hs | 1 + src/Stack/Build/Source.hs | 2 ++ src/main/Main.hs | 1 + 6 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Stack/Build.hs b/src/Stack/Build.hs index 8316b7d072..c0ef63b354 100644 --- a/src/Stack/Build.hs +++ b/src/Stack/Build.hs @@ -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:" diff --git a/src/Stack/Build/ConstructPlan.hs b/src/Stack/Build/ConstructPlan.hs index 8f189bcbf5..c73eec2920 100644 --- a/src/Stack/Build/ConstructPlan.hs +++ b/src/Stack/Build/ConstructPlan.hs @@ -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 diff --git a/src/Stack/Build/Execute.hs b/src/Stack/Build/Execute.hs index a84822ec39..fa180120d9 100644 --- a/src/Stack/Build/Execute.hs +++ b/src/Stack/Build/Execute.hs @@ -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) diff --git a/src/Stack/Build/Installed.hs b/src/Stack/Build/Installed.hs index ad4112f6af..cc812a29dc 100644 --- a/src/Stack/Build/Installed.hs +++ b/src/Stack/Build/Installed.hs @@ -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 diff --git a/src/Stack/Build/Source.hs b/src/Stack/Build/Source.hs index 89fa747166..fce427b6cc 100644 --- a/src/Stack/Build/Source.hs +++ b/src/Stack/Build/Source.hs @@ -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 @@ -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 diff --git a/src/main/Main.hs b/src/main/Main.hs index 4792892f78..1c41a8bf4d 100644 --- a/src/main/Main.hs +++ b/src/main/Main.hs @@ -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