@@ -145,7 +145,7 @@ displayTask task = T.pack $ concat
145145data ExecuteEnv = ExecuteEnv
146146 { eeEnvOverride :: ! EnvOverride
147147 , eeConfigureLock :: ! (MVar () )
148- , eeInstallLock :: ! (MVar (Int , Int ))
148+ , eeInstallLock :: ! (MVar () )
149149 , eeBuildOpts :: ! BuildOpts
150150 , eeBaseConfigOpts :: ! BaseConfigOpts
151151 , eeGhcPkgIds :: ! (TVar (Map PackageIdentifier Installed ))
@@ -167,8 +167,7 @@ executePlan menv bopts baseConfigOpts locals plan = do
167167 withSystemTempDirectory stackProgName $ \ tmpdir -> do
168168 tmpdir' <- parseAbsDir tmpdir
169169 configLock <- newMVar ()
170- installLock <-
171- newMVar (0 ,installStepCount plan)
170+ installLock <- newMVar ()
172171 idMap <- liftIO $ newTVarIO M. empty
173172 let setupHs = tmpdir' </> $ (mkRelFile " Setup.hs" )
174173 liftIO $ writeFile (toFilePath setupHs) " import Distribution.Simple\n main = defaultMain"
@@ -239,11 +238,6 @@ executePlan menv bopts baseConfigOpts locals plan = do
239238 windowsRenameCopy (toFilePath file) destFile
240239 _ -> copyFile (toFilePath file) destFile
241240
242- -- | Calculate how many actual install steps are going to happen for
243- -- the build.
244- installStepCount :: Plan -> Int
245- installStepCount = M. size . planTasks
246-
247241-- | Windows can't write over the current executable. Instead, we rename the
248242-- current executable to something else and then do the copy.
249243windowsRenameCopy :: FilePath -> FilePath -> IO ()
@@ -334,14 +328,15 @@ toActions runInBase ee (mbuild, mfinal) =
334328-- | Ensure that the configuration for the package matches what is given
335329ensureConfig :: M env m
336330 => Path Abs Dir -- ^ package directory
331+ -> ActionContext
337332 -> ExecuteEnv
338333 -> Task
339334 -> m () -- ^ announce
340335 -> (Bool -> [String ] -> m () ) -- ^ cabal
341336 -> Path Abs File -- ^ .cabal file
342337 -> [Text ]
343338 -> m (ConfigCache , Bool )
344- ensureConfig pkgDir ExecuteEnv {.. } Task {.. } announce cabal cabalfp extra = do
339+ ensureConfig pkgDir ac ExecuteEnv {.. } Task {.. } announce cabal cabalfp extra = do
345340 -- Determine the old and new configuration in the local directory, to
346341 -- determine if we need to reconfigure.
347342 mOldConfigCache <- tryGetConfigCache pkgDir
@@ -368,8 +363,8 @@ ensureConfig pkgDir ExecuteEnv {..} Task {..} announce cabal cabalfp extra = do
368363 || mOldCabalMod /= Just newCabalMod
369364 when needConfig $ withMVar eeConfigureLock $ \ _ -> do
370365 deleteCaches pkgDir
371- withMVar eeInstallLock $ \ (done,total ) ->
372- $ logSticky (" Progress: " <> T. pack (show done) <> " /" <> T. pack (show total ))
366+ withMVar eeInstallLock $ \ () ->
367+ $ logSticky (" Progress: " <> T. pack (show (acCompleted ac)) <> " /" <> T. pack (show (acTotalActions ac) ))
373368 announce
374369 cabal False $ " configure" : map T. unpack configOpts
375370 $ logDebug $ T. pack $ show configOpts
@@ -511,7 +506,7 @@ singleBuild :: M env m
511506 -> m ()
512507singleBuild ac@ ActionContext {.. } ee@ ExecuteEnv {.. } task@ Task {.. } =
513508 withSingleContext ac ee task $ \ package cabalfp pkgDir cabal announce console _mlogFile -> do
514- (cache, _neededConfig) <- ensureConfig pkgDir ee task (announce " configure" ) cabal cabalfp []
509+ (cache, _neededConfig) <- ensureConfig pkgDir ac ee task (announce " configure" ) cabal cabalfp []
515510
516511 fileModTimes <- getPackageFileModTimes package cabalfp
517512 writeBuildCache pkgDir fileModTimes
@@ -520,15 +515,14 @@ singleBuild ac@ActionContext {..} ee@ExecuteEnv {..} task@Task {..} =
520515 config <- asks getConfig
521516 cabal (console && configHideTHLoading config) [" build" ]
522517
523- modifyMVar_ eeInstallLock $ \ (done,total ) -> do
518+ withMVar eeInstallLock $ \ () -> do
524519 announce " install"
525520 cabal False [" install" ]
526- unless (total == 1 ) $ do
527- let done' = done + 1
528- $ logSticky (" Progress: " <> T. pack (show done') <> " /" <> T. pack (show total))
529- when (done' == total)
530- ($ logStickyDone (" Completed all " <> T. pack (show total) <> " packages." ))
531- return (done + 1 ,total)
521+ unless (acTotalActions == 1 ) $ do
522+ let done' = acCompleted + 1
523+ $ logSticky (" Progress: " <> T. pack (show done') <> " /" <> T. pack (show acTotalActions))
524+ when (done' == acTotalActions)
525+ ($ logStickyDone (" Completed all " <> T. pack (show acTotalActions) <> " packages." ))
532526
533527 let pkgDbs =
534528 case taskLocation task of
@@ -557,7 +551,7 @@ singleTest :: M env m
557551singleTest ac ee task =
558552 withSingleContext ac ee task $ \ package cabalfp pkgDir cabal announce console mlogFile ->
559553 unless (Set. null $ packageTests package) $ do
560- (_cache, neededConfig) <- ensureConfig pkgDir ee task (announce " configure (test)" ) cabal cabalfp [" --enable-tests" ]
554+ (_cache, neededConfig) <- ensureConfig pkgDir ac ee task (announce " configure (test)" ) cabal cabalfp [" --enable-tests" ]
561555 config <- asks getConfig
562556
563557 let needBuild = neededConfig ||
@@ -630,7 +624,7 @@ singleBench :: M env m
630624singleBench ac ee task =
631625 withSingleContext ac ee task $ \ package cabalfp pkgDir cabal announce console _mlogFile ->
632626 unless (Set. null $ packageBenchmarks package) $ do
633- (_cache, neededConfig) <- ensureConfig pkgDir ee task (announce " configure (benchmarks)" ) cabal cabalfp [" --enable-benchmarks" ]
627+ (_cache, neededConfig) <- ensureConfig pkgDir ac ee task (announce " configure (benchmarks)" ) cabal cabalfp [" --enable-benchmarks" ]
634628
635629 let needBuild = neededConfig ||
636630 (case taskType task of
0 commit comments