From ac29d59c76462c5c940fe3dad4a29007b46bfb89 Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Wed, 20 Nov 2024 12:17:56 -0800 Subject: [PATCH] cabal-validate: Hide build plan unless `--verbose` Hide the build plan (listing of local packages and transitive dependencies) unless `--verbose` is given. --- cabal-validate/src/Main.hs | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/cabal-validate/src/Main.hs b/cabal-validate/src/Main.hs index 09b00b2f8cd..e506448a940 100644 --- a/cabal-validate/src/Main.hs +++ b/cabal-validate/src/Main.hs @@ -173,24 +173,25 @@ printToolVersions opts = -- | Run the build step. build :: Opts -> IO () build opts = do - printHeader "build (dry run)" - timed - opts - (cabal opts) - ( cabalNewBuildArgs opts - ++ targets opts - ++ ["--dry-run"] - ) - - printHeader "build (full build plan; cached and to-be-built dependencies)" - timed - opts - "jq" - [ "-r" - , -- TODO: Maybe use `cabal-plan`? It's a heavy dependency though... - ".\"install-plan\" | map(.\"pkg-name\" + \"-\" + .\"pkg-version\" + \" \" + .\"component-name\") | join(\"\n\")" - , baseBuildDir opts "cache" "plan.json" - ] + when (verbose opts) $ do + printHeader "build (dry run)" + timed + opts + (cabal opts) + ( cabalNewBuildArgs opts + ++ targets opts + ++ ["--dry-run"] + ) + + printHeader "build (full build plan; cached and to-be-built dependencies)" + timed + opts + "jq" + [ "-r" + , -- TODO: Maybe use `cabal-plan`? It's a heavy dependency though... + ".\"install-plan\" | map(.\"pkg-name\" + \"-\" + .\"pkg-version\" + \" \" + .\"component-name\") | join(\"\n\")" + , baseBuildDir opts "cache" "plan.json" + ] printHeader "build (actual build)" timed