Commit 0810c590 authored by Ryan Scott's avatar Ryan Scott

Implement --benchmark-options for v2-bench

This implements lots of plumbing to allow the `--benchmark-option(s)`
flags to be used with `v2-bench`, analgous to `v2-test`'s
`--test-option(s)` flag.

Fixes #6209.
parent 57c95125
......@@ -57,7 +57,8 @@ module Distribution.Simple.Setup (
defaultBenchmarkFlags, benchmarkCommand,
CopyDest(..),
configureArgs, configureOptions, configureCCompiler, configureLinker,
buildOptions, haddockOptions, installDirsOptions, testOptions',
buildOptions, haddockOptions, installDirsOptions,
testOptions', benchmarkOptions',
programDbOptions, programDbPaths',
programFlagsDescription,
replOptions,
......@@ -2026,30 +2027,33 @@ benchmarkCommand = CommandUI
, "BENCHCOMPONENTS [FLAGS]"
]
, commandDefaultFlags = defaultBenchmarkFlags
, commandOptions = \showOrParseArgs ->
[ optionVerbosity benchmarkVerbosity
(\v flags -> flags { benchmarkVerbosity = v })
, optionDistPref
benchmarkDistPref (\d flags -> flags { benchmarkDistPref = d })
showOrParseArgs
, option [] ["benchmark-options"]
("give extra options to benchmark executables "
++ "(name templates can use $pkgid, $compiler, "
++ "$os, $arch, $benchmark)")
benchmarkOptions (\v flags -> flags { benchmarkOptions = v })
(reqArg' "TEMPLATES" (map toPathTemplate . splitArgs)
(const []))
, option [] ["benchmark-option"]
("give extra option to benchmark executables "
++ "(no need to quote options containing spaces, "
++ "name template can use $pkgid, $compiler, "
++ "$os, $arch, $benchmark)")
benchmarkOptions (\v flags -> flags { benchmarkOptions = v })
(reqArg' "TEMPLATE" (\x -> [toPathTemplate x])
(map fromPathTemplate))
]
, commandOptions = benchmarkOptions'
}
benchmarkOptions' :: ShowOrParseArgs -> [OptionField BenchmarkFlags]
benchmarkOptions' showOrParseArgs =
[ optionVerbosity benchmarkVerbosity
(\v flags -> flags { benchmarkVerbosity = v })
, optionDistPref
benchmarkDistPref (\d flags -> flags { benchmarkDistPref = d })
showOrParseArgs
, option [] ["benchmark-options"]
("give extra options to benchmark executables "
++ "(name templates can use $pkgid, $compiler, "
++ "$os, $arch, $benchmark)")
benchmarkOptions (\v flags -> flags { benchmarkOptions = v })
(reqArg' "TEMPLATES" (map toPathTemplate . splitArgs)
(const []))
, option [] ["benchmark-option"]
("give extra option to benchmark executables "
++ "(no need to quote options containing spaces, "
++ "name template can use $pkgid, $compiler, "
++ "$os, $arch, $benchmark)")
benchmarkOptions (\v flags -> flags { benchmarkOptions = v })
(reqArg' "TEMPLATE" (\x -> [toPathTemplate x])
(map fromPathTemplate))
]
emptyBenchmarkFlags :: BenchmarkFlags
emptyBenchmarkFlags = mempty
......
......@@ -1672,6 +1672,8 @@ This command takes the following options:
Keeps the configuration information so it is not necessary to run
the configure step again before building.
.. _setup-test:
setup test
----------
......@@ -1716,7 +1718,7 @@ the package.
.. option:: --test-option=option
give an extra option to the test executables. There is no need to
Give an extra option to the test executables. There is no need to
quote options containing spaces because a single option is assumed,
so options will not be split on spaces.
......@@ -1727,6 +1729,26 @@ the package.
passed as arguments to the wrapper and it is expected that the wrapper
will return the test's return code, as well as a copy of stdout/stderr.
.. _setup-bench:
setup bench
-----------
Run the benchmarks specified in the package description file. Aside
from the following flags, Cabal accepts the name of one or more benchmarks
on the command line after ``bench``. When supplied, Cabal will run
only the named benchmarks, otherwise, Cabal will run all benchmarks in
the package.
.. option:: --benchmark-options=options
Give extra options to the benchmark executables.
.. option:: --benchmark-option=option
Give an extra option to the benchmark executables. There is no need to
quote options containing spaces because a single option is assumed,
so options will not be split on spaces.
.. _setup-sdist:
setup sdist
......
......@@ -20,7 +20,7 @@ import Distribution.Client.Setup
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags )
import qualified Distribution.Client.Setup as Client
import Distribution.Simple.Setup
( HaddockFlags, TestFlags, fromFlagOrDefault )
( HaddockFlags, TestFlags, BenchmarkFlags, fromFlagOrDefault )
import Distribution.Simple.Command
( CommandUI(..), usageAlternatives )
import Distribution.Deprecated.Text
......@@ -33,7 +33,9 @@ import Distribution.Simple.Utils
import Control.Monad (when)
benchCommand :: CommandUI (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags, TestFlags)
benchCommand :: CommandUI ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags
)
benchCommand = Client.installCommand {
commandName = "v2-bench",
commandSynopsis = "Run benchmarks",
......@@ -73,9 +75,11 @@ benchCommand = Client.installCommand {
-- For more details on how this works, see the module
-- "Distribution.Client.ProjectOrchestration"
--
benchAction :: (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags, TestFlags)
benchAction :: ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags )
-> [String] -> GlobalFlags -> IO ()
benchAction (configFlags, configExFlags, installFlags, haddockFlags, testFlags)
benchAction ( configFlags, configExFlags, installFlags
, haddockFlags, testFlags, benchmarkFlags )
targetStrings globalFlags = do
baseCtx <- establishProjectBaseContext verbosity cliConfig OtherCommand
......@@ -119,7 +123,7 @@ benchAction (configFlags, configExFlags, installFlags, haddockFlags, testFlags)
globalFlags configFlags configExFlags
installFlags
mempty -- ClientInstallFlags, not needed here
haddockFlags testFlags
haddockFlags testFlags benchmarkFlags
-- | This defines what a 'TargetSelector' means for the @bench@ command.
-- It selects the 'AvailableTarget's that the 'TargetSelector' refers to,
......
......@@ -20,7 +20,7 @@ import Distribution.Client.Setup
, liftOptions, yesNoOpt )
import qualified Distribution.Client.Setup as Client
import Distribution.Simple.Setup
( HaddockFlags, TestFlags
( HaddockFlags, TestFlags, BenchmarkFlags
, Flag(..), toFlag, fromFlag, fromFlagOrDefault )
import Distribution.Simple.Command
( CommandUI(..), usageAlternatives, option )
......@@ -35,7 +35,8 @@ import qualified Data.Map as Map
buildCommand ::
CommandUI
(BuildFlags, ( ConfigFlags, ConfigExFlags
, InstallFlags, HaddockFlags, TestFlags))
, InstallFlags, HaddockFlags
, TestFlags, BenchmarkFlags ))
buildCommand = CommandUI {
commandName = "v2-build",
commandSynopsis = "Compile targets within the project.",
......@@ -103,11 +104,13 @@ defaultBuildFlags = BuildFlags
--
buildAction ::
( BuildFlags
, (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags, TestFlags))
, ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags ))
-> [String] -> GlobalFlags -> IO ()
buildAction
( buildFlags
, (configFlags, configExFlags, installFlags, haddockFlags, testFlags))
, ( configFlags, configExFlags, installFlags
, haddockFlags, testFlags, benchmarkFlags ))
targetStrings globalFlags = do
-- TODO: This flags defaults business is ugly
let onlyConfigure = fromFlag (buildOnlyConfigure defaultBuildFlags
......@@ -159,7 +162,7 @@ buildAction
globalFlags configFlags configExFlags
installFlags
mempty -- ClientInstallFlags, not needed here
haddockFlags testFlags
haddockFlags testFlags benchmarkFlags
-- | This defines what a 'TargetSelector' means for the @bench@ command.
-- It selects the 'AvailableTarget's that the 'TargetSelector' refers to,
......
......@@ -16,7 +16,7 @@ import Distribution.Client.ProjectConfig
import Distribution.Client.Setup
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags )
import Distribution.Simple.Setup
( HaddockFlags, TestFlags, fromFlagOrDefault )
( HaddockFlags, TestFlags, BenchmarkFlags, fromFlagOrDefault )
import Distribution.Verbosity
( normal )
......@@ -26,8 +26,9 @@ import Distribution.Simple.Utils
( wrapText, notice )
import qualified Distribution.Client.Setup as Client
configureCommand :: CommandUI (ConfigFlags, ConfigExFlags
,InstallFlags, HaddockFlags, TestFlags)
configureCommand :: CommandUI ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags
)
configureCommand = Client.installCommand {
commandName = "v2-configure",
commandSynopsis = "Add extra project configuration",
......@@ -78,9 +79,11 @@ configureCommand = Client.installCommand {
-- For more details on how this works, see the module
-- "Distribution.Client.ProjectOrchestration"
--
configureAction :: (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags, TestFlags)
configureAction :: ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags )
-> [String] -> GlobalFlags -> IO ()
configureAction (configFlags, configExFlags, installFlags, haddockFlags, testFlags)
configureAction ( configFlags, configExFlags, installFlags
, haddockFlags, testFlags, benchmarkFlags )
_extraArgs globalFlags = do
--TODO: deal with _extraArgs, since flags with wrong syntax end up there
......@@ -123,5 +126,5 @@ configureAction (configFlags, configExFlags, installFlags, haddockFlags, testFla
globalFlags configFlags configExFlags
installFlags
mempty -- ClientInstallFlags, not needed here
haddockFlags testFlags
haddockFlags testFlags benchmarkFlags
......@@ -76,6 +76,7 @@ import Distribution.Simple.GHC
import Distribution.Simple.Setup
( HaddockFlags
, TestFlags
, BenchmarkFlags
, fromFlagOrDefault
)
import Distribution.Simple.Utils
......@@ -95,7 +96,9 @@ import Distribution.Client.Compat.Prelude
import qualified Data.Set as S
import qualified Data.Map as M
execCommand :: CommandUI (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags, TestFlags)
execCommand :: CommandUI ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags
)
execCommand = CommandUI
{ commandName = "v2-exec"
, commandSynopsis = "Give a command access to the store."
......@@ -120,9 +123,11 @@ execCommand = CommandUI
, commandDefaultFlags = commandDefaultFlags Client.installCommand
}
execAction :: (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags, TestFlags)
execAction :: ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags )
-> [String] -> GlobalFlags -> IO ()
execAction (configFlags, configExFlags, installFlags, haddockFlags, testFlags)
execAction ( configFlags, configExFlags, installFlags
, haddockFlags, testFlags, benchmarkFlags )
extraArgs globalFlags = do
baseCtx <- establishProjectBaseContext verbosity cliConfig OtherCommand
......@@ -196,7 +201,7 @@ execAction (configFlags, configExFlags, installFlags, haddockFlags, testFlags)
globalFlags configFlags configExFlags
installFlags
mempty -- ClientInstallFlags, not needed here
haddockFlags testFlags
haddockFlags testFlags benchmarkFlags
withOverrides env args program = program
{ programOverrideEnv = programOverrideEnv program ++ env
, programDefaultArgs = programDefaultArgs program ++ args}
......
......@@ -33,7 +33,7 @@ import Distribution.PackageDescription
import Distribution.Client.Setup
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags )
import Distribution.Simple.Setup
( HaddockFlags, TestFlags, fromFlagOrDefault )
( HaddockFlags, TestFlags, BenchmarkFlags, fromFlagOrDefault )
import Distribution.Simple.Utils
( die', notice, wrapText )
import Distribution.Verbosity
......@@ -49,7 +49,9 @@ import Distribution.Simple.Command
import qualified Distribution.Client.Setup as Client
freezeCommand :: CommandUI (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags, TestFlags)
freezeCommand :: CommandUI ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags
)
freezeCommand = Client.installCommand {
commandName = "v2-freeze",
commandSynopsis = "Freeze dependencies.",
......@@ -99,9 +101,11 @@ freezeCommand = Client.installCommand {
-- For more details on how this works, see the module
-- "Distribution.Client.ProjectOrchestration"
--
freezeAction :: (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags, TestFlags)
freezeAction :: ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags )
-> [String] -> GlobalFlags -> IO ()
freezeAction (configFlags, configExFlags, installFlags, haddockFlags, testFlags)
freezeAction ( configFlags, configExFlags, installFlags
, haddockFlags, testFlags, benchmarkFlags )
extraArgs globalFlags = do
unless (null extraArgs) $
......@@ -132,7 +136,7 @@ freezeAction (configFlags, configExFlags, installFlags, haddockFlags, testFlags)
globalFlags configFlags configExFlags
installFlags
mempty -- ClientInstallFlags, not needed here
haddockFlags testFlags
haddockFlags testFlags benchmarkFlags
......
......@@ -20,7 +20,7 @@ import Distribution.Client.Setup
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags )
import qualified Distribution.Client.Setup as Client
import Distribution.Simple.Setup
( HaddockFlags(..), TestFlags, fromFlagOrDefault )
( HaddockFlags(..), TestFlags, BenchmarkFlags(..), fromFlagOrDefault )
import Distribution.Simple.Command
( CommandUI(..), usageAlternatives )
import Distribution.Verbosity
......@@ -31,8 +31,9 @@ import Distribution.Simple.Utils
import Control.Monad (when)
haddockCommand :: CommandUI (ConfigFlags, ConfigExFlags, InstallFlags
,HaddockFlags, TestFlags)
haddockCommand :: CommandUI ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags
)
haddockCommand = Client.installCommand {
commandName = "v2-haddock",
commandSynopsis = "Build Haddock documentation",
......@@ -69,9 +70,11 @@ haddockCommand = Client.installCommand {
-- For more details on how this works, see the module
-- "Distribution.Client.ProjectOrchestration"
--
haddockAction :: (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags, TestFlags)
haddockAction :: ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags )
-> [String] -> GlobalFlags -> IO ()
haddockAction (configFlags, configExFlags, installFlags, haddockFlags, testFlags)
haddockAction ( configFlags, configExFlags, installFlags
, haddockFlags, testFlags, benchmarkFlags )
targetStrings globalFlags = do
baseCtx <- establishProjectBaseContext verbosity cliConfig HaddockCommand
......@@ -113,7 +116,7 @@ haddockAction (configFlags, configExFlags, installFlags, haddockFlags, testFlags
globalFlags configFlags configExFlags
installFlags
mempty -- ClientInstallFlags, not needed here
haddockFlags testFlags
haddockFlags testFlags benchmarkFlags
-- | This defines what a 'TargetSelector' means for the @haddock@ command.
-- It selects the 'AvailableTarget's that the 'TargetSelector' refers to,
......
......@@ -32,7 +32,7 @@ import Distribution.Client.CmdInstall.ClientInstallFlags
import Distribution.Client.Setup
( GlobalFlags(..), ConfigFlags(..), ConfigExFlags, InstallFlags(..)
, configureExOptions, haddockOptions, installOptions, testOptions
, configureOptions, liftOptions )
, benchmarkOptions, configureOptions, liftOptions )
import Distribution.Solver.Types.ConstraintSource
( ConstraintSource(..) )
import Distribution.Client.Types
......@@ -87,7 +87,8 @@ import Distribution.Client.RebuildMonad
import Distribution.Client.InstallSymlink
( OverwritePolicy(..), symlinkBinary )
import Distribution.Simple.Setup
( Flag(..), HaddockFlags, TestFlags, fromFlagOrDefault, flagToMaybe )
( Flag(..), HaddockFlags, TestFlags, BenchmarkFlags
, fromFlagOrDefault, flagToMaybe )
import Distribution.Solver.Types.SourcePackage
( SourcePackage(..) )
import Distribution.Simple.Command
......@@ -142,7 +143,8 @@ import System.FilePath
installCommand :: CommandUI ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, ClientInstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags
, ClientInstallFlags
)
installCommand = CommandUI
{ commandName = "v2-install"
......@@ -194,17 +196,19 @@ installCommand = CommandUI
. optionName) $
haddockOptions showOrParseArgs)
++ liftOptions get5 set5 (testOptions showOrParseArgs)
++ liftOptions get6 set6 (clientInstallOptions showOrParseArgs)
, commandDefaultFlags = ( mempty, mempty, mempty, mempty, mempty
++ liftOptions get6 set6 (benchmarkOptions showOrParseArgs)
++ liftOptions get7 set7 (clientInstallOptions showOrParseArgs)
, commandDefaultFlags = ( mempty, mempty, mempty, mempty, mempty, mempty
, defaultClientInstallFlags )
}
where
get1 (a,_,_,_,_,_) = a; set1 a (_,b,c,d,e,f) = (a,b,c,d,e,f)
get2 (_,b,_,_,_,_) = b; set2 b (a,_,c,d,e,f) = (a,b,c,d,e,f)
get3 (_,_,c,_,_,_) = c; set3 c (a,b,_,d,e,f) = (a,b,c,d,e,f)
get4 (_,_,_,d,_,_) = d; set4 d (a,b,c,_,e,f) = (a,b,c,d,e,f)
get5 (_,_,_,_,e,_) = e; set5 e (a,b,c,d,_,f) = (a,b,c,d,e,f)
get6 (_,_,_,_,_,f) = f; set6 f (a,b,c,d,e,_) = (a,b,c,d,e,f)
get1 (a,_,_,_,_,_,_) = a; set1 a (_,b,c,d,e,f,g) = (a,b,c,d,e,f,g)
get2 (_,b,_,_,_,_,_) = b; set2 b (a,_,c,d,e,f,g) = (a,b,c,d,e,f,g)
get3 (_,_,c,_,_,_,_) = c; set3 c (a,b,_,d,e,f,g) = (a,b,c,d,e,f,g)
get4 (_,_,_,d,_,_,_) = d; set4 d (a,b,c,_,e,f,g) = (a,b,c,d,e,f,g)
get5 (_,_,_,_,e,_,_) = e; set5 e (a,b,c,d,_,f,g) = (a,b,c,d,e,f,g)
get6 (_,_,_,_,_,f,_) = f; set6 f (a,b,c,d,e,_,g) = (a,b,c,d,e,f,g)
get7 (_,_,_,_,_,_,g) = g; set7 g (a,b,c,d,e,f,_) = (a,b,c,d,e,f,g)
-- | The @install@ command actually serves four different needs. It installs:
......@@ -225,11 +229,13 @@ installCommand = CommandUI
-- "Distribution.Client.ProjectOrchestration"
--
installAction
:: ( ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags, TestFlags
:: ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags
, ClientInstallFlags)
-> [String] -> GlobalFlags
-> IO ()
installAction (configFlags, configExFlags, installFlags, haddockFlags, testFlags
installAction ( configFlags, configExFlags, installFlags
, haddockFlags, testFlags, benchmarkFlags
, clientInstallFlags' )
targetStrings globalFlags = do
-- We never try to build tests/benchmarks for remote packages.
......@@ -599,7 +605,7 @@ installAction (configFlags, configExFlags, installFlags, haddockFlags, testFlags
cliConfig = commandLineFlagsToProjectConfig
globalFlags configFlags' configExFlags
installFlags clientInstallFlags'
haddockFlags testFlags
haddockFlags testFlags benchmarkFlags
globalConfigFlag = projectConfigConfigFile (projectConfigShared cliConfig)
-- | Install any built exe by symlinking/copying it
......
......@@ -68,6 +68,9 @@ instance (HasVerbosity a) => HasVerbosity (a, b, c, d) where
instance (HasVerbosity a) => HasVerbosity (a, b, c, d, e) where
verbosity (a, _, _, _, _) = verbosity a
instance (HasVerbosity a) => HasVerbosity (a, b, c, d, e, f) where
verbosity (a, _, _, _, _, _) = verbosity a
instance HasVerbosity Setup.BuildFlags where
verbosity = verbosity . Setup.buildVerbosity
......
......@@ -45,7 +45,8 @@ import qualified Distribution.Client.Setup as Client
import Distribution.Client.Types
( PackageLocation(..), PackageSpecifier(..), UnresolvedSourcePackage )
import Distribution.Simple.Setup
( HaddockFlags, TestFlags, fromFlagOrDefault, replOptions
( HaddockFlags, TestFlags, BenchmarkFlags
, fromFlagOrDefault, replOptions
, Flag(..), toFlag, trueArg, falseArg )
import Distribution.Simple.Command
( CommandUI(..), liftOption, usageAlternatives, option
......@@ -143,7 +144,10 @@ envOptions _ =
("couldn't parse dependency: " ++)
(parsecCommaList parsec)
replCommand :: CommandUI (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags, TestFlags, ReplFlags, EnvFlags)
replCommand :: CommandUI ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags
, ReplFlags, EnvFlags
)
replCommand = Client.installCommand {
commandName = "v2-repl",
commandSynopsis = "Open an interactive session for the given component.",
......@@ -181,27 +185,31 @@ replCommand = Client.installCommand {
++ "to the default component (or no component if there is no project present)\n"
++ cmdCommonHelpTextNewBuildBeta,
commandDefaultFlags = (configFlags,configExFlags,installFlags,haddockFlags,testFlags,[],defaultEnvFlags),
commandDefaultFlags = ( configFlags, configExFlags, installFlags
, haddockFlags, testFlags, benchmarkFlags
, [], defaultEnvFlags
),
commandOptions = \showOrParseArgs ->
map liftOriginal (commandOptions Client.installCommand showOrParseArgs)
++ map liftReplOpts (replOptions showOrParseArgs)
++ map liftEnvOpts (envOptions showOrParseArgs)
}
where
(configFlags,configExFlags,installFlags,haddockFlags,testFlags) = commandDefaultFlags Client.installCommand
(configFlags,configExFlags,installFlags,haddockFlags,testFlags,benchmarkFlags)
= commandDefaultFlags Client.installCommand
liftOriginal = liftOption projectOriginal updateOriginal
liftReplOpts = liftOption projectReplOpts updateReplOpts
liftEnvOpts = liftOption projectEnvOpts updateEnvOpts
projectOriginal (a,b,c,d,e,_,_) = (a,b,c,d,e)
updateOriginal (a,b,c,d,e) (_,_,_,_,_,f,g) = (a,b,c,d,e,f,g)
projectOriginal (a,b,c,d,e,f,_,_) = (a,b,c,d,e,f)
updateOriginal (a,b,c,d,e,f) (_,_,_,_,_,_,g,h) = (a,b,c,d,e,f,g,h)
projectReplOpts (_,_,_,_,_,f,_) = f
updateReplOpts f (a,b,c,d,e,_,g) = (a,b,c,d,e,f,g)
projectReplOpts (_,_,_,_,_,_,g,_) = g
updateReplOpts g (a,b,c,d,e,f,_,h) = (a,b,c,d,e,f,g,h)
projectEnvOpts (_,_,_,_,_,_,g) = g
updateEnvOpts g (a,b,c,d,e,f,_) = (a,b,c,d,e,f,g)
projectEnvOpts (_,_,_,_,_,_,_,h) = h
updateEnvOpts h (a,b,c,d,e,f,g,_) = (a,b,c,d,e,f,g,h)
-- | The @repl@ command is very much like @build@. It brings the install plan
-- up to date, selects that part of the plan needed by the given or implicit
......@@ -214,9 +222,13 @@ replCommand = Client.installCommand {
-- For more details on how this works, see the module
-- "Distribution.Client.ProjectOrchestration"
--
replAction :: (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags, TestFlags, ReplFlags, EnvFlags)
replAction :: ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags
, ReplFlags, EnvFlags )
-> [String] -> GlobalFlags -> IO ()
replAction (configFlags, configExFlags, installFlags, haddockFlags, testFlags, replFlags, envFlags)
replAction ( configFlags, configExFlags, installFlags
, haddockFlags, testFlags, benchmarkFlags
, replFlags, envFlags )
targetStrings globalFlags = do
let
ignoreProject = fromFlagOrDefault False (envIgnoreProject envFlags)
......@@ -322,7 +334,7 @@ replAction (configFlags, configExFlags, installFlags, haddockFlags, testFlags, r
globalFlags configFlags configExFlags
installFlags
mempty -- ClientInstallFlags, not needed here
haddockFlags testFlags
haddockFlags testFlags benchmarkFlags
globalConfigFlag = projectConfigConfigFile (projectConfigShared cliConfig)
validatedTargets elaboratedPlan targetSelectors = do
......
......@@ -29,7 +29,7 @@ import Distribution.Client.GlobalFlags
( defaultGlobalFlags )
import qualified Distribution.Client.Setup as Client
import Distribution.Simple.Setup
( HaddockFlags, TestFlags, fromFlagOrDefault )
( HaddockFlags, TestFlags, BenchmarkFlags, fromFlagOrDefault )
import Distribution.Simple.Command
( CommandUI(..), usageAlternatives )
import Distribution.Types.ComponentName
......@@ -107,7 +107,9 @@ import System.FilePath
( (</>), isValid, isPathSeparator, takeExtension )
runCommand :: CommandUI (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags, TestFlags)
runCommand :: CommandUI ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags
)
runCommand = Client.installCommand {
commandName = "v2-run",
commandSynopsis = "Run an executable.",
......@@ -153,9 +155,11 @@ runCommand = Client.installCommand {
-- For more details on how this works, see the module
-- "Distribution.Client.ProjectOrchestration"
--
runAction :: (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags, TestFlags)
runAction :: ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags )
-> [String] -> GlobalFlags -> IO ()
runAction (configFlags, configExFlags, installFlags, haddockFlags, testFlags)
runAction ( configFlags, configExFlags, installFlags
, haddockFlags, testFlags, benchmarkFlags )
targetStrings globalFlags = do
globalTmp <- getTemporaryDirectory
tempDir <- createTempDirectory globalTmp "cabal-repl."
......@@ -299,7 +303,7 @@ runAction (configFlags, configExFlags, installFlags, haddockFlags, testFlags)
globalFlags configFlags configExFlags
installFlags
mempty -- ClientInstallFlags, not needed here
haddockFlags testFlags
haddockFlags testFlags benchmarkFlags
globalConfigFlag = projectConfigConfigFile (projectConfigShared cliConfig)
-- | Used by the main CLI parser as heuristic to decide whether @cabal@ was
......
......@@ -20,7 +20,7 @@ import Distribution.Client.Setup
( GlobalFlags(..), ConfigFlags(..), ConfigExFlags, InstallFlags )
import qualified Distribution.Client.Setup as Client
import Distribution.Simple.Setup
( HaddockFlags, TestFlags(..), fromFlagOrDefault )
( HaddockFlags, TestFlags(..), BenchmarkFlags(..), fromFlagOrDefault )
import Distribution.Simple.Command
( CommandUI(..), usageAlternatives )
import Distribution.Simple.Flag
......@@ -36,7 +36,9 @@ import Control.Monad (when)
import qualified System.Exit (exitSuccess)
testCommand :: CommandUI (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags, TestFlags)
testCommand :: CommandUI ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags
)
testCommand = Client.installCommand
{ commandName = "v2-test"