From df19e008d1a2e08594f5d1586546eac214a3e367 Mon Sep 17 00:00:00 2001 From: Andrei Dziahel Date: Fri, 12 Jan 2018 17:56:35 +0300 Subject: [PATCH 1/3] Report currently building packages along with "Progress:" label Rationale: make user feel more "in control" when waiting for these tens to hundreds of packages to be built by providing information on what is going on *right now*. --- src/Control/Concurrent/Execute.hs | 4 ++-- src/Stack/Build/Execute.hs | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Control/Concurrent/Execute.hs b/src/Control/Concurrent/Execute.hs index 2a10662d1a..97439b17bb 100644 --- a/src/Control/Concurrent/Execute.hs +++ b/src/Control/Concurrent/Execute.hs @@ -73,7 +73,7 @@ instance Show ExecuteException where runActions :: Int -- ^ threads -> Bool -- ^ keep going after one task has failed -> [Action] - -> (TVar Int -> IO ()) -- ^ progress updated + -> (TVar Int -> TVar (Set ActionId) -> IO ()) -- ^ progress updated -> IO [SomeException] runActions threads keepGoing actions0 withProgress = do es <- ExecuteState @@ -82,7 +82,7 @@ runActions threads keepGoing actions0 withProgress = do <*> newTVarIO Set.empty <*> newTVarIO 0 <*> pure keepGoing - _ <- async $ withProgress $ esCompleted es + _ <- async $ withProgress (esCompleted es) (esInAction es) if threads <= 1 then runActions' es else replicateConcurrently_ threads $ runActions' es diff --git a/src/Stack/Build/Execute.hs b/src/Stack/Build/Execute.hs index 789e8f1a3f..d2487f2cc3 100644 --- a/src/Stack/Build/Execute.hs +++ b/src/Stack/Build/Execute.hs @@ -628,14 +628,20 @@ executePlan' installedMap0 targets plan ee@ExecuteEnv {..} = do let keepGoing = fromMaybe (not (M.null (planFinals plan))) (boptsKeepGoing eeBuildOpts) terminal <- view terminalL - errs <- liftIO $ runActions threads keepGoing actions $ \doneVar -> do + errs <- liftIO $ runActions threads keepGoing actions $ \doneVar actionsVar -> do let total = length actions loop prev | prev == total = run $ logStickyDone ("Completed " <> T.pack (show total) <> " action(s).") | otherwise = do + inProgress <- readTVarIO actionsVar + let packageNames = map (\(ActionId pkgID _) -> packageIdentifierText pkgID) (toList inProgress) + nowBuilding [] = "" + nowBuilding names = "; [" <> T.intercalate "|" names <> "]" when terminal $ run $ - logSticky ("Progress: " <> T.pack (show prev) <> "/" <> T.pack (show total)) + logSticky $ + "Progress: " <> T.pack (show prev) <> "/" <> T.pack (show total) <> + nowBuilding packageNames done <- atomically $ do done <- readTVar doneVar check $ done /= prev From 9171d527dafaadc0c46343af055683799f25c575 Mon Sep 17 00:00:00 2001 From: Andrei Dziahel Date: Fri, 12 Jan 2018 18:01:41 +0300 Subject: [PATCH 2/3] Update changelog --- ChangeLog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog.md b/ChangeLog.md index 6eb5cf0e40..d23ec3eadd 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -29,6 +29,7 @@ Other enhancements: relevant on Linux where different distributions may have different combinations of libtinfo 5/6, ncurses 5/6, and gmp 4/5, and will allow simpifying the setup-info metadata YAML for future GHC releases. +* The build progress bar reports names of packages currently building. * `stack setup --verbose` causes verbose output of GHC configure process. See [#3716](https://github.com/commercialhaskell/stack/issues/3716) From 5797d3eb6478d84d47eb6e7843fcdea19df0cf70 Mon Sep 17 00:00:00 2001 From: Andrei Dziahel Date: Sun, 14 Jan 2018 16:52:16 +0300 Subject: [PATCH 3/3] Tweak currently building packages report format Following up a review by @mgsloan --- src/Stack/Build/Execute.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Stack/Build/Execute.hs b/src/Stack/Build/Execute.hs index d2487f2cc3..8bc3f7647e 100644 --- a/src/Stack/Build/Execute.hs +++ b/src/Stack/Build/Execute.hs @@ -637,10 +637,10 @@ executePlan' installedMap0 targets plan ee@ExecuteEnv {..} = do inProgress <- readTVarIO actionsVar let packageNames = map (\(ActionId pkgID _) -> packageIdentifierText pkgID) (toList inProgress) nowBuilding [] = "" - nowBuilding names = "; [" <> T.intercalate "|" names <> "]" + nowBuilding names = ": " <> T.intercalate ", " names when terminal $ run $ logSticky $ - "Progress: " <> T.pack (show prev) <> "/" <> T.pack (show total) <> + "Progress " <> T.pack (show prev) <> "/" <> T.pack (show total) <> nowBuilding packageNames done <- atomically $ do done <- readTVar doneVar