Skip to content

Commit

Permalink
Re #6498 Better in-app information about using a downgraded Stack
Browse files Browse the repository at this point in the history
  • Loading branch information
mpilgrem committed Feb 26, 2024
1 parent 3108931 commit 4b7250a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
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

0 comments on commit 4b7250a

Please sign in to comment.