Unverified Commit 827d6558 authored by Oleg Grenrus's avatar Oleg Grenrus Committed by GitHub

Merge pull request #6814 from phadej/issue-6809

Issue 6809: v2-update -z
parents f6f78d11 ad57d3ca
......@@ -1880,7 +1880,7 @@ data TestFlags = TestFlags {
testFailWhenNoTestSuites :: Flag Bool,
-- TODO: think about if/how options are passed to test exes
testOptions :: [PathTemplate]
} deriving (Generic, Typeable)
} deriving (Show, Generic, Typeable)
defaultTestFlags :: TestFlags
defaultTestFlags = TestFlags {
......@@ -2000,7 +2000,7 @@ data BenchmarkFlags = BenchmarkFlags {
benchmarkDistPref :: Flag FilePath,
benchmarkVerbosity :: Flag Verbosity,
benchmarkOptions :: [PathTemplate]
} deriving (Generic, Typeable)
} deriving (Show, Generic, Typeable)
defaultBenchmarkFlags :: BenchmarkFlags
defaultBenchmarkFlags = BenchmarkFlags {
......
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE RecordWildCards #-}
-- | cabal-install CLI command: bench
--
......@@ -16,11 +16,12 @@ module Distribution.Client.CmdBench (
import Distribution.Client.ProjectOrchestration
import Distribution.Client.CmdErrorMessages
import Distribution.Client.NixStyleOptions
( NixStyleFlags (..), nixStyleOptions, defaultNixStyleFlags )
import Distribution.Client.Setup
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags )
import qualified Distribution.Client.Setup as Client
import Distribution.Simple.Setup
( HaddockFlags, TestFlags, BenchmarkFlags, fromFlagOrDefault )
( GlobalFlags, ConfigFlags(..) )
import Distribution.Simple.Flag
( fromFlagOrDefault )
import Distribution.Simple.Command
( CommandUI(..), usageAlternatives )
import Distribution.Pretty
......@@ -33,10 +34,8 @@ import Distribution.Simple.Utils
import Control.Monad (when)
benchCommand :: CommandUI ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags
)
benchCommand = Client.installCommand {
benchCommand :: CommandUI (NixStyleFlags ())
benchCommand = CommandUI {
commandName = "v2-bench",
commandSynopsis = "Run benchmarks",
commandUsage = usageAlternatives "v2-bench" [ "[TARGETS] [FLAGS]" ],
......@@ -65,6 +64,9 @@ benchCommand = Client.installCommand {
++ " Run the benchmark built with '-O2' (including local libs used)\n\n"
++ cmdCommonHelpTextNewBuildBeta
, commandDefaultFlags = defaultNixStyleFlags ()
, commandOptions = nixStyleOptions (const [])
}
......@@ -75,12 +77,8 @@ benchCommand = Client.installCommand {
-- For more details on how this works, see the module
-- "Distribution.Client.ProjectOrchestration"
--
benchAction :: ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags )
-> [String] -> GlobalFlags -> IO ()
benchAction ( configFlags, configExFlags, installFlags
, haddockFlags, testFlags, benchmarkFlags )
targetStrings globalFlags = do
benchAction :: NixStyleFlags () -> [String] -> GlobalFlags -> IO ()
benchAction flags@NixStyleFlags {..} targetStrings globalFlags = do
baseCtx <- establishProjectBaseContext verbosity cliConfig OtherCommand
......@@ -119,11 +117,8 @@ benchAction ( configFlags, configExFlags, installFlags
runProjectPostBuildPhase verbosity baseCtx buildCtx buildOutcomes
where
verbosity = fromFlagOrDefault normal (configVerbosity configFlags)
cliConfig = commandLineFlagsToProjectConfig
globalFlags configFlags configExFlags
installFlags
cliConfig = commandLineFlagsToProjectConfig globalFlags flags
mempty -- ClientInstallFlags, not needed here
haddockFlags testFlags benchmarkFlags
-- | This defines what a 'TargetSelector' means for the @bench@ command.
-- It selects the 'AvailableTarget's that the 'TargetSelector' refers to,
......
{-# LANGUAGE RecordWildCards #-}
-- | cabal-install CLI command: build
--
module Distribution.Client.CmdBuild (
......@@ -17,15 +18,13 @@ import Distribution.Client.Compat.Prelude
import Distribution.Client.ProjectOrchestration
import Distribution.Client.CmdErrorMessages
import Distribution.Client.NixStyleOptions
( NixStyleFlags (..), nixStyleOptions, defaultNixStyleFlags )
import Distribution.Client.Setup
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags
, liftOptions, yesNoOpt )
import qualified Distribution.Client.Setup as Client
import Distribution.Simple.Setup
( HaddockFlags, TestFlags, BenchmarkFlags
, Flag(..), toFlag, fromFlag, fromFlagOrDefault )
( GlobalFlags, ConfigFlags(..), yesNoOpt )
import Distribution.Simple.Flag ( Flag(..), toFlag, fromFlag, fromFlagOrDefault )
import Distribution.Simple.Command
( CommandUI(..), usageAlternatives, option )
( CommandUI(..), usageAlternatives, option, optionName )
import Distribution.Verbosity
( Verbosity, normal )
import Distribution.Simple.Utils
......@@ -34,11 +33,7 @@ import Distribution.Simple.Utils
import qualified Data.Map as Map
buildCommand ::
CommandUI
(BuildFlags, ( ConfigFlags, ConfigExFlags
, InstallFlags, HaddockFlags
, TestFlags, BenchmarkFlags ))
buildCommand :: CommandUI (NixStyleFlags BuildFlags)
buildCommand = CommandUI {
commandName = "v2-build",
commandSynopsis = "Compile targets within the project.",
......@@ -70,24 +65,17 @@ buildCommand = CommandUI {
++ " Build the component in profiling mode "
++ "(including dependencies as needed)\n\n"
++ cmdCommonHelpTextNewBuildBeta,
commandDefaultFlags =
(defaultBuildFlags, commandDefaultFlags Client.installCommand),
commandOptions = \ showOrParseArgs ->
liftOptions snd setSnd
(commandOptions Client.installCommand showOrParseArgs) ++
liftOptions fst setFst
[ option [] ["only-configure"]
"Instead of performing a full build just run the configure step"
buildOnlyConfigure (\v flags -> flags { buildOnlyConfigure = v })
(yesNoOpt showOrParseArgs)
]
++ cmdCommonHelpTextNewBuildBeta
, commandDefaultFlags = defaultNixStyleFlags defaultBuildFlags
, commandOptions = filter (\o -> optionName o /= "ignore-project")
. nixStyleOptions (\showOrParseArgs ->
[ option [] ["only-configure"]
"Instead of performing a full build just run the configure step"
buildOnlyConfigure (\v flags -> flags { buildOnlyConfigure = v })
(yesNoOpt showOrParseArgs)
])
}
where
setFst a (_,b) = (a,b)
setSnd b (a,_) = (a,b)
data BuildFlags = BuildFlags
{ buildOnlyConfigure :: Flag Bool
}
......@@ -104,16 +92,8 @@ defaultBuildFlags = BuildFlags
-- For more details on how this works, see the module
-- "Distribution.Client.ProjectOrchestration"
--
buildAction ::
( BuildFlags
, ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags ))
-> [String] -> GlobalFlags -> IO ()
buildAction
( buildFlags
, ( configFlags, configExFlags, installFlags
, haddockFlags, testFlags, benchmarkFlags ))
targetStrings globalFlags = do
buildAction :: NixStyleFlags BuildFlags -> [String] -> GlobalFlags -> IO ()
buildAction flags@NixStyleFlags { extraFlags = buildFlags, ..} targetStrings globalFlags = do
-- TODO: This flags defaults business is ugly
let onlyConfigure = fromFlag (buildOnlyConfigure defaultBuildFlags
<> buildOnlyConfigure buildFlags)
......@@ -160,11 +140,8 @@ buildAction
runProjectPostBuildPhase verbosity baseCtx buildCtx buildOutcomes
where
verbosity = fromFlagOrDefault normal (configVerbosity configFlags)
cliConfig = commandLineFlagsToProjectConfig
globalFlags configFlags configExFlags
installFlags
cliConfig = commandLineFlagsToProjectConfig globalFlags flags
mempty -- ClientInstallFlags, not needed here
haddockFlags testFlags benchmarkFlags
-- | This defines what a 'TargetSelector' means for the @bench@ command.
-- It selects the 'AvailableTarget's that the 'TargetSelector' refers to,
......
{-# LANGUAGE RecordWildCards #-}
-- | cabal-install CLI command: configure
--
module Distribution.Client.CmdConfigure (
......@@ -13,23 +14,22 @@ import Distribution.Client.ProjectOrchestration
import Distribution.Client.ProjectConfig
( writeProjectLocalExtraConfig )
import Distribution.Client.NixStyleOptions
( NixStyleFlags (..), nixStyleOptions, defaultNixStyleFlags )
import Distribution.Client.Setup
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags )
import Distribution.Simple.Setup
( HaddockFlags, TestFlags, BenchmarkFlags, fromFlagOrDefault )
( GlobalFlags, ConfigFlags(..) )
import Distribution.Simple.Flag
( fromFlagOrDefault )
import Distribution.Verbosity
( normal )
import Distribution.Simple.Command
( CommandUI(..), usageAlternatives )
( CommandUI(..), usageAlternatives, optionName )
import Distribution.Simple.Utils
( wrapText, notice )
import qualified Distribution.Client.Setup as Client
configureCommand :: CommandUI ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags
)
configureCommand = Client.installCommand {
configureCommand :: CommandUI (NixStyleFlags ())
configureCommand = CommandUI {
commandName = "v2-configure",
commandSynopsis = "Add extra project configuration",
commandUsage = usageAlternatives "v2-configure" [ "[FLAGS]" ],
......@@ -67,7 +67,10 @@ configureCommand = Client.installCommand {
++ " project configuration works.\n\n"
++ cmdCommonHelpTextNewBuildBeta
}
, commandDefaultFlags = defaultNixStyleFlags ()
, commandOptions = filter (\o -> optionName o /= "ignore-project")
. nixStyleOptions (const [])
}
-- | To a first approximation, the @configure@ just runs the first phase of
-- the @build@ command where we bring the install plan up to date (thus
......@@ -79,12 +82,8 @@ configureCommand = Client.installCommand {
-- For more details on how this works, see the module
-- "Distribution.Client.ProjectOrchestration"
--
configureAction :: ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags )
-> [String] -> GlobalFlags -> IO ()
configureAction ( configFlags, configExFlags, installFlags
, haddockFlags, testFlags, benchmarkFlags )
_extraArgs globalFlags = do
configureAction :: NixStyleFlags () -> [String] -> GlobalFlags -> IO ()
configureAction flags@NixStyleFlags {..} _extraArgs globalFlags = do
--TODO: deal with _extraArgs, since flags with wrong syntax end up there
baseCtx <- establishProjectBaseContext verbosity cliConfig OtherCommand
......@@ -122,9 +121,6 @@ configureAction ( configFlags, configExFlags, installFlags
printPlan verbosity baseCtx' buildCtx
where
verbosity = fromFlagOrDefault normal (configVerbosity configFlags)
cliConfig = commandLineFlagsToProjectConfig
globalFlags configFlags configExFlags
installFlags
cliConfig = commandLineFlagsToProjectConfig globalFlags flags
mempty -- ClientInstallFlags, not needed here
haddockFlags testFlags benchmarkFlags
......@@ -21,13 +21,12 @@ import Distribution.Client.InstallPlan
( GenericPlanPackage(..)
, toGraph
)
import Distribution.Client.NixStyleOptions
( NixStyleFlags (..), nixStyleOptions, defaultNixStyleFlags )
import Distribution.Client.Setup
( ConfigExFlags
, ConfigFlags(configVerbosity)
( ConfigFlags(configVerbosity)
, GlobalFlags
, InstallFlags
)
import qualified Distribution.Client.Setup as Client
import Distribution.Client.ProjectOrchestration
( ProjectBuildContext(..)
, runProjectPreBuildPhase
......@@ -49,7 +48,7 @@ import Distribution.Client.ProjectPlanning
, ElaboratedSharedConfig(..)
)
import Distribution.Simple.Command
( CommandUI(..)
( CommandUI(..), optionName
)
import Distribution.Simple.Program.Db
( modifyProgramSearchPath
......@@ -73,11 +72,8 @@ import Distribution.Simple.Program.Types
import Distribution.Simple.GHC
( getImplInfo
, GhcImplInfo(supportsPkgEnvFiles) )
import Distribution.Simple.Setup
( HaddockFlags
, TestFlags
, BenchmarkFlags
, fromFlagOrDefault
import Distribution.Simple.Flag
( fromFlagOrDefault
)
import Distribution.Simple.Utils
( die'
......@@ -97,9 +93,7 @@ import Distribution.Client.Compat.Prelude
import qualified Data.Set as S
import qualified Data.Map as M
execCommand :: CommandUI ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags
)
execCommand :: CommandUI (NixStyleFlags ())
execCommand = CommandUI
{ commandName = "v2-exec"
, commandSynopsis = "Give a command access to the store."
......@@ -120,16 +114,13 @@ execCommand = CommandUI
++ " to choose an appropriate version of ghc and to include any"
++ " ghc-specific flags requested."
, commandNotes = Nothing
, commandOptions = commandOptions Client.installCommand
, commandDefaultFlags = commandDefaultFlags Client.installCommand
, commandOptions = filter (\o -> optionName o /= "ignore-project")
. nixStyleOptions (const [])
, commandDefaultFlags = defaultNixStyleFlags ()
}
execAction :: ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags )
-> [String] -> GlobalFlags -> IO ()
execAction ( configFlags, configExFlags, installFlags
, haddockFlags, testFlags, benchmarkFlags )
extraArgs globalFlags = do
execAction :: NixStyleFlags () -> [String] -> GlobalFlags -> IO ()
execAction flags@NixStyleFlags {..} extraArgs globalFlags = do
baseCtx <- establishProjectBaseContext verbosity cliConfig OtherCommand
......@@ -198,11 +189,8 @@ execAction ( configFlags, configExFlags, installFlags
runProgramInvocation verbosity invocation
where
verbosity = fromFlagOrDefault normal (configVerbosity configFlags)
cliConfig = commandLineFlagsToProjectConfig
globalFlags configFlags configExFlags
installFlags
cliConfig = commandLineFlagsToProjectConfig globalFlags flags
mempty -- ClientInstallFlags, not needed here
haddockFlags testFlags benchmarkFlags
withOverrides env args program = program
{ programOverrideEnv = programOverrideEnv program ++ env
, programDefaultArgs = programDefaultArgs program ++ args}
......
......@@ -7,6 +7,8 @@ module Distribution.Client.CmdFreeze (
freezeAction,
) where
import Distribution.Client.NixStyleOptions
( NixStyleFlags (..), nixStyleOptions, defaultNixStyleFlags )
import Distribution.Client.ProjectOrchestration
import Distribution.Client.ProjectPlanning
import Distribution.Client.ProjectConfig
......@@ -32,9 +34,9 @@ import Distribution.Version
import Distribution.PackageDescription
( FlagAssignment, nullFlagAssignment )
import Distribution.Client.Setup
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags )
import Distribution.Simple.Setup
( HaddockFlags, TestFlags, BenchmarkFlags, fromFlagOrDefault )
( GlobalFlags, ConfigFlags(..) )
import Distribution.Simple.Flag
( fromFlagOrDefault )
import Distribution.Simple.Flag (Flag (..))
import Distribution.Simple.Utils
( die', notice, wrapText )
......@@ -47,13 +49,9 @@ import Control.Monad (unless)
import Distribution.Simple.Command
( CommandUI(..), usageAlternatives )
import qualified Distribution.Client.Setup as Client
freezeCommand :: CommandUI ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags
)
freezeCommand = Client.installCommand {
freezeCommand :: CommandUI (NixStyleFlags ())
freezeCommand = CommandUI {
commandName = "v2-freeze",
commandSynopsis = "Freeze dependencies.",
commandUsage = usageAlternatives "v2-freeze" [ "[FLAGS]" ],
......@@ -93,6 +91,8 @@ freezeCommand = Client.installCommand {
++ "https://github.com/haskell/cabal/issues and if you\nhave any time "
++ "to get involved and help with testing, fixing bugs etc then\nthat "
++ "is very much appreciated.\n"
, commandDefaultFlags = defaultNixStyleFlags ()
, commandOptions = nixStyleOptions (const [])
}
-- | To a first approximation, the @freeze@ command runs the first phase of
......@@ -102,12 +102,8 @@ freezeCommand = Client.installCommand {
-- For more details on how this works, see the module
-- "Distribution.Client.ProjectOrchestration"
--
freezeAction :: ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags )
-> [String] -> GlobalFlags -> IO ()
freezeAction ( configFlags, configExFlags, installFlags
, haddockFlags, testFlags, benchmarkFlags )
extraArgs globalFlags = do
freezeAction :: NixStyleFlags () -> [String] -> GlobalFlags -> IO ()
freezeAction flags@NixStyleFlags {..} extraArgs globalFlags = do
unless (null extraArgs) $
die' verbosity $ "'freeze' doesn't take any extra arguments: "
......@@ -133,11 +129,8 @@ freezeAction ( configFlags, configExFlags, installFlags
where
verbosity = fromFlagOrDefault normal (configVerbosity configFlags)
cliConfig = commandLineFlagsToProjectConfig
globalFlags configFlags configExFlags
installFlags
cliConfig = commandLineFlagsToProjectConfig globalFlags flags
mempty -- ClientInstallFlags, not needed here
haddockFlags testFlags benchmarkFlags
......
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE RecordWildCards #-}
-- | cabal-install CLI command: haddock
--
......@@ -17,11 +17,11 @@ import Distribution.Client.ProjectOrchestration
import Distribution.Client.CmdErrorMessages
import Distribution.Client.NixStyleOptions
( NixStyleFlags, nixStyleOptions, defaultNixStyleFlags )
( NixStyleFlags (..), nixStyleOptions, defaultNixStyleFlags )
import Distribution.Client.Setup
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags )
( GlobalFlags, ConfigFlags(..) )
import Distribution.Simple.Setup
( HaddockFlags(..), TestFlags, BenchmarkFlags(..), fromFlagOrDefault )
( HaddockFlags(..), fromFlagOrDefault )
import Distribution.Simple.Command
( CommandUI(..), usageAlternatives )
import Distribution.Verbosity
......@@ -71,13 +71,8 @@ haddockCommand = CommandUI {
-- For more details on how this works, see the module
-- "Distribution.Client.ProjectOrchestration"
--
haddockAction :: ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags, () )
-> [String] -> GlobalFlags -> IO ()
haddockAction ( configFlags, configExFlags, installFlags
, haddockFlags, testFlags, benchmarkFlags, () )
targetStrings globalFlags = do
haddockAction :: NixStyleFlags () -> [String] -> GlobalFlags -> IO ()
haddockAction flags@NixStyleFlags {..} targetStrings globalFlags = do
baseCtx <- establishProjectBaseContext verbosity cliConfig HaddockCommand
targetSelectors <- either (reportTargetSelectorProblems verbosity) return
......@@ -113,11 +108,7 @@ haddockAction ( configFlags, configExFlags, installFlags
runProjectPostBuildPhase verbosity baseCtx buildCtx buildOutcomes
where
verbosity = fromFlagOrDefault normal (configVerbosity configFlags)
cliConfig = commandLineFlagsToProjectConfig
globalFlags configFlags configExFlags
installFlags
mempty -- ClientInstallFlags, not needed here
haddockFlags testFlags benchmarkFlags
cliConfig = commandLineFlagsToProjectConfig globalFlags flags mempty -- ClientInstallFlags, not needed here
-- | This defines what a 'TargetSelector' means for the @haddock@ command.
-- It selects the 'AvailableTarget's that the 'TargetSelector' refers to,
......
......@@ -33,7 +33,7 @@ import Distribution.Client.CmdInstall.ClientInstallFlags
import Distribution.Client.CmdInstall.ClientInstallTargetSelector
import Distribution.Client.Setup
( GlobalFlags(..), ConfigFlags(..), ConfigExFlags, InstallFlags(..) )
( GlobalFlags(..), ConfigFlags(..) )
import Distribution.Client.Types
( PackageSpecifier(..), PackageLocation(..), UnresolvedSourcePackage
, SourcePackageDb(..) )
......@@ -47,7 +47,8 @@ import Distribution.Client.ProjectConfig
, fetchAndReadSourcePackages
)
import Distribution.Client.NixStyleOptions
( NixStyleFlags, nixStyleOptions, defaultNixStyleFlags )
( NixStyleFlags (..), nixStyleOptions, defaultNixStyleFlags )
import Distribution.Client.ProjectFlags (ProjectFlags (..))
import Distribution.Client.ProjectConfig.Types
( ProjectConfig(..), ProjectConfigShared(..)
, ProjectConfigBuildOnly(..), PackageConfig(..)
......@@ -78,7 +79,7 @@ import Distribution.Client.IndexUtils
( getSourcePackages, getInstalledPackages )
import Distribution.Client.ProjectConfig
( projectConfigWithBuilderRepoContext
, resolveBuildTimeSettings, withProjectOrGlobalConfigIgn )
, resolveBuildTimeSettings, withProjectOrGlobalConfig )
import Distribution.Client.ProjectPlanning
( storePackageInstallDirs' )
import Distribution.Client.ProjectPlanning.Types
......@@ -95,7 +96,7 @@ import Distribution.Client.InstallSymlink
import Distribution.Simple.Flag
( fromFlagOrDefault, flagToMaybe, flagElim )
import Distribution.Simple.Setup
( Flag(..), HaddockFlags, TestFlags, BenchmarkFlags )
( Flag(..) )
import Distribution.Solver.Types.SourcePackage
( SourcePackage(..) )
import Distribution.Simple.Command
......@@ -197,16 +198,8 @@ installCommand = CommandUI
-- For more details on how this works, see the module
-- "Distribution.Client.ProjectOrchestration"
--
installAction
:: ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags
, ClientInstallFlags)
-> [String] -> GlobalFlags
-> IO ()
installAction ( configFlags, configExFlags, installFlags
, haddockFlags, testFlags, benchmarkFlags
, clientInstallFlags' )
targetStrings globalFlags = do
installAction :: NixStyleFlags ClientInstallFlags -> [String] -> GlobalFlags -> IO ()
installAction flags@NixStyleFlags { extraFlags = clientInstallFlags', .. } targetStrings globalFlags = do
-- Ensure there were no invalid configuration options specified.
verifyPreconditionsOrDie verbosity configFlags'
......@@ -312,11 +305,8 @@ installAction ( configFlags, configExFlags, installFlags
return (packageSpecifiers, uris, packageTargets, projectConfig)
let
ignoreProject = fromFlagOrDefault False (cinstIgnoreProject clientInstallFlags)
(specs, uris, targetSelectors, config) <-
withProjectOrGlobalConfigIgn ignoreProject verbosity globalConfigFlag withProject withoutProject
withProjectOrGlobalConfig verbosity ignoreProject globalConfigFlag withProject withoutProject
let
ProjectConfig {
......@@ -411,10 +401,11 @@ installAction ( configFlags, configExFlags, installFlags
where
configFlags' = disableTestsBenchsByDefault configFlags
verbosity = fromFlagOrDefault normal (configVerbosity configFlags')
ignoreProject = flagIgnoreProject projectFlags
cliConfig = commandLineFlagsToProjectConfig
globalFlags configFlags' configExFlags
installFlags clientInstallFlags'
haddockFlags testFlags benchmarkFlags
globalFlags
flags { configFlags = configFlags' }
clientInstallFlags'
globalConfigFlag = projectConfigConfigFile (projectConfigShared cliConfig)
-- | Verify that invalid config options were not passed to the install command.
......
......@@ -29,7 +29,6 @@ instance Structured InstallMethod
data ClientInstallFlags = ClientInstallFlags
{ cinstInstallLibs :: Flag Bool
, cinstIgnoreProject :: Flag Bool
, cinstEnvironmentPath :: Flag FilePath
, cinstOverwritePolicy :: Flag OverwritePolicy
, cinstInstallMethod :: Flag InstallMethod
......@@ -49,7 +48,6 @@ instance Structured ClientInstallFlags
defaultClientInstallFlags :: ClientInstallFlags
defaultClientInstallFlags = ClientInstallFlags
{ cinstInstallLibs = toFlag False
, cinstIgnoreProject = toFlag False
, cinstEnvironmentPath = mempty
, cinstOverwritePolicy = mempty
, cinstInstallMethod = mempty
......@@ -62,10 +60,6 @@ clientInstallOptions _ =
"Install libraries rather than executables from the target package."
cinstInstallLibs (\v flags -> flags { cinstInstallLibs = v })
trueArg
, option "z" ["ignore-project"]
"Ignore local project configuration"
cinstIgnoreProject (\v flags -> flags { cinstIgnoreProject = v })
trueArg
, option [] ["package-env", "env"]
"Set the environment file that may be modified."
cinstEnvironmentPath (\pf flags -> flags { cinstEnvironmentPath = pf })
......
......@@ -24,13 +24,13 @@ import Distribution.Compat.Lens
import qualified Distribution.Types.Lens as L
import Distribution.Client.NixStyleOptions
( NixStyleFlags, nixStyleOptions, defaultNixStyleFlags )
( NixStyleFlags (..), nixStyleOptions, defaultNixStyleFlags )
import Distribution.Client.CmdErrorMessages
import qualified Distribution.Client.InstallPlan as InstallPlan
import Distribution.Client.ProjectBuilding
( rebuildTargetsDryRun, improveInstallPlanWithUpToDatePackages )
import Distribution.Client.ProjectConfig
( ProjectConfig(..), withProjectOrGlobalConfigIgn
( ProjectConfig(..), withProjectOrGlobalConfig
, projectConfigConfigFile )
import Distribution.Client.ProjectOrchestration
import Distribution.Client.ProjectPlanning
......@@ -38,13 +38,12 @@ import Distribution.Client.ProjectPlanning
import Distribution.Client.ProjectPlanning.Types
( elabOrderExeDependencies )
import Distribution.Client.Setup
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags )
( GlobalFlags, ConfigFlags(..) )
import qualified Distribution.Client.Setup as Client
import Distribution.Client.Types
( PackageLocation(..), PackageSpecifier(..), UnresolvedSourcePackage )
import Distribution.Simple.Setup
( HaddockFlags, TestFlags, BenchmarkFlags
, fromFlagOrDefault, replOptions
( fromFlagOrDefault, replOptions
, Flag(..), toFlag, trueArg, falseArg )
import Distribution.Simple.Command
( CommandUI(..), liftOptionL, usageAlternatives, option
......@@ -197,21 +196,14 @@ replCommand = Client.installCommand {
-- For more details on how this works, see the module
-- "Distribution.Client.ProjectOrchestration"
--
replAction :: ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, TestFlags, BenchmarkFlags
, (ReplFlags, EnvFlags) )
-> [String] -> GlobalFlags -> IO ()
replAction ( configFlags, configExFlags, installFlags
, haddockFlags, testFlags, benchmarkFlags
, (replFlags, envFlags) )
targetStrings globalFlags = do
replAction :: NixStyleFlags (ReplFlags, EnvFlags) -> [String] -> GlobalFlags -> IO ()
replAction flags@NixStyleFlags { extraFlags = (replFlags, envFlags), ..} targetStrings globalFlags = do