[Git][ghc/ghc][wip/andreask/hadrian_progress] Adjust progress message for hadrian to include cwd.

Andreas Klebinger (@AndreasK) gitlab at gitlab.haskell.org
Thu Oct 3 13:14:53 UTC 2024



Andreas Klebinger pushed to branch wip/andreask/hadrian_progress at Glasgow Haskell Compiler / GHC


Commits:
0080bed0 by Andreas Klebinger at 2024-10-03T14:55:34+02:00
Adjust progress message for hadrian to include cwd.

Fixes #25335

- - - - -


3 changed files:

- hadrian/hadrian.cabal
- hadrian/src/Main.hs
- + hadrian/src/Progress.hs


Changes:

=====================================
hadrian/hadrian.cabal
=====================================
@@ -74,6 +74,7 @@ executable hadrian
                        , Oracles.ModuleFiles
                        , Oracles.TestSettings
                        , Packages
+                       , Progress
                        , Rules
                        , Rules.BinaryDist
                        , Rules.CabalReinstall


=====================================
hadrian/src/Main.hs
=====================================
@@ -27,6 +27,7 @@ import qualified Rules.Selftest
 import qualified Rules.SourceDist
 import qualified Rules.Test
 import qualified UserSettings
+import qualified Progress
 
 main :: IO ()
 main = do
@@ -56,7 +57,7 @@ main = do
         options = shakeOptions
             { shakeChange   = ChangeModtimeAndDigest
             , shakeFiles    = buildRoot -/- Base.shakeFilesDir
-            , shakeProgress = progressSimple
+            , shakeProgress = Progress.hadrianProgress (cwd -/- "hadrian > " <> buildRoot <> ":")
             , shakeRebuild  = rebuild
             , shakeTimings  = False
             , shakeColor    = shakeColor


=====================================
hadrian/src/Progress.hs
=====================================
@@ -0,0 +1,14 @@
+module Progress (hadrianProgress) where
+
+import Development.Shake
+
+-- | A simple method for displaying progress messages, suitable for using as 'Development.Shake.shakeProgress'.
+--   This is the shakeProgress function hadrian uses. It writes the current progress to the titlebar every five seconds
+--   using 'progressTitlebar', and calls any @shake-progress@ program on the @$PATH@ using 'progressProgram'.
+--
+-- Unlike the default shake progress bar it includes a prefix for the status bar.
+hadrianProgress :: String -> IO Progress -> IO ()
+hadrianProgress prefix p = do
+    program <- progressProgram
+    progressDisplay 5 (\status -> let s = prefix <> status in progressTitlebar s >> program s) p
+



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0080bed0bc6ee4f2f0714c214bee42131f023f11

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0080bed0bc6ee4f2f0714c214bee42131f023f11
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20241003/d7601c8f/attachment-0001.html>


More information about the ghc-commits mailing list