diff --git a/cabal-install/src/Distribution/Client/Dependency/Types.hs b/cabal-install/src/Distribution/Client/Dependency/Types.hs index 78f97662008..4c641e8631a 100644 --- a/cabal-install/src/Distribution/Client/Dependency/Types.hs +++ b/cabal-install/src/Distribution/Client/Dependency/Types.hs @@ -1,4 +1,5 @@ {-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE InstanceSigs #-} module Distribution.Client.Dependency.Types ( PreSolver (..) @@ -9,9 +10,8 @@ module Distribution.Client.Dependency.Types import Distribution.Client.Compat.Prelude import Prelude () -import Text.PrettyPrint (text) - import qualified Distribution.Compat.CharParsing as P +import GHC.IO (unsafePerformIO) -- | All the solvers that can be selected. data PreSolver = AlwaysModular @@ -27,14 +27,14 @@ instance Binary Solver instance Structured PreSolver instance Structured Solver -instance Pretty PreSolver where - pretty AlwaysModular = text "modular" - instance Parsec PreSolver where + parsec :: CabalParsing m => m PreSolver parsec = do name <- P.munch1 isAlpha case map toLower name of - "modular" -> return AlwaysModular + "modular" -> return $ unsafePerformIO $ do + putStrLn "[WARNING] The `solver' config option is deprecated and will be removed in a future release." + return AlwaysModular _ -> P.unexpected $ "PreSolver: " ++ name -- | Global policy for all packages to say if we prefer package versions that diff --git a/cabal-install/src/Distribution/Client/Setup.hs b/cabal-install/src/Distribution/Client/Setup.hs index a5d91aaf19b..5e7ce1c398f 100644 --- a/cabal-install/src/Distribution/Client/Setup.hs +++ b/cabal-install/src/Distribution/Client/Setup.hs @@ -236,6 +236,8 @@ import System.FilePath ( () ) +import System.IO.Unsafe (unsafePerformIO) + globalCommand :: [Command action] -> CommandUI GlobalFlags globalCommand commands = CommandUI @@ -934,7 +936,13 @@ configureExOptions _showOrParseArgs src = ) (map prettyShow) ) - , optionSolver configSolver (\v flags -> flags{configSolver = v}) + , optionSolver + configSolver + ( \_ flags -> + unsafePerformIO $ do + putStrLn "[WARNING] The --solver flag is deprecated and will be removed in a future release." + return flags + ) , option [] ["allow-older"] @@ -2161,9 +2169,6 @@ defaultMaxBackjumps = 4000 defaultSolver :: PreSolver defaultSolver = AlwaysModular -allSolvers :: String -allSolvers = intercalate ", " (map prettyShow ([minBound .. maxBound] :: [PreSolver])) - installCommand :: CommandUI ( ConfigFlags @@ -3424,16 +3429,16 @@ optionSolver get set = option [] ["solver"] - ("Select dependency solver to use (default: " ++ prettyShow defaultSolver ++ "). Choices: " ++ allSolvers ++ ".") + ("[DEPRECATED] Select dependency solver to use (default: modular). Choices: modular.") get set ( reqArg "SOLVER" ( parsecToReadE - (const $ "solver must be one of: " ++ allSolvers) + (const $ "solver must be one of: modular") (toFlag `fmap` parsec) ) - (flagToList . fmap prettyShow) + (flagToList . fmap (\_ -> "modular")) ) optionSolverFlags diff --git a/doc/cabal-commands.rst b/doc/cabal-commands.rst index 5419186f73c..216cb30ee47 100644 --- a/doc/cabal-commands.rst +++ b/doc/cabal-commands.rst @@ -499,7 +499,7 @@ builds with ``cabal build`` are performed with the compiler - Any flag accepted by ``cabal configure`` beyond ``./Setup configure``, namely ``--cabal-lib-version``, - ``--constraint``, ``--preference`` and ``--solver.`` + ``--constraint`` and ``--preference``. - Any flag accepted by ``cabal install`` beyond ``./Setup configure``. diff --git a/doc/cabal-project-description-file.rst b/doc/cabal-project-description-file.rst index a787a221f58..51a03729f0e 100644 --- a/doc/cabal-project-description-file.rst +++ b/doc/cabal-project-description-file.rst @@ -1712,6 +1712,10 @@ Most users generally won't need these. The command line variant of this field is ``--solver=modular``. + .. warning:: + + This CLI option has been deprecated and will be removed in a future release. + .. cfg-field:: max-backjumps: nat --max-backjumps=N :synopsis: Maximum number of solver backjumps.