Skip to content

Commit 9b631dd

Browse files
committed
feat(cabal-install): more logging in buildAndRegisterUnpackedPackage
More logging in ProjectBuilding
1 parent e1f578c commit 9b631dd

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

cabal-install/src/Distribution/Client/ProjectBuilding.hs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,8 @@ rebuildTarget
542542
void $ waitAsyncPackageDownload verbosity downloadMap pkg
543543
_ -> return ()
544544
return $ BuildResult DocsNotTried TestsNotTried Nothing
545-
| otherwise =
545+
| otherwise = do
546+
info verbosity $ "[rebuildTarget] Rebuilding " ++ prettyShow (nodeKey pkg) ++ " with current status " ++ buildStatusToString pkgBuildStatus
546547
-- We rely on the 'BuildStatus' to decide which phase to start from:
547548
case pkgBuildStatus of
548549
BuildStatusDownload -> downloadPhase
@@ -585,7 +586,8 @@ rebuildTarget
585586
-- would only start from download or unpack phases.
586587
--
587588
rebuildPhase :: BuildStatusRebuild -> SymbolicPath CWD (Dir Pkg) -> IO BuildResult
588-
rebuildPhase buildStatus srcdir =
589+
rebuildPhase buildStatus srcdir = do
590+
info verbosity $ "[rebuildPhase] Rebuilding " ++ prettyShow (nodeKey pkg) ++ " in " ++ prettyShow srcdir
589591
assert
590592
(isInplaceBuildStyle $ elabBuildStyle pkg)
591593
buildInplace
@@ -600,7 +602,8 @@ rebuildTarget
600602
-- TODO: [nice to have] ^^ do this relative stuff better
601603

602604
buildAndInstall :: SymbolicPath CWD (Dir Pkg) -> SymbolicPath Pkg (Dir Dist) -> IO BuildResult
603-
buildAndInstall srcdir builddir =
605+
buildAndInstall srcdir builddir = do
606+
info verbosity $ "[buildAndInstall] Building and installing " ++ prettyShow (nodeKey pkg) ++ " in " ++ prettyShow srcdir
604607
buildAndInstallUnpackedPackage
605608
verbosity
606609
distDirLayout
@@ -616,8 +619,9 @@ rebuildTarget
616619
builddir
617620

618621
buildInplace :: BuildStatusRebuild -> SymbolicPath CWD (Dir Pkg) -> SymbolicPath Pkg (Dir Dist) -> IO BuildResult
619-
buildInplace buildStatus srcdir builddir =
622+
buildInplace buildStatus srcdir builddir = do
620623
-- TODO: [nice to have] use a relative build dir rather than absolute
624+
info verbosity $ "[buildInplace] Building inplace " ++ prettyShow (nodeKey pkg) ++ " in " ++ prettyShow srcdir
621625
buildInplaceUnpackedPackage
622626
verbosity
623627
distDirLayout

cabal-install/src/Distribution/Client/ProjectBuilding/UnpackedPackage.hs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ import Distribution.Client.Errors
116116
import Distribution.Compat.Directory (listDirectory)
117117

118118
import Distribution.Client.ProjectBuilding.PackageFileMonitor
119+
import qualified Distribution.Compat.Graph as Graph
119120
import Distribution.System (Platform (..))
120121

121122
-- | Each unpacked package is processed in the following phases:
@@ -184,33 +185,39 @@ buildAndRegisterUnpackedPackage
184185
builddir
185186
mlogFile
186187
delegate = do
188+
info verbosity $ "\n\nbuildAndRegisterUnpackedPackage: " ++ prettyShow (Graph.nodeKey pkg)
187189
-- Configure phase
188190
delegate $
189191
PBConfigurePhase $
190-
annotateFailure mlogFile ConfigureFailed $
192+
annotateFailure mlogFile ConfigureFailed $ do
193+
info verbosity $ "--- Configure phase " ++ prettyShow (Graph.nodeKey pkg)
191194
setup configureCommand Cabal.configCommonFlags configureFlags configureArgs
192195

193196
-- Build phase
194197
delegate $
195198
PBBuildPhase $
196199
annotateFailure mlogFile BuildFailed $ do
200+
info verbosity $ "--- Build phase " ++ prettyShow (Graph.nodeKey pkg)
197201
setup buildCommand Cabal.buildCommonFlags (return . buildFlags) buildArgs
198202

199203
-- Haddock phase
200204
whenHaddock $
201205
delegate $
202206
PBHaddockPhase $
203207
annotateFailure mlogFile HaddocksFailed $ do
208+
info verbosity $ "--- Haddock phase " ++ prettyShow (Graph.nodeKey pkg)
204209
setup haddockCommand Cabal.haddockCommonFlags (return . haddockFlags) haddockArgs
205210

206211
-- Install phase
207212
delegate $
208213
PBInstallPhase
209214
{ runCopy = \destdir ->
210-
annotateFailure mlogFile InstallFailed $
215+
annotateFailure mlogFile InstallFailed $ do
216+
info verbosity $ "--- Install phase, copy " ++ prettyShow (Graph.nodeKey pkg)
211217
setup Cabal.copyCommand Cabal.copyCommonFlags (return . copyFlags destdir) copyArgs
212218
, runRegister = \pkgDBStack registerOpts ->
213219
annotateFailure mlogFile InstallFailed $ do
220+
info verbosity $ "--- Install phase, register " ++ prettyShow (Graph.nodeKey pkg)
214221
-- We register ourselves rather than via Setup.hs. We need to
215222
-- grab and modify the InstalledPackageInfo. We decide what
216223
-- the installed package id is, not the build system.
@@ -232,21 +239,24 @@ buildAndRegisterUnpackedPackage
232239
whenTest $
233240
delegate $
234241
PBTestPhase $
235-
annotateFailure mlogFile TestsFailed $
242+
annotateFailure mlogFile TestsFailed $ do
243+
info verbosity $ "--- Test phase " ++ prettyShow (Graph.nodeKey pkg)
236244
setup testCommand Cabal.testCommonFlags (return . testFlags) testArgs
237245

238246
-- Bench phase
239247
whenBench $
240248
delegate $
241249
PBBenchPhase $
242-
annotateFailure mlogFile BenchFailed $
250+
annotateFailure mlogFile BenchFailed $ do
251+
info verbosity $ "--- Benchmark phase " ++ prettyShow (Graph.nodeKey pkg)
243252
setup benchCommand Cabal.benchmarkCommonFlags (return . benchFlags) benchArgs
244253

245254
-- Repl phase
246255
whenRepl $
247256
delegate $
248257
PBReplPhase $
249-
annotateFailure mlogFile ReplFailed $
258+
annotateFailure mlogFile ReplFailed $ do
259+
info verbosity $ "--- Repl phase " ++ prettyShow (Graph.nodeKey pkg)
250260
setupInteractive replCommand Cabal.replCommonFlags replFlags replArgs
251261

252262
return ()

0 commit comments

Comments
 (0)