Skip to content

Commit a381fbe

Browse files
committed
Depend on Cabal-3.14.*
1 parent c998b53 commit a381fbe

12 files changed

+53
-42
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

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 ->

package.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ homepage: http://haskellstack.org
2626
custom-setup:
2727
dependencies:
2828
- base >= 4.14.3.0 && < 5
29-
- Cabal < 3.12
29+
- Cabal >= 3.14 && < 3.16
3030
- filepath
3131
extra-source-files:
3232
# note: leaving out 'package.yaml' because it causes confusion with hackage metadata revisions
@@ -58,7 +58,7 @@ ghc-options:
5858
- -optP-Wno-nonportable-include-path
5959
dependencies:
6060
- base >= 4.16.0.0 && < 5
61-
- Cabal >= 3.8.1.0 && < 3.12
61+
- Cabal >= 3.14 && < 3.16
6262
- aeson >= 2.0.3.0
6363
- aeson-warning-parser >= 0.1.1
6464
- ansi-terminal >= 1.0.2

src/Stack/Component.hs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import Distribution.PackageDescription
3636
import Distribution.Types.BuildInfo ( BuildInfo )
3737
import Distribution.Package ( mkPackageName )
3838
import qualified Distribution.PackageDescription as Cabal
39+
import Distribution.Utils.Path (interpretSymbolicPathCWD)
3940
import GHC.Records ( HasField )
4041
import Stack.Prelude
4142
import Stack.Types.Component
@@ -74,7 +75,7 @@ stackExecutableFromCabal :: Executable -> StackExecutable
7475
stackExecutableFromCabal cabalExecutable = StackExecutable
7576
{ name = fromCabalName cabalExecutable.exeName
7677
, buildInfo = stackBuildInfoFromCabal cabalExecutable.buildInfo
77-
, modulePath = cabalExecutable.modulePath
78+
, modulePath = interpretSymbolicPathCWD cabalExecutable.modulePath
7879
}
7980

8081
stackForeignLibraryFromCabal :: ForeignLib -> StackForeignLibrary
@@ -108,20 +109,20 @@ stackBuildInfoFromCabal buildInfoV = gatherComponentToolsAndDepsFromCabal
108109
StackBuildInfo
109110
{ buildable = buildInfoV.buildable
110111
, otherModules = buildInfoV.otherModules
111-
, jsSources = buildInfoV.jsSources
112+
, jsSources = map interpretSymbolicPathCWD buildInfoV.jsSources
112113
, hsSourceDirs = buildInfoV.hsSourceDirs
113-
, cSources = buildInfoV.cSources
114+
, cSources = map interpretSymbolicPathCWD buildInfoV.cSources
114115
, dependency = mempty
115116
, unknownTools = mempty
116117
, cppOptions = buildInfoV.cppOptions
117118
, targetBuildDepends = buildInfoV.targetBuildDepends
118119
, options = buildInfoV.options
119120
, allLanguages = Cabal.allLanguages buildInfoV
120121
, usedExtensions = Cabal.usedExtensions buildInfoV
121-
, includeDirs = buildInfoV.includeDirs
122+
, includeDirs = map interpretSymbolicPathCWD buildInfoV.includeDirs
122123
, extraLibs = buildInfoV.extraLibs
123-
, extraLibDirs = buildInfoV.extraLibDirs
124-
, frameworks = buildInfoV.frameworks
124+
, extraLibDirs = map interpretSymbolicPathCWD buildInfoV.extraLibDirs
125+
, frameworks = map interpretSymbolicPathCWD buildInfoV.frameworks
125126
}
126127

127128
-- | 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
@@ -32,7 +32,8 @@ import Distribution.PackageDescription
3232
( BenchmarkInterface (..), TestSuiteInterface (..) )
3333
import Distribution.Text ( display )
3434
import Distribution.Utils.Path
35-
( PackageDir, SourceDir, SymbolicPath, getSymbolicPath )
35+
( Pkg, Source, SymbolicPath, getSymbolicPath )
36+
import qualified Distribution.Utils.Path as Cabal
3637
import GHC.Records ( HasField )
3738
import qualified HiFileParser as Iface
3839
import Path
@@ -87,7 +88,7 @@ stackBenchmarkFiles bench =
8788
exposed :: [DotCabalDescriptor]
8889
exposed =
8990
case bench.interface of
90-
BenchmarkExeV10 _ fp -> [DotCabalMain fp]
91+
BenchmarkExeV10 _ fp -> [DotCabalMain $ getSymbolicPath fp]
9192
BenchmarkUnsupported _ -> []
9293

9394
bnames :: [DotCabalDescriptor]
@@ -109,7 +110,7 @@ stackTestSuiteFiles test =
109110
exposed :: [DotCabalDescriptor]
110111
exposed =
111112
case test.interface of
112-
TestSuiteExeV10 _ fp -> [DotCabalMain fp]
113+
TestSuiteExeV10 _ fp -> [DotCabalMain $ getSymbolicPath fp]
113114
TestSuiteLibV09 _ mn -> [DotCabalModule mn]
114115
TestSuiteUnsupported _ -> []
115116

@@ -164,7 +165,7 @@ stackLibraryFiles lib =
164165
-- | Get all files referenced by the component.
165166
resolveComponentFiles ::
166167
( CAndJsSources rec
167-
, HasField "hsSourceDirs" rec [SymbolicPath PackageDir SourceDir]
168+
, HasField "hsSourceDirs" rec [SymbolicPath Pkg (Cabal.Dir Source)]
168169
)
169170
=> NamedComponent
170171
-> rec

src/Stack/Package.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ import Distribution.Simple.PackageDescription ( readHookedBuildInfo )
5757
import Distribution.System ( OS (..), Arch, Platform (..) )
5858
import Distribution.Text ( display )
5959
import qualified Distribution.Types.CondTree as Cabal
60-
import Distribution.Utils.Path ( getSymbolicPath )
60+
import Distribution.Utils.Path ( makeSymbolicPath, getSymbolicPath )
6161
import Distribution.Verbosity ( silent )
6262
import Distribution.Version
6363
( anyVersion, mkVersion, orLaterVersion )
@@ -125,8 +125,8 @@ import RIO.Seq ((|>))
125125
--
126126
-- NOTE: not to be confused with BuildInfo, an Stack-internal datatype.
127127
readDotBuildinfo :: MonadIO m => Path Abs File -> m HookedBuildInfo
128-
readDotBuildinfo buildinfofp =
129-
liftIO $ readHookedBuildInfo silent (toFilePath buildinfofp)
128+
readDotBuildinfo =
129+
liftIO . readHookedBuildInfo silent Nothing . makeSymbolicPath . toFilePath
130130

131131
-- | Resolve a parsed Cabal file into a 'Package', which contains all of the
132132
-- info needed for Stack to build the 'Package' given the current configuration.

src/Stack/PackageFile.hs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import qualified Data.Set as S
1313
import Distribution.CabalSpecVersion ( CabalSpecVersion )
1414
import qualified Distribution.PackageDescription as Cabal
1515
import Distribution.Simple.Glob ( matchDirFileGlob )
16+
import Distribution.Utils.Path ( makeSymbolicPath, getSymbolicPath )
1617
import Path ( parent, (</>) )
1718
import Path.Extra ( forgivingResolveFile, rejectMissingFile )
1819
import Path.IO ( doesFileExist )
@@ -99,9 +100,9 @@ resolveGlobFiles cabalFileVersion =
99100
mapM resolveFileOrWarn names
100101

101102
matchDirFileGlob' :: FilePath -> FilePath -> RIO GetPackageFileContext [FilePath]
102-
matchDirFileGlob' dir glob =
103+
matchDirFileGlob' dir glob = map getSymbolicPath <$> do
103104
catch
104-
(liftIO (matchDirFileGlob minBound cabalFileVersion dir glob))
105+
(liftIO $ matchDirFileGlob minBound cabalFileVersion (Just $ makeSymbolicPath dir) (makeSymbolicPath glob))
105106
( \(e :: IOException) ->
106107
if isUserError e
107108
then do
@@ -159,9 +160,9 @@ getPackageFile pkg cabalFP =
159160
stackPackageFileFromCabal :: Cabal.PackageDescription -> StackPackageFile
160161
stackPackageFileFromCabal cabalPkg =
161162
StackPackageFile
162-
(Cabal.extraSrcFiles cabalPkg)
163-
(Cabal.dataDir cabalPkg)
164-
(Cabal.dataFiles cabalPkg)
163+
(map getSymbolicPath $ Cabal.extraSrcFiles cabalPkg)
164+
(getSymbolicPath $ Cabal.dataDir cabalPkg)
165+
(map getSymbolicPath $ Cabal.dataFiles cabalPkg)
165166

166167
insertComponentFile ::
167168
PackageComponentFile

src/Stack/SDist.hs

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

stack.cabal

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

stack.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ snapshot: lts-23.14 # GHC 9.8.4
33
extra-deps:
44
# lts-23.14 provides hpack-0.37.0
55
- hpack-0.38.0
6+
- Cabal-syntax-3.14.1.0
7+
- Cabal-3.14.1.1
68

79
docker:
810
enable: false

stack.yaml.lock

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,26 @@
55

66
packages:
77
- completed:
8-
hackage: hpack-0.38.0@sha256:9b4603d67f1963b3f8cae9229b223f37dbf8ad1c19966e12089479f4d8541f7f,5187
8+
hackage: hpack-0.38.0@sha256:c4d5fa1c8b0ceee6564218eeb5702af5c3ada84dcb6611e7f8226f193176f80a,5430
99
pantry-tree:
10-
sha256: bb8a112ef61beddd265ec807efa3a78c9d54977c4d5cffad00640d100898aa54
10+
sha256: 048443821239e2123e7ae2abc53855d560f4ab60246a88637ebbdd174aba1b2b
1111
size: 3742
1212
original:
1313
hackage: hpack-0.38.0
14+
- completed:
15+
hackage: Cabal-syntax-3.14.1.0@sha256:557a2b20dc85f052c86c5a06dcbd7c6995f2d0391bbff8e62c90b4b5975211da,7380
16+
pantry-tree:
17+
sha256: b515a5cfb9da09c0aae57ca223281d06dad9d11dfc466fc47d2e83720a078fea
18+
size: 10977
19+
original:
20+
hackage: Cabal-syntax-3.14.1.0
21+
- completed:
22+
hackage: Cabal-3.14.1.1@sha256:424e9f5053a17d4598f1d2b9ae657e6f039233a127b7adb148ded7a8d0cb8103,13720
23+
pantry-tree:
24+
sha256: 10fef40e6b2a9f061b9da5fa5daccdbf8ef16f919ed58a9f3604bacb0ba75b80
25+
size: 12219
26+
original:
27+
hackage: Cabal-3.14.1.1
1428
snapshots:
1529
- completed:
1630
sha256: 1964d439d2a152be4238053f3f997a09fb348391984daab86d724975ef9a423f

0 commit comments

Comments
 (0)