diff --git a/cabal-install/src/Distribution/Client/CmdBench.hs b/cabal-install/src/Distribution/Client/CmdBench.hs index 05634141288..db7e9f65cba 100644 --- a/cabal-install/src/Distribution/Client/CmdBench.hs +++ b/cabal-install/src/Distribution/Client/CmdBench.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE RecordWildCards #-} - -- | cabal-install CLI command: bench module Distribution.Client.CmdBench ( -- * The @bench@ CLI and action @@ -29,13 +27,13 @@ import Distribution.Client.CmdErrorMessages import Distribution.Client.Errors import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) + , cfgVerbosity , defaultNixStyleFlags , nixStyleOptions ) import Distribution.Client.ProjectOrchestration import Distribution.Client.Setup - ( ConfigFlags (..) - , GlobalFlags + ( GlobalFlags ) import Distribution.Client.TargetProblem ( TargetProblem (..) @@ -47,10 +45,6 @@ import Distribution.Simple.Command ( CommandUI (..) , usageAlternatives ) -import Distribution.Simple.Flag - ( fromFlagOrDefault - ) -import Distribution.Simple.Setup (CommonSetupFlags (..)) import Distribution.Simple.Utils ( dieWithException , warn @@ -111,7 +105,7 @@ benchCommand = -- For more details on how this works, see the module -- "Distribution.Client.ProjectOrchestration" benchAction :: NixStyleFlags () -> [String] -> GlobalFlags -> IO () -benchAction flags@NixStyleFlags{..} targetStrings globalFlags = do +benchAction flags targetStrings globalFlags = do baseCtx <- establishProjectBaseContext verbosity cliConfig OtherCommand targetSelectors <- @@ -151,7 +145,7 @@ benchAction flags@NixStyleFlags{..} targetStrings globalFlags = do buildOutcomes <- runProjectBuildPhase verbosity baseCtx buildCtx runProjectPostBuildPhase verbosity baseCtx buildCtx buildOutcomes where - verbosity = fromFlagOrDefault normal (setupVerbosity $ configCommonFlags configFlags) + verbosity = cfgVerbosity normal flags cliConfig = commandLineFlagsToProjectConfig globalFlags diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 21231988eca..4d5243af79b 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE RecordWildCards #-} - -- | cabal-install CLI command: build module Distribution.Client.CmdBuild ( -- * The @build@ CLI and action @@ -30,6 +28,7 @@ import qualified Data.Map as Map import Distribution.Client.Errors import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) + , cfgVerbosity , defaultNixStyleFlags , nixStyleOptions ) @@ -40,9 +39,7 @@ import Distribution.Client.ScriptUtils , withContextAndSelectors ) import Distribution.Client.Setup - ( CommonSetupFlags (..) - , ConfigFlags (..) - , GlobalFlags + ( GlobalFlags , yesNoOpt ) import Distribution.Simple.Command @@ -50,7 +47,7 @@ import Distribution.Simple.Command , option , usageAlternatives ) -import Distribution.Simple.Flag (Flag (..), fromFlag, fromFlagOrDefault, toFlag) +import Distribution.Simple.Flag (Flag (..), fromFlag, toFlag) import Distribution.Simple.Utils ( dieWithException , wrapText @@ -134,7 +131,7 @@ defaultBuildFlags = -- For more details on how this works, see the module -- "Distribution.Client.ProjectOrchestration" buildAction :: NixStyleFlags BuildFlags -> [String] -> GlobalFlags -> IO () -buildAction flags@NixStyleFlags{extraFlags = buildFlags, ..} targetStrings globalFlags = +buildAction flags@NixStyleFlags{extraFlags = buildFlags} targetStrings globalFlags = withContextAndSelectors verbosity RejectNoTargets Nothing flags targetStrings globalFlags BuildCommand $ \targetCtx ctx targetSelectors -> do -- TODO: This flags defaults business is ugly let onlyConfigure = @@ -185,7 +182,7 @@ buildAction flags@NixStyleFlags{extraFlags = buildFlags, ..} targetStrings globa buildOutcomes <- runProjectBuildPhase verbosity baseCtx buildCtx runProjectPostBuildPhase verbosity baseCtx buildCtx buildOutcomes where - verbosity = fromFlagOrDefault normal (setupVerbosity $ configCommonFlags configFlags) + verbosity = cfgVerbosity normal flags -- | This defines what a 'TargetSelector' means for the @bench@ command. -- It selects the 'AvailableTarget's that the 'TargetSelector' refers to, diff --git a/cabal-install/src/Distribution/Client/CmdConfigure.hs b/cabal-install/src/Distribution/Client/CmdConfigure.hs index c5bd678c2a3..8ce26f986ad 100644 --- a/cabal-install/src/Distribution/Client/CmdConfigure.hs +++ b/cabal-install/src/Distribution/Client/CmdConfigure.hs @@ -22,16 +22,15 @@ import Distribution.Client.ProjectFlags ) import Distribution.Client.ProjectOrchestration import Distribution.Simple.Flag -import Distribution.Simple.Setup (CommonSetupFlags (..)) import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) + , cfgVerbosity , defaultNixStyleFlags , nixStyleOptions ) import Distribution.Client.Setup ( ConfigExFlags (..) - , ConfigFlags (..) , GlobalFlags ) import Distribution.Verbosity @@ -117,14 +116,14 @@ configureCommand = -- For more details on how this works, see the module -- "Distribution.Client.ProjectOrchestration" configureAction :: NixStyleFlags () -> [String] -> GlobalFlags -> IO () -configureAction flags@NixStyleFlags{..} extraArgs globalFlags = do +configureAction flags extraArgs globalFlags = do (baseCtx, projConfig) <- configureAction' flags extraArgs globalFlags if shouldNotWriteFile baseCtx then notice v "Config file not written due to flag(s)." else writeProjectLocalExtraConfig (distDirLayout baseCtx) projConfig where - v = fromFlagOrDefault normal (setupVerbosity $ configCommonFlags configFlags) + v = cfgVerbosity normal flags configureAction' :: NixStyleFlags () -> [String] -> GlobalFlags -> IO (ProjectBaseContext, ProjectConfig) configureAction' flags@NixStyleFlags{..} _extraArgs globalFlags = do @@ -165,7 +164,7 @@ configureAction' flags@NixStyleFlags{..} _extraArgs globalFlags = do return (baseCtx, conf <> cliConfig) else return (baseCtx, cliConfig) where - v = fromFlagOrDefault normal (setupVerbosity $ configCommonFlags configFlags) + v = cfgVerbosity normal flags cliConfig = commandLineFlagsToProjectConfig globalFlags diff --git a/cabal-install/src/Distribution/Client/CmdExec.hs b/cabal-install/src/Distribution/Client/CmdExec.hs index caa680a3a3a..31ee5df76ab 100644 --- a/cabal-install/src/Distribution/Client/CmdExec.hs +++ b/cabal-install/src/Distribution/Client/CmdExec.hs @@ -23,6 +23,7 @@ import Distribution.Client.InstallPlan ) import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) + , cfgVerbosity , defaultNixStyleFlags , nixStyleOptions ) @@ -58,15 +59,11 @@ import Distribution.Client.ProjectPlanning.Types ( dataDirsEnvironmentForPlan ) import Distribution.Client.Setup - ( ConfigFlags (configCommonFlags) - , GlobalFlags + ( GlobalFlags ) import Distribution.Simple.Command ( CommandUI (..) ) -import Distribution.Simple.Flag - ( fromFlagOrDefault - ) import Distribution.Simple.GHC ( GhcImplInfo (supportsPkgEnvFiles) , getImplInfo @@ -87,7 +84,6 @@ import Distribution.Simple.Program.Run ( programInvocation , runProgramInvocation ) -import Distribution.Simple.Setup (CommonSetupFlags (..)) import Distribution.Simple.Utils ( createDirectoryIfMissingVerbose , dieWithException @@ -144,7 +140,7 @@ execCommand = } execAction :: NixStyleFlags () -> [String] -> GlobalFlags -> IO () -execAction flags@NixStyleFlags{..} extraArgs globalFlags = do +execAction flags extraArgs globalFlags = do baseCtx <- establishProjectBaseContext verbosity cliConfig OtherCommand -- To set up the environment, we'd like to select the libraries in our @@ -226,7 +222,7 @@ execAction flags@NixStyleFlags{..} extraArgs globalFlags = do then notice verbosity "Running of executable suppressed by flag(s)" else runProgramInvocation verbosity invocation where - verbosity = fromFlagOrDefault normal (setupVerbosity $ configCommonFlags configFlags) + verbosity = cfgVerbosity normal flags cliConfig = commandLineFlagsToProjectConfig globalFlags diff --git a/cabal-install/src/Distribution/Client/CmdFreeze.hs b/cabal-install/src/Distribution/Client/CmdFreeze.hs index 29718b5d441..3ef9dc49d66 100644 --- a/cabal-install/src/Distribution/Client/CmdFreeze.hs +++ b/cabal-install/src/Distribution/Client/CmdFreeze.hs @@ -1,5 +1,4 @@ {-# LANGUAGE NamedFieldPuns #-} -{-# LANGUAGE RecordWildCards #-} -- | cabal-install CLI command: freeze module Distribution.Client.CmdFreeze @@ -17,6 +16,7 @@ import Distribution.Client.IndexUtils (ActiveRepos, TotalIndexState, filterSkipp import qualified Distribution.Client.InstallPlan as InstallPlan import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) + , cfgVerbosity , defaultNixStyleFlags , nixStyleOptions ) @@ -40,9 +40,7 @@ import Distribution.Solver.Types.PackageConstraint ) import Distribution.Client.Setup - ( CommonSetupFlags (setupVerbosity) - , ConfigFlags (..) - , GlobalFlags + ( GlobalFlags ) import Distribution.Package ( PackageName @@ -53,7 +51,7 @@ import Distribution.PackageDescription ( FlagAssignment , nullFlagAssignment ) -import Distribution.Simple.Flag (Flag (..), fromFlagOrDefault) +import Distribution.Simple.Flag (Flag (..)) import Distribution.Simple.Utils ( dieWithException , notice @@ -125,7 +123,7 @@ freezeCommand = -- For more details on how this works, see the module -- "Distribution.Client.ProjectOrchestration" freezeAction :: NixStyleFlags () -> [String] -> GlobalFlags -> IO () -freezeAction flags@NixStyleFlags{..} extraArgs globalFlags = do +freezeAction flags extraArgs globalFlags = do unless (null extraArgs) $ dieWithException verbosity $ FreezeAction extraArgs @@ -160,7 +158,7 @@ freezeAction flags@NixStyleFlags{..} extraArgs globalFlags = do notice verbosity $ "Wrote freeze file: " ++ (distProjectFile distDirLayout "freeze") where - verbosity = fromFlagOrDefault normal (setupVerbosity $ configCommonFlags configFlags) + verbosity = cfgVerbosity normal flags cliConfig = commandLineFlagsToProjectConfig globalFlags diff --git a/cabal-install/src/Distribution/Client/CmdHaddock.hs b/cabal-install/src/Distribution/Client/CmdHaddock.hs index 677589e3e35..0f9327565ec 100644 --- a/cabal-install/src/Distribution/Client/CmdHaddock.hs +++ b/cabal-install/src/Distribution/Client/CmdHaddock.hs @@ -19,6 +19,7 @@ import Prelude () import Distribution.Client.CmdErrorMessages import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) + , cfgVerbosity , defaultNixStyleFlags , nixStyleOptions ) @@ -31,9 +32,7 @@ import Distribution.Client.ProjectPlanning ( ElaboratedSharedConfig (..) ) import Distribution.Client.Setup - ( CommonSetupFlags (..) - , ConfigFlags (..) - , GlobalFlags + ( GlobalFlags , InstallFlags (..) ) import Distribution.Client.TargetProblem @@ -149,7 +148,7 @@ haddockAction relFlags targetStrings globalFlags = do flags@NixStyleFlags{..} <- mkFlagsAbsolute relFlags let - verbosity = fromFlagOrDefault normal (setupVerbosity $ configCommonFlags configFlags) + verbosity = cfgVerbosity normal flags installDoc = fromFlagOrDefault True (installDocumentation installFlags) flags' = flags{installFlags = installFlags{installDocumentation = Flag installDoc}} cliConfig = commandLineFlagsToProjectConfig globalFlags flags' mempty -- ClientInstallFlags, not needed here diff --git a/cabal-install/src/Distribution/Client/CmdInstall.hs b/cabal-install/src/Distribution/Client/CmdInstall.hs index 75e673e895f..a52ae171b41 100644 --- a/cabal-install/src/Distribution/Client/CmdInstall.hs +++ b/cabal-install/src/Distribution/Client/CmdInstall.hs @@ -62,6 +62,7 @@ import Distribution.Client.InstallSymlink ) import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) + , cfgVerbosity , defaultNixStyleFlags , nixStyleOptions ) @@ -97,8 +98,7 @@ import Distribution.Client.RebuildMonad ( runRebuild ) import Distribution.Client.Setup - ( CommonSetupFlags (..) - , ConfigFlags (..) + ( ConfigFlags (..) , GlobalFlags (..) , InstallFlags (..) ) @@ -543,7 +543,7 @@ installAction flags@NixStyleFlags{extraFlags, configFlags, installFlags, project traverseInstall (installCheckUnitExes InstallCheckInstall) installCfg where configFlags' = disableTestsBenchsByDefault . ignoreProgramAffixes $ configFlags - verbosity = fromFlagOrDefault normal (setupVerbosity $ configCommonFlags configFlags') + verbosity = cfgVerbosity normal flags ignoreProject = flagIgnoreProject projectFlags cliConfig = commandLineFlagsToProjectConfig diff --git a/cabal-install/src/Distribution/Client/CmdListBin.hs b/cabal-install/src/Distribution/Client/CmdListBin.hs index ec9b5d7a76e..b3bd665639b 100644 --- a/cabal-install/src/Distribution/Client/CmdListBin.hs +++ b/cabal-install/src/Distribution/Client/CmdListBin.hs @@ -1,5 +1,4 @@ {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE RecordWildCards #-} module Distribution.Client.CmdListBin ( listbinCommand @@ -30,10 +29,12 @@ import Distribution.Client.CmdErrorMessages import Distribution.Client.DistDirLayout (DistDirLayout (..)) import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) + , cfgVerbosity , defaultNixStyleFlags , nixStyleOptions ) -import Distribution.Client.ProjectOrchestration +import Distribution.Client.ProjectOrchestration hiding (distDirLayout, targetsMap) +import qualified Distribution.Client.ProjectOrchestration as Orchestration (distDirLayout, targetsMap) import Distribution.Client.ProjectPlanning.Types import Distribution.Client.ScriptUtils ( AcceptNoTargets (..) @@ -46,7 +47,6 @@ import Distribution.Client.Setup (GlobalFlags (..)) import Distribution.Client.TargetProblem (TargetProblem (..)) import Distribution.Simple.BuildPaths (dllExtension, exeExtension) import Distribution.Simple.Command (CommandUI (..)) -import Distribution.Simple.Setup (configCommonFlags, fromFlagOrDefault, setupVerbosity) import Distribution.Simple.Utils (dieWithException, withOutputMarker, wrapText) import Distribution.System (Platform) import Distribution.Types.ComponentName (showComponentName) @@ -86,7 +86,7 @@ listbinCommand = ------------------------------------------------------------------------------- listbinAction :: NixStyleFlags () -> [String] -> GlobalFlags -> IO () -listbinAction flags@NixStyleFlags{..} args globalFlags = do +listbinAction flags args globalFlags = do -- fail early if multiple target selectors specified target <- case args of [] -> dieWithException verbosity NoTargetProvided @@ -140,7 +140,7 @@ listbinAction flags@NixStyleFlags{..} args globalFlags = do singleComponentOrElse ( dieWithException verbosity ThisIsABug ) - $ targetsMap buildCtx + $ Orchestration.targetsMap buildCtx printPlan verbosity baseCtx buildCtx @@ -150,7 +150,7 @@ listbinAction flags@NixStyleFlags{..} args globalFlags = do return $ IP.foldPlanPackage (const []) -- IPI don't have executables - (elaboratedPackage (distDirLayout baseCtx) (elaboratedShared buildCtx) selectedComponent) + (elaboratedPackage (Orchestration.distDirLayout baseCtx) (elaboratedShared buildCtx) selectedComponent) gpp case binfiles of @@ -170,7 +170,7 @@ listbinAction flags@NixStyleFlags{..} args globalFlags = do _ -> dieWithException verbosity MultipleTargetsFound where defaultVerbosity = verboseStderr silent - verbosity = fromFlagOrDefault defaultVerbosity (setupVerbosity $ configCommonFlags configFlags) + verbosity = cfgVerbosity defaultVerbosity flags -- this is copied from elaboratedPackage diff --git a/cabal-install/src/Distribution/Client/CmdRepl.hs b/cabal-install/src/Distribution/Client/CmdRepl.hs index 9ddd3c01ffc..3fd53d5d633 100644 --- a/cabal-install/src/Distribution/Client/CmdRepl.hs +++ b/cabal-install/src/Distribution/Client/CmdRepl.hs @@ -42,6 +42,7 @@ import Distribution.Client.Errors import qualified Distribution.Client.InstallPlan as InstallPlan import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) + , cfgVerbosity , defaultNixStyleFlags , nixStyleOptions ) @@ -102,10 +103,8 @@ import Distribution.Simple.Compiler , compilerCompatVersion ) import Distribution.Simple.Setup - ( CommonSetupFlags (..) - , ReplOptions (..) + ( ReplOptions (..) , commonSetupTempFileOptions - , setupVerbosity ) import Distribution.Simple.Utils ( debugNoWrap @@ -294,12 +293,11 @@ replAction flags@NixStyleFlags{extraFlags = r@ReplFlags{..}, ..} targetStrings' -- behaviour when the package is somewhere else we adjust the targets. targetStrings <- if null targetStrings' - then - withCtx silent targetStrings' $ \targetCtx ctx _ -> + then withCtx silent targetStrings' $ \targetCtx ctx _ -> return . fromMaybe [] $ case targetCtx of ProjectContext -> let pkgs = projectPackages $ projectConfig ctx - in if length pkgs == 1 + in if length pkgs == 1 then pure <$> listToMaybe pkgs else Nothing _ -> Nothing @@ -547,9 +545,9 @@ replAction flags@NixStyleFlags{extraFlags = r@ReplFlags{..}, ..} targetStrings' go m _ = m withCtx ctxVerbosity strings = - withContextAndSelectors ctxVerbosity AcceptNoTargets (Just LibKind) flags strings globalFlags ReplCommand + withContextAndSelectors ctxVerbosity AcceptNoTargets (Just LibKind) flags strings globalFlags ReplCommand - verbosity = fromFlagOrDefault normal (setupVerbosity $ configCommonFlags configFlags) + verbosity = cfgVerbosity normal flags tempFileOptions = commonSetupTempFileOptions $ configCommonFlags configFlags validatedTargets ctx compiler elaboratedPlan targetSelectors = do diff --git a/cabal-install/src/Distribution/Client/CmdRun.hs b/cabal-install/src/Distribution/Client/CmdRun.hs index e2241f95c79..59e8f3e7432 100644 --- a/cabal-install/src/Distribution/Client/CmdRun.hs +++ b/cabal-install/src/Distribution/Client/CmdRun.hs @@ -1,5 +1,4 @@ {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TupleSections #-} -- | cabal-install CLI command: run @@ -43,6 +42,7 @@ import Distribution.Client.InstallPlan ) import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) + , cfgVerbosity , defaultNixStyleFlags , nixStyleOptions ) @@ -50,7 +50,8 @@ import Distribution.Client.ProjectConfig.Types ( ProjectConfig (projectConfigShared) , ProjectConfigShared (projectConfigProgPathExtra) ) -import Distribution.Client.ProjectOrchestration +import Distribution.Client.ProjectOrchestration hiding (targetsMap) +import qualified Distribution.Client.ProjectOrchestration as Orchestration (targetsMap) import Distribution.Client.ProjectPlanning ( ElaboratedConfiguredPackage (..) , ElaboratedInstallPlan @@ -70,9 +71,7 @@ import Distribution.Client.ScriptUtils , withContextAndSelectors ) import Distribution.Client.Setup - ( CommonSetupFlags (setupVerbosity) - , ConfigFlags (..) - , GlobalFlags (..) + ( GlobalFlags (..) ) import Distribution.Client.TargetProblem ( TargetProblem (..) @@ -89,9 +88,6 @@ import Distribution.Simple.Command ( CommandUI (..) , usageAlternatives ) -import Distribution.Simple.Flag - ( fromFlagOrDefault - ) import Distribution.Simple.Program.Find ( ProgramSearchPathEntry (ProgramSearchPathDir) , defaultProgramSearchPath @@ -115,7 +111,7 @@ import Distribution.Simple.Utils import Distribution.Types.ComponentName ( componentNameRaw ) -import Distribution.Types.Executable as PD +import qualified Distribution.Types.Executable as PD ( buildInfo , exeName ) @@ -205,14 +201,14 @@ runCommand = -- For more details on how this works, see the module -- "Distribution.Client.ProjectOrchestration" runAction :: NixStyleFlags () -> [String] -> GlobalFlags -> IO () -runAction flags@NixStyleFlags{..} targetAndArgs globalFlags = - withContextAndSelectors (cfgVerbosity normal) RejectNoTargets (Just ExeKind) flags targetStr globalFlags OtherCommand $ \targetCtx ctx targetSelectors -> do +runAction flags targetAndArgs globalFlags = + withContextAndSelectors (cfgVerbosity normal flags) RejectNoTargets (Just ExeKind) flags targetStr globalFlags OtherCommand $ \targetCtx ctx targetSelectors -> do (baseCtx, defaultVerbosity) <- case targetCtx of ProjectContext -> return (ctx, normal) GlobalContext -> return (ctx, normal) ScriptContext path exemeta -> (,silent) <$> updateContextAndWriteProjectFile ctx path exemeta - let verbosity = cfgVerbosity defaultVerbosity + let verbosity = cfgVerbosity defaultVerbosity flags buildCtx <- runProjectPreBuildPhase verbosity baseCtx $ \elaboratedPlan -> do @@ -262,7 +258,7 @@ runAction flags@NixStyleFlags{..} targetAndArgs globalFlags = singleExeOrElse ( dieWithException verbosity RunPhaseReached ) - $ targetsMap buildCtx + $ Orchestration.targetsMap buildCtx printPlan verbosity baseCtx buildCtx @@ -360,7 +356,6 @@ runAction flags@NixStyleFlags{..} targetAndArgs globalFlags = elaboratedPlan } where - cfgVerbosity v = fromFlagOrDefault v (setupVerbosity $ configCommonFlags configFlags) (targetStr, args) = splitAt 1 targetAndArgs -- | Used by the main CLI parser as heuristic to decide whether @cabal@ was diff --git a/cabal-install/src/Distribution/Client/CmdTest.hs b/cabal-install/src/Distribution/Client/CmdTest.hs index 7c1adffdc91..4c86d758bb1 100644 --- a/cabal-install/src/Distribution/Client/CmdTest.hs +++ b/cabal-install/src/Distribution/Client/CmdTest.hs @@ -28,13 +28,13 @@ import Distribution.Client.CmdErrorMessages ) import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) + , cfgVerbosity , defaultNixStyleFlags , nixStyleOptions ) import Distribution.Client.ProjectOrchestration import Distribution.Client.Setup - ( ConfigFlags (..) - , GlobalFlags (..) + ( GlobalFlags (..) ) import Distribution.Client.TargetProblem ( TargetProblem (..) @@ -51,7 +51,6 @@ import Distribution.Simple.Flag ) import Distribution.Simple.Setup ( TestFlags (..) - , fromFlagOrDefault ) import Distribution.Simple.Utils ( dieWithException @@ -66,7 +65,6 @@ import Distribution.Verbosity import qualified System.Exit (exitSuccess) import Distribution.Client.Errors -import Distribution.Client.Setup (CommonSetupFlags (..)) import GHC.Environment ( getFullArgs ) @@ -164,7 +162,7 @@ testAction flags@NixStyleFlags{..} targetStrings globalFlags = do runProjectPostBuildPhase verbosity baseCtx buildCtx buildOutcomes where failWhenNoTestSuites = testFailWhenNoTestSuites testFlags - verbosity = fromFlagOrDefault normal (setupVerbosity $ configCommonFlags configFlags) + verbosity = cfgVerbosity normal flags cliConfig = commandLineFlagsToProjectConfig globalFlags flags mempty -- ClientInstallFlags -- | This defines what a 'TargetSelector' means for the @test@ command. diff --git a/cabal-install/src/Distribution/Client/CmdUpdate.hs b/cabal-install/src/Distribution/Client/CmdUpdate.hs index 33ae77e14e0..49ba19ec1cd 100644 --- a/cabal-install/src/Distribution/Client/CmdUpdate.hs +++ b/cabal-install/src/Distribution/Client/CmdUpdate.hs @@ -38,6 +38,7 @@ import Distribution.Client.JobControl ) import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) + , cfgVerbosity , defaultNixStyleFlags , nixStyleOptions ) @@ -53,9 +54,7 @@ import Distribution.Client.ProjectFlags ) import Distribution.Client.ProjectOrchestration import Distribution.Client.Setup - ( CommonSetupFlags (..) - , ConfigFlags (..) - , GlobalFlags + ( GlobalFlags , RepoContext (..) , UpdateFlags , defaultUpdateFlags @@ -67,9 +66,6 @@ import Distribution.Client.Types , repoName , unRepoName ) -import Distribution.Simple.Flag - ( fromFlagOrDefault - ) import Distribution.Simple.Utils ( dieWithException , notice @@ -221,7 +217,7 @@ updateAction flags@NixStyleFlags{..} extraArgs globalFlags = do reposToUpdate traverse_ (\_ -> collectJob jobCtrl) reposToUpdate where - verbosity = fromFlagOrDefault normal (setupVerbosity $ configCommonFlags configFlags) + verbosity = cfgVerbosity normal flags cliConfig = commandLineFlagsToProjectConfig globalFlags flags mempty -- ClientInstallFlags, not needed here globalConfigFlag = projectConfigConfigFile (projectConfigShared cliConfig) diff --git a/cabal-install/src/Distribution/Client/NixStyleOptions.hs b/cabal-install/src/Distribution/Client/NixStyleOptions.hs index d661948b5b7..5a0b66323f5 100644 --- a/cabal-install/src/Distribution/Client/NixStyleOptions.hs +++ b/cabal-install/src/Distribution/Client/NixStyleOptions.hs @@ -7,6 +7,7 @@ module Distribution.Client.NixStyleOptions , nixStyleOptions , defaultNixStyleFlags , updNixStyleCommonSetupFlags + , cfgVerbosity ) where import Distribution.Client.Compat.Prelude @@ -18,6 +19,7 @@ import Distribution.Simple.Setup , CommonSetupFlags (..) , HaddockFlags (..) , TestFlags (testCommonFlags) + , fromFlagOrDefault ) import Distribution.Solver.Types.ConstraintSource (ConstraintSource (..)) @@ -154,3 +156,6 @@ updNixStyleCommonSetupFlags setFlag nixFlags = common = benchmarkCommonFlags flags in flags{benchmarkCommonFlags = setFlag common} } + +cfgVerbosity :: Verbosity -> NixStyleFlags a -> Verbosity +cfgVerbosity v flags = fromFlagOrDefault v (setupVerbosity . configCommonFlags $ configFlags flags)