Skip to content

Commit f80eab2

Browse files
solmpilgrem
authored andcommitted
Depend on Cabal-3.14.2.0
1 parent 5c396b8 commit f80eab2

File tree

13 files changed

+54
-41
lines changed

13 files changed

+54
-41
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/stack.cabal linguist-generated=true

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,8 @@ Stack aims to depend on well-known packages. The specific versions on which it
349349
depends at any time are specified by `package.yaml` and `stack.yaml`. It does
350350
not aim to be compatible with more than one version of the `Cabal` package at
351351
any time. At the time of writing (August 2025) the package versions are
352-
primarily ones in Stackage snapshot LTS Haskell 24.4 (for GHC 9.10.2) and
352+
primarily ones in Stackage snapshot LTS Haskell 24.4 (for GHC 9.10.2), the
353+
latest version of `Cabal` released on Hackage (`Cabal-3.14.2.0`) and
353354
`pantry-0.11.0`.
354355

355356
A Stack executable makes use of Cabal (the library) through a small 'Setup'

Setup.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import Distribution.Simple.Utils
2525
import Distribution.Types.PackageName ( unPackageName )
2626
import Distribution.Types.UnqualComponentName
2727
( unUnqualComponentName )
28+
import Distribution.Utils.Path ( interpretSymbolicPathCWD )
2829
import Distribution.Verbosity ( Verbosity, normal )
2930
import System.FilePath ( (</>) )
3031

@@ -47,7 +48,7 @@ generateBuildModule ::
4748
-> LocalBuildInfo
4849
-> IO ()
4950
generateBuildModule verbosity pkg lbi = do
50-
let dir = autogenPackageModulesDir lbi
51+
let dir = interpretSymbolicPathCWD (autogenPackageModulesDir lbi)
5152
createDirectoryIfMissingVerbose verbosity True dir
5253
withLibLBI pkg lbi $ \_ libcfg -> do
5354
withExeLBI pkg lbi $ \exe clbi -> do

package.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ homepage: http://haskellstack.org
3333
custom-setup:
3434
dependencies:
3535
- base >= 4.14.3.0 && < 5
36-
- Cabal < 3.14
36+
- Cabal >= 3.14 && < 3.16
3737
- filepath
3838
extra-source-files:
3939
# note: leaving out 'package.yaml' because it causes confusion with hackage metadata revisions
@@ -65,7 +65,7 @@ ghc-options:
6565
- -optP-Wno-nonportable-include-path
6666
dependencies:
6767
- base >= 4.16.0.0 && < 5
68-
- Cabal >= 3.8.1.0 && < 3.14
68+
- Cabal >= 3.14 && < 3.16
6969
- aeson >= 2.0.3.0
7070
- aeson-warning-parser >= 0.1.1
7171
- ansi-terminal >= 1.0.2

src/Stack/Component.hs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import Distribution.PackageDescription
3535
import Distribution.Types.BuildInfo ( BuildInfo )
3636
import Distribution.Package ( mkPackageName )
3737
import qualified Distribution.PackageDescription as Cabal
38+
import Distribution.Utils.Path (interpretSymbolicPathCWD)
3839
import GHC.Records ( HasField )
3940
import Stack.Prelude
4041
import Stack.Types.Component
@@ -73,7 +74,7 @@ stackExecutableFromCabal :: Executable -> StackExecutable
7374
stackExecutableFromCabal cabalExecutable = StackExecutable
7475
{ name = fromCabalName cabalExecutable.exeName
7576
, buildInfo = stackBuildInfoFromCabal cabalExecutable.buildInfo
76-
, modulePath = cabalExecutable.modulePath
77+
, modulePath = interpretSymbolicPathCWD cabalExecutable.modulePath
7778
}
7879

7980
stackForeignLibraryFromCabal :: ForeignLib -> StackForeignLibrary
@@ -107,20 +108,20 @@ stackBuildInfoFromCabal buildInfoV = gatherComponentToolsAndDepsFromCabal
107108
StackBuildInfo
108109
{ buildable = buildInfoV.buildable
109110
, otherModules = buildInfoV.otherModules
110-
, jsSources = buildInfoV.jsSources
111+
, jsSources = map interpretSymbolicPathCWD buildInfoV.jsSources
111112
, hsSourceDirs = buildInfoV.hsSourceDirs
112-
, cSources = buildInfoV.cSources
113+
, cSources = map interpretSymbolicPathCWD buildInfoV.cSources
113114
, dependency = mempty
114115
, unknownTools = mempty
115116
, cppOptions = buildInfoV.cppOptions
116117
, targetBuildDepends = buildInfoV.targetBuildDepends
117118
, options = buildInfoV.options
118119
, allLanguages = Cabal.allLanguages buildInfoV
119120
, usedExtensions = Cabal.usedExtensions buildInfoV
120-
, includeDirs = buildInfoV.includeDirs
121+
, includeDirs = map interpretSymbolicPathCWD buildInfoV.includeDirs
121122
, extraLibs = buildInfoV.extraLibs
122-
, extraLibDirs = buildInfoV.extraLibDirs
123-
, frameworks = buildInfoV.frameworks
123+
, extraLibDirs = map interpretSymbolicPathCWD buildInfoV.extraLibDirs
124+
, frameworks = map interpretSymbolicPathCWD buildInfoV.frameworks
124125
}
125126

126127
-- | Iterate on all three dependency list given, and transform and sort them

src/Stack/ComponentFile.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ import Distribution.PackageDescription
3636
( BenchmarkInterface (..), TestSuiteInterface (..) )
3737
import Distribution.Text ( display )
3838
import Distribution.Utils.Path
39-
( PackageDir, SourceDir, SymbolicPath, getSymbolicPath )
39+
( Pkg, Source, SymbolicPath, getSymbolicPath )
40+
import qualified Distribution.Utils.Path as Cabal
4041
import GHC.Records ( HasField )
4142
import qualified HiFileParser as Iface
4243
import Path
@@ -91,7 +92,7 @@ stackBenchmarkFiles bench =
9192
exposed :: [DotCabalDescriptor]
9293
exposed =
9394
case bench.interface of
94-
BenchmarkExeV10 _ fp -> [DotCabalMain fp]
95+
BenchmarkExeV10 _ fp -> [DotCabalMain $ getSymbolicPath fp]
9596
BenchmarkUnsupported _ -> []
9697

9798
bnames :: [DotCabalDescriptor]
@@ -113,7 +114,7 @@ stackTestSuiteFiles test =
113114
exposed :: [DotCabalDescriptor]
114115
exposed =
115116
case test.interface of
116-
TestSuiteExeV10 _ fp -> [DotCabalMain fp]
117+
TestSuiteExeV10 _ fp -> [DotCabalMain $ getSymbolicPath fp]
117118
TestSuiteLibV09 _ mn -> [DotCabalModule mn]
118119
TestSuiteUnsupported _ -> []
119120

@@ -168,7 +169,7 @@ stackLibraryFiles lib =
168169
-- | Get all files referenced by the component.
169170
resolveComponentFiles ::
170171
( CAndJsSources rec
171-
, HasField "hsSourceDirs" rec [SymbolicPath PackageDir SourceDir]
172+
, HasField "hsSourceDirs" rec [SymbolicPath Pkg (Cabal.Dir Source)]
172173
)
173174
=> NamedComponent
174175
-> rec

src/Stack/Package.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ import Distribution.Simple.PackageDescription ( readHookedBuildInfo )
6161
import Distribution.System ( OS (..), Arch, Platform (..) )
6262
import Distribution.Text ( display )
6363
import qualified Distribution.Types.CondTree as Cabal
64-
import Distribution.Utils.Path ( getSymbolicPath )
64+
import Distribution.Utils.Path ( makeSymbolicPath, getSymbolicPath )
6565
import Distribution.Verbosity ( silent )
6666
import Distribution.Version
6767
( anyVersion, mkVersion, orLaterVersion )
@@ -131,8 +131,8 @@ import RIO.Seq ((|>))
131131
--
132132
-- NOTE: not to be confused with BuildInfo, an Stack-internal datatype.
133133
readDotBuildinfo :: MonadIO m => Path Abs File -> m HookedBuildInfo
134-
readDotBuildinfo buildinfofp =
135-
liftIO $ readHookedBuildInfo silent (toFilePath buildinfofp)
134+
readDotBuildinfo =
135+
liftIO . readHookedBuildInfo silent Nothing . makeSymbolicPath . toFilePath
136136

137137
-- | Resolve a parsed Cabal file into a t'Package', which contains all of the
138138
-- info needed for Stack to build the t'Package' given the current

src/Stack/PackageFile.hs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import qualified Data.Set as S
2020
import Distribution.CabalSpecVersion ( CabalSpecVersion )
2121
import qualified Distribution.PackageDescription as Cabal
2222
import Distribution.Simple.Glob ( matchDirFileGlob )
23+
import Distribution.Utils.Path ( makeSymbolicPath, getSymbolicPath )
2324
import Path ( parent, (</>) )
2425
import Path.Extra ( forgivingResolveFile, rejectMissingFile )
2526
import Path.IO ( doesFileExist )
@@ -121,9 +122,9 @@ resolveGlobFiles cabalFileVersion =
121122
FilePath
122123
-> FilePath
123124
-> RIO GetPackageFileContext [FilePath]
124-
matchDirFileGlob' dir glob =
125+
matchDirFileGlob' dir glob = map getSymbolicPath <$> do
125126
catch
126-
(liftIO (matchDirFileGlob minBound cabalFileVersion dir glob))
127+
(liftIO $ matchDirFileGlob minBound cabalFileVersion (Just $ makeSymbolicPath dir) (makeSymbolicPath glob))
127128
( \(e :: IOException) ->
128129
if isUserError e
129130
then do
@@ -183,9 +184,9 @@ getPackageFile pkg cabalFP =
183184
stackPackageFileFromCabal :: Cabal.PackageDescription -> StackPackageFile
184185
stackPackageFileFromCabal cabalPkg =
185186
StackPackageFile
186-
(Cabal.extraSrcFiles cabalPkg)
187-
(Cabal.dataDir cabalPkg)
188-
(Cabal.dataFiles cabalPkg)
187+
(map getSymbolicPath $ Cabal.extraSrcFiles cabalPkg)
188+
(getSymbolicPath $ Cabal.dataDir cabalPkg)
189+
(map getSymbolicPath $ Cabal.dataFiles cabalPkg)
189190

190191
insertComponentFile ::
191192
PackageComponentFile

src/Stack/SDist.hs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -572,18 +572,7 @@ checkPackageInExtractedTarball pkgDir = do
572572
, flow "for common mistakes using Cabal version"
573573
, fromString $ versionString cabalVersion <> "."
574574
]
575-
let pkgChecks =
576-
-- MSS 2017-12-12: Try out a few different variants of pkgDesc to try
577-
-- and provoke an error or warning. I don't know why, but when using
578-
-- `Just pkgDesc`, it appears that Cabal does not detect that `^>=` is
579-
-- used with `cabal-version: 1.24` or earlier. It seems like pkgDesc
580-
-- (the one we create) does not populate the `buildDepends` field,
581-
-- whereas flattenPackageDescription from Cabal does. In any event,
582-
-- using `Nothing` seems more logical for this check anyway, and the
583-
-- fallback to `Just pkgDesc` is just a crazy sanity check.
584-
case Check.checkPackage gpd of
585-
[] -> Check.checkConfiguredPackage pkgDesc
586-
x -> x
575+
let pkgChecks = Check.checkPackage gpd
587576
fileChecks <-
588577
liftIO $ Check.checkPackageFiles minBound pkgDesc (toFilePath pkgDir)
589578
let checks = pkgChecks ++ fileChecks

src/Stack/Types/Component.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ import Distribution.ModuleName ( ModuleName )
3131
import Distribution.PackageDescription
3232
( BenchmarkInterface, Dependency, TestSuiteInterface )
3333
import Distribution.Simple ( Extension, Language )
34-
import Distribution.Utils.Path ( PackageDir, SourceDir, SymbolicPath )
34+
import Distribution.Utils.Path ( Pkg, Source, SymbolicPath )
35+
import qualified Distribution.Utils.Path as Cabal
3536
import GHC.Records ( HasField (..) )
3637
import Stack.Prelude
3738
import Stack.Types.ComponentUtils
@@ -133,7 +134,7 @@ data StackBuildInfo = StackBuildInfo
133134
-- ^ Only used in file gathering. See usage in "Stack.ComponentFile" module.
134135
, jsSources :: [FilePath]
135136
-- ^ Only used in file gathering. See usage in "Stack.ComponentFile" module.
136-
, hsSourceDirs :: [SymbolicPath PackageDir SourceDir]
137+
, hsSourceDirs :: [SymbolicPath Pkg (Cabal.Dir Source)]
137138
-- ^ Only used in file & opts gathering. See usage in "Stack.ComponentFile"
138139
-- module for fle gathering.
139140
, cSources :: [FilePath]

0 commit comments

Comments
 (0)