Skip to content

Commit a5d1c63

Browse files
committed
feat(cabal-install): more logging in buildAndRegisterUnpackedPackage
More logging in ProjectBuilding
1 parent 99c1369 commit a5d1c63

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
@@ -540,7 +540,8 @@ rebuildTarget
540540
void $ waitAsyncPackageDownload verbosity downloadMap pkg
541541
_ -> return ()
542542
return $ BuildResult DocsNotTried TestsNotTried Nothing
543-
| otherwise =
543+
| otherwise = do
544+
info verbosity $ "[rebuildTarget] Rebuilding " ++ prettyShow (nodeKey pkg) ++ " with current status " ++ buildStatusToString pkgBuildStatus
544545
-- We rely on the 'BuildStatus' to decide which phase to start from:
545546
case pkgBuildStatus of
546547
BuildStatusDownload -> downloadPhase
@@ -583,7 +584,8 @@ rebuildTarget
583584
-- would only start from download or unpack phases.
584585
--
585586
rebuildPhase :: BuildStatusRebuild -> SymbolicPath CWD (Dir Pkg) -> IO BuildResult
586-
rebuildPhase buildStatus srcdir =
587+
rebuildPhase buildStatus srcdir = do
588+
info verbosity $ "[rebuildPhase] Rebuilding " ++ prettyShow (nodeKey pkg) ++ " in " ++ prettyShow srcdir
587589
assert
588590
(isInplaceBuildStyle $ elabBuildStyle pkg)
589591
buildInplace
@@ -598,7 +600,8 @@ rebuildTarget
598600
-- TODO: [nice to have] ^^ do this relative stuff better
599601

600602
buildAndInstall :: SymbolicPath CWD (Dir Pkg) -> SymbolicPath Pkg (Dir Dist) -> IO BuildResult
601-
buildAndInstall srcdir builddir =
603+
buildAndInstall srcdir builddir = do
604+
info verbosity $ "[buildAndInstall] Building and installing " ++ prettyShow (nodeKey pkg) ++ " in " ++ prettyShow srcdir
602605
buildAndInstallUnpackedPackage
603606
verbosity
604607
distDirLayout
@@ -614,8 +617,9 @@ rebuildTarget
614617
builddir
615618

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

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

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

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

121122
-- | Each unpacked package is processed in the following phases:
122123
--
@@ -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)