From da194045ea1c306879abbb097a629b2d07722374 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sat, 19 Sep 2026 16:08:20 +0100 Subject: [PATCH] Fix #6963 Support Cabal-3.18.1.0 --- ChangeLog.md | 2 ++ src/Stack/Setup.hs | 4 ++-- src/setup-shim/StackSetupShim.hs | 12 +++++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index d7d4ab87e5..6e010016c3 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -12,6 +12,8 @@ Behavior changes: Other enhancements: +* Consider Cabal 3.18 to be a tested library and remove warnings. + Bug fixes: ## v4.1.1 diff --git a/src/Stack/Setup.hs b/src/Stack/Setup.hs index 54ce267092..83b83dab59 100644 --- a/src/Stack/Setup.hs +++ b/src/Stack/Setup.hs @@ -1095,9 +1095,9 @@ warnUnsupportedCompilerCabal cp didWarn = do , parens (style Shell "nightly-2018-03-13") , flow "or later specify such GHC versions." ] - | cabalVersion >= mkVersion [3, 17] && notifyIfCabalUntested -> + | cabalVersion >= mkVersion [3, 19] && notifyIfCabalUntested -> prettyWarnL - [ flow "Stack has not been tested with Cabal versions 3.18 and \ + [ flow "Stack has not been tested with Cabal versions 3.20 and \ \above, but version" , fromString (versionString cabalVersion) , flow "was found, this may fail." diff --git a/src/setup-shim/StackSetupShim.hs b/src/setup-shim/StackSetupShim.hs index a87ec81fc9..dcb7ae0ed0 100644 --- a/src/setup-shim/StackSetupShim.hs +++ b/src/setup-shim/StackSetupShim.hs @@ -50,8 +50,12 @@ import Distribution.Types.PackageDescription ( PackageDescription ) import Distribution.Utils.Path ( interpretSymbolicPathCWD, makeSymbolicPath, relativeSymbolicPath ) #endif +#if MIN_VERSION_Cabal(3,18,0) +import Distribution.Verbosity ( Verbosity (..), defaultVerbosityHandles ) +#else import Distribution.Verbosity ( Verbosity ) #endif +#endif import Distribution.Verbosity ( flagToVerbosity ) import Main import System.Environment ( getArgs ) @@ -88,7 +92,13 @@ stackReplHook arg1 arg2 = do "Unexpected happened running Setup.hs with " <> "stack-initial-build-steps, expected to parse Cabal verbosity: " <> msg1 - Right verbosity -> do + Right verbosityFlags -> do + let verbosity = +#if MIN_VERSION_Cabal(3,18,0) + Verbosity verbosityFlags defaultVerbosityHandles +#else + verbosityFlags +#endif eFp <- #if MIN_VERSION_Cabal(3,14,0) findPackageDesc Nothing