@@ -7,7 +7,7 @@ module Main
7
7
, runStep
8
8
) where
9
9
10
- import Control.Monad (forM_ )
10
+ import Control.Monad (forM_ , when )
11
11
import qualified Data.Text as T
12
12
import qualified Data.Text.IO as T
13
13
import qualified Data.Text.Lazy as T (toStrict )
@@ -16,9 +16,7 @@ import Data.Version (makeVersion, showVersion)
16
16
import System.FilePath ((</>) )
17
17
import System.Process.Typed (proc , readProcessStdout_ )
18
18
19
- import ANSI (SGR (Bold , BrightCyan , Reset ), setSGR )
20
19
import Cli (Compiler (.. ), HackageTests (.. ), Opts (.. ), parseOpts )
21
- import ClockUtil (diffAbsoluteTime , formatDiffTime , getAbsoluteTime )
22
20
import OutputUtil (printHeader , withTiming )
23
21
import ProcessUtil (timed , timedWithCwd )
24
22
import Step (Step (.. ), displayStep )
@@ -27,6 +25,8 @@ import Step (Step (..), displayStep)
27
25
main :: IO ()
28
26
main = do
29
27
opts <- parseOpts
28
+ printConfig opts
29
+ printToolVersions opts
30
30
forM_ (steps opts) $ \ step -> do
31
31
runStep opts step
32
32
@@ -36,8 +36,6 @@ runStep opts step = do
36
36
let title = displayStep step
37
37
printHeader title
38
38
let action = case step of
39
- PrintConfig -> printConfig opts
40
- PrintToolVersions -> printToolVersions opts
41
39
Build -> build opts
42
40
Doctest -> doctest opts
43
41
LibTests -> libTests opts
@@ -47,7 +45,6 @@ runStep opts step = do
47
45
CliTests -> cliTests opts
48
46
SolverBenchmarksTests -> solverBenchmarksTests opts
49
47
SolverBenchmarksRun -> solverBenchmarksRun opts
50
- TimeSummary -> timeSummary opts
51
48
withTiming (startTime opts) title action
52
49
T. putStrLn " "
53
50
@@ -139,35 +136,37 @@ timedCabalBin opts package component args = do
139
136
140
137
-- | Print the configuration for CI logs.
141
138
printConfig :: Opts -> IO ()
142
- printConfig opts = do
143
- putStr $
144
- unlines
145
- [ " compiler: "
146
- <> compilerExecutable (compiler opts)
147
- , " cabal-install: "
148
- <> cabal opts
149
- , " jobs: "
150
- <> show (jobs opts)
151
- , " steps: "
152
- <> unwords (map displayStep (steps opts))
153
- , " Hackage tests: "
154
- <> show (hackageTests opts)
155
- , " verbose: "
156
- <> show (verbose opts)
157
- , " extra compilers: "
158
- <> unwords (extraCompilers opts)
159
- , " extra RTS options: "
160
- <> unwords (rtsArgs opts)
161
- ]
139
+ printConfig opts =
140
+ when (verbose opts) $
141
+ putStr $
142
+ unlines
143
+ [ " compiler: "
144
+ <> compilerExecutable (compiler opts)
145
+ , " cabal-install: "
146
+ <> cabal opts
147
+ , " jobs: "
148
+ <> show (jobs opts)
149
+ , " steps: "
150
+ <> unwords (map displayStep (steps opts))
151
+ , " Hackage tests: "
152
+ <> show (hackageTests opts)
153
+ , " verbose: "
154
+ <> show (verbose opts)
155
+ , " extra compilers: "
156
+ <> unwords (extraCompilers opts)
157
+ , " extra RTS options: "
158
+ <> unwords (rtsArgs opts)
159
+ ]
162
160
163
161
-- | Print the versions of tools being used.
164
162
printToolVersions :: Opts -> IO ()
165
- printToolVersions opts = do
166
- timed opts (compilerExecutable (compiler opts)) [" --version" ]
167
- timed opts (cabal opts) [" --version" ]
163
+ printToolVersions opts =
164
+ when (verbose opts) $ do
165
+ timed opts (cabal opts) [" --version" ]
166
+ timed opts (compilerExecutable (compiler opts)) [" --version" ]
168
167
169
- forM_ (extraCompilers opts) $ \ compiler' -> do
170
- timed opts compiler' [" --version" ]
168
+ forM_ (extraCompilers opts) $ \ compiler' -> do
169
+ timed opts compiler' [" --version" ]
171
170
172
171
-- | Run the build step.
173
172
build :: Opts -> IO ()
@@ -412,14 +411,3 @@ solverBenchmarksRun opts = do
412
411
, " --packages=Chart-diagrams"
413
412
, " --print-trials"
414
413
]
415
-
416
- -- | Print the total time taken so far.
417
- timeSummary :: Opts -> IO ()
418
- timeSummary opts = do
419
- endTime <- getAbsoluteTime
420
- let totalDuration = diffAbsoluteTime endTime (startTime opts)
421
- putStrLn $
422
- setSGR [Bold , BrightCyan ]
423
- <> " !!! Validation completed in "
424
- <> formatDiffTime totalDuration
425
- <> setSGR [Reset ]
0 commit comments