Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re #6498 Better in-app information about using a downgraded Stack #6499

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Behavior changes:

* Stack uses the version of the Cabal package that comes with the specified
version of GHC. Stack no longer supports such Cabal versions before 2.2, which
came with versions of GHC before 8.4.
came with versions of GHC before 8.4. Due to a bug, Stack 2.15.1 did not
support versions of GHC before 8.2.
* `stack path --global-config`, `--programs`, and `--local-bin` no longer set
up Stack's environment.
* The `init` command initialises `stack.yaml` with a `snapshot` key rather than
Expand Down
12 changes: 9 additions & 3 deletions src/Stack/Build.hs
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,20 @@ instance Pretty CabalVersionPrettyException where
\with the specified version of GHC. However, Stack no longer \
\supports such Cabal versions before 2.2. Version"
, fromString $ versionString cabalVer
, flow "was found. To fix this, either use Stack 2.15.1 or earlier or \
\use a snapshot that specifies a version of GHC that is 8.4 or \
\later. Stackage LTS Haskell 12.0"
, flow "was found. To fix this, either use Stack"
, downgradeRecommendation
, flow "or earlier or use a snapshot that specifies a version of GHC \
\that is 8.4 or later. Stackage LTS Haskell 12.0"
, parens (style Shell "lts-12.0")
, flow "or later or Nightly 2018-03-13"
, parens (style Shell "nightly-2018-03-13")
, flow "or later specify such GHC versions."
]
where
-- Due to a bug, Stack 2.15.1 does not support Cabal < 2.
downgradeRecommendation = if cabalVer < mkVersion [2]
then "2.13.1"
else "2.15.1"

instance Exception CabalVersionPrettyException

Expand Down
13 changes: 9 additions & 4 deletions src/Stack/Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1057,16 +1057,21 @@ warnUnsupportedCompilerCabal cp didWarn = do
notifyIfCabalUntested <- view $ configL . to (.notifyIfCabalUntested)
if
| cabalVersion < mkVersion [2, 2] -> do
-- Due to a bug, Stack 2.15.1 does not support Cabal < 2.
let downgradeRecommendation = if cabalVersion < mkVersion [2]
then "2.13.1"
else "2.15.1"
prettyWarnL
[ flow "Stack uses the version of the Cabal package that comes with \
\the specified version of GHC. However, Stack no longer \
\supports such Cabal versions before 2.2. Version"
, fromString (versionString cabalVersion)
, flow "was found. This invocation of Stack may fail. To fix this, \
\either use Stack 2.15.1 or earlier or use a snapshot that \
\specifies a version of GHC that is 8.4 or later. Stackage \
\LTS Haskell 12.0 or later and Nightly 2018-03-13 or later. \
\Stackage LTS Haskell 12.0"
\either use Stack"
, downgradeRecommendation
, flow "or earlier or use a snapshot that specifies a version of GHC \
\that is 8.4 or later. Stackage LTS Haskell 12.0 or later and \
\Nightly 2018-03-13 or later. Stackage LTS Haskell 12.0"
, parens (style Shell "lts-12.0")
, flow "or later or Nightly 2018-03-13"
, parens (style Shell "nightly-2018-03-13")
Expand Down