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

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

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