Skip to content

Commit

Permalink
cabal-validate: Hide build plan unless --verbose
Browse files Browse the repository at this point in the history
Hide the build plan (listing of local packages and transitive
dependencies) unless `--verbose` is given.
  • Loading branch information
9999years authored and Mikolaj committed Dec 13, 2024
1 parent c25983a commit ac29d59
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions cabal-validate/src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ac29d59

Please sign in to comment.