Skip to content

Commit 562dc1d

Browse files
committed
Deprecated --solver CLI option
1 parent 21b858f commit 562dc1d

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

cabal-install/src/Distribution/Client/Setup.hs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,9 @@ import System.FilePath
235235
( (</>)
236236
)
237237

238+
import System.IO (hPutStrLn, stderr)
239+
import System.IO.Unsafe (unsafePerformIO)
240+
238241
globalCommand :: [Command action] -> CommandUI GlobalFlags
239242
globalCommand commands =
240243
CommandUI
@@ -843,7 +846,7 @@ data ConfigExFlags = ConfigExFlags
843846
deriving (Eq, Show, Generic)
844847

845848
defaultConfigExFlags :: ConfigExFlags
846-
defaultConfigExFlags = mempty{configSolver = Flag defaultSolver}
849+
defaultConfigExFlags = mempty
847850

848851
configureExCommand :: CommandUI (ConfigFlags, ConfigExFlags)
849852
configureExCommand =
@@ -928,7 +931,13 @@ configureExOptions _showOrParseArgs src =
928931
)
929932
(map prettyShow)
930933
)
931-
, optionSolver configSolver (\v flags -> flags{configSolver = v})
934+
, optionSolver
935+
configSolver
936+
( \_ flags ->
937+
unsafePerformIO $ do
938+
hPutStrLn stderr "[WARNING] The --solver flag is deprecated and will be removed in a future release."
939+
return flags
940+
)
932941
, option
933942
[]
934943
["allow-older"]
@@ -3422,7 +3431,7 @@ optionSolver get set =
34223431
option
34233432
[]
34243433
["solver"]
3425-
("Select dependency solver to use (default: " ++ prettyShow defaultSolver ++ "). Choices: " ++ allSolvers ++ ".")
3434+
("[DEPRECATED] Select dependency solver to use (default: " ++ prettyShow defaultSolver ++ "). Choices: " ++ allSolvers ++ ".")
34263435
get
34273436
set
34283437
( reqArg

doc/cabal-commands.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ builds with ``cabal build`` are performed with the compiler
499499

500500
- Any flag accepted by ``cabal configure`` beyond
501501
``./Setup configure``, namely ``--cabal-lib-version``,
502-
``--constraint``, ``--preference`` and ``--solver.``
502+
``--constraint`` and ``--preference``.
503503

504504
- Any flag accepted by ``cabal install`` beyond ``./Setup configure``.
505505

doc/cabal-project-description-file.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,6 +1692,10 @@ Most users generally won't need these.
16921692

16931693
The command line variant of this field is ``--solver=modular``.
16941694

1695+
.. warning::
1696+
1697+
This CLI option has been deprecated and will be removed in a future release.
1698+
16951699
.. cfg-field:: max-backjumps: nat
16961700
--max-backjumps=N
16971701
:synopsis: Maximum number of solver backjumps.

0 commit comments

Comments
 (0)