Commit 667d1a2c authored by Mikhail Glushenkov's avatar Mikhail Glushenkov

Remove duplicated '--verbose' and '--builddir' options.

Fixes #1714.
parent 1d8bb71e
......@@ -1380,8 +1380,17 @@ defaultBuildFlags = BuildFlags {
}
buildCommand :: ProgramConfiguration -> CommandUI BuildFlags
buildCommand progConf = makeCommand name shortDesc longDesc
defaultBuildFlags (buildOptions progConf)
buildCommand progConf =
makeCommand name shortDesc longDesc
defaultBuildFlags
(\showOrParseArgs ->
[ optionVerbosity
buildVerbosity (\v flags -> flags { buildVerbosity = v })
, optionDistPref
buildDistPref (\d flags -> flags { buildDistPref = d }) showOrParseArgs
]
++ buildOptions progConf showOrParseArgs)
where
name = "build"
shortDesc = "Compile all targets or specific targets."
......@@ -1390,7 +1399,8 @@ buildCommand progConf = makeCommand name shortDesc longDesc
++ " " ++ pname ++ " build "
++ " All the components in the package\n"
++ " " ++ pname ++ " build foo "
++ " A component (i.e. lib, exe, test suite)\n"
++ " A component (i.e. lib, exe, test suite)\n\n"
++ programFlagsDescription progConf
--TODO: re-enable once we have support for module/file targets
-- ++ " " ++ pname ++ " build Foo.Bar "
-- ++ " A module\n"
......@@ -1404,13 +1414,7 @@ buildCommand progConf = makeCommand name shortDesc longDesc
buildOptions :: ProgramConfiguration -> ShowOrParseArgs
-> [OptionField BuildFlags]
buildOptions progConf showOrParseArgs =
[ optionVerbosity
buildVerbosity (\v flags -> flags { buildVerbosity = v })
, optionDistPref
buildDistPref (\d flags -> flags { buildDistPref = d }) showOrParseArgs
, optionNumJobs
[ optionNumJobs
buildNumJobs (\v flags -> flags { buildNumJobs = v })
]
......
......@@ -647,7 +647,7 @@ runCommand = CommandUI {
commandDefaultFlags = mempty,
commandOptions =
\showOrParseArgs -> liftOptions fst setFst
(Cabal.buildOptions progConf showOrParseArgs)
(commandOptions parent showOrParseArgs)
++
liftOptions snd setSnd
(buildExOptions showOrParseArgs)
......@@ -656,7 +656,7 @@ runCommand = CommandUI {
setFst a (_,b) = (a,b)
setSnd b (a,_) = (a,b)
progConf = defaultProgramConfiguration
parent = Cabal.buildCommand defaultProgramConfiguration
-- ------------------------------------------------------------
-- * Report flags
......
......@@ -672,6 +672,8 @@ testAction (testFlags, buildFlags, buildExFlags) extraArgs globalFlags = do
distPref = fromFlagOrDefault (useDistPref defaultSetupScriptOptions)
(testDistPref testFlags)
setupOptions = defaultSetupScriptOptions { useDistPref = distPref }
buildFlags' = buildFlags { buildVerbosity = testVerbosity testFlags
, buildDistPref = testDistPref testFlags }
addConfigFlags = mempty { configTests = toFlag True }
checkFlags flags
| fromFlagOrDefault False (configTests flags) = Nothing
......@@ -683,10 +685,10 @@ testAction (testFlags, buildFlags, buildExFlags) extraArgs globalFlags = do
-- deps if needed.
(useSandbox, config) <- reconfigure verbosity distPref addConfigFlags []
globalFlags noAddSource
(buildNumJobs buildFlags) checkFlags
(buildNumJobs buildFlags') checkFlags
maybeWithSandboxDirOnSearchPath useSandbox $
build verbosity config distPref buildFlags extraArgs
build verbosity config distPref buildFlags' extraArgs
maybeWithSandboxDirOnSearchPath useSandbox $
setupWrapper verbosity setupOptions Nothing
......@@ -702,6 +704,9 @@ benchmarkAction (benchmarkFlags, buildFlags, buildExFlags)
distPref = fromFlagOrDefault (useDistPref defaultSetupScriptOptions)
(benchmarkDistPref benchmarkFlags)
setupOptions = defaultSetupScriptOptions { useDistPref = distPref }
buildFlags' = buildFlags
{ buildVerbosity = benchmarkVerbosity benchmarkFlags
, buildDistPref = benchmarkDistPref benchmarkFlags }
addConfigFlags = mempty { configBenchmarks = toFlag True }
checkFlags flags
| fromFlagOrDefault False (configBenchmarks flags) = Nothing
......@@ -712,11 +717,11 @@ benchmarkAction (benchmarkFlags, buildFlags, buildExFlags)
-- reconfigure also checks if we're in a sandbox and reinstalls add-source
-- deps if needed.
(useSandbox, config) <- reconfigure verbosity distPref addConfigFlags []
globalFlags noAddSource (buildNumJobs buildFlags)
globalFlags noAddSource (buildNumJobs buildFlags')
checkFlags
maybeWithSandboxDirOnSearchPath useSandbox $
build verbosity config distPref buildFlags extraArgs
build verbosity config distPref buildFlags' extraArgs
maybeWithSandboxDirOnSearchPath useSandbox $
setupWrapper verbosity setupOptions Nothing
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment