Skip to content

Depend on Cabal-3.14.* #6703

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/stack.cabal linguist-generated=true
3 changes: 2 additions & 1 deletion Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import Distribution.Simple.Utils
import Distribution.Types.PackageName ( unPackageName )
import Distribution.Types.UnqualComponentName
( unUnqualComponentName )
import Distribution.Utils.Path ( interpretSymbolicPathCWD )
import Distribution.Verbosity ( Verbosity, normal )
import System.FilePath ( (</>) )

Expand All @@ -47,7 +48,7 @@ generateBuildModule ::
-> LocalBuildInfo
-> IO ()
generateBuildModule verbosity pkg lbi = do
let dir = autogenPackageModulesDir lbi
let dir = interpretSymbolicPathCWD (autogenPackageModulesDir lbi)
createDirectoryIfMissingVerbose verbosity True dir
withLibLBI pkg lbi $ \_ libcfg -> do
withExeLBI pkg lbi $ \exe clbi ->
Expand Down
4 changes: 2 additions & 2 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ homepage: http://haskellstack.org
custom-setup:
dependencies:
- base >= 4.14.3.0 && < 5
- Cabal < 3.12
- Cabal >= 3.14 && < 3.16
- filepath
extra-source-files:
# note: leaving out 'package.yaml' because it causes confusion with hackage metadata revisions
Expand Down Expand Up @@ -58,7 +58,7 @@ ghc-options:
- -optP-Wno-nonportable-include-path
dependencies:
- base >= 4.16.0.0 && < 5
- Cabal >= 3.8.1.0 && < 3.12
- Cabal >= 3.14 && < 3.16
- aeson >= 2.0.3.0
- aeson-warning-parser >= 0.1.1
- ansi-terminal >= 1.0.2
Expand Down
13 changes: 7 additions & 6 deletions src/Stack/Component.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import Distribution.PackageDescription
import Distribution.Types.BuildInfo ( BuildInfo )
import Distribution.Package ( mkPackageName )
import qualified Distribution.PackageDescription as Cabal
import Distribution.Utils.Path (interpretSymbolicPathCWD)
import GHC.Records ( HasField )
import Stack.Prelude
import Stack.Types.Component
Expand Down Expand Up @@ -74,7 +75,7 @@ stackExecutableFromCabal :: Executable -> StackExecutable
stackExecutableFromCabal cabalExecutable = StackExecutable
{ name = fromCabalName cabalExecutable.exeName
, buildInfo = stackBuildInfoFromCabal cabalExecutable.buildInfo
, modulePath = cabalExecutable.modulePath
, modulePath = interpretSymbolicPathCWD cabalExecutable.modulePath
}

stackForeignLibraryFromCabal :: ForeignLib -> StackForeignLibrary
Expand Down Expand Up @@ -108,20 +109,20 @@ stackBuildInfoFromCabal buildInfoV = gatherComponentToolsAndDepsFromCabal
StackBuildInfo
{ buildable = buildInfoV.buildable
, otherModules = buildInfoV.otherModules
, jsSources = buildInfoV.jsSources
, jsSources = map interpretSymbolicPathCWD buildInfoV.jsSources
, hsSourceDirs = buildInfoV.hsSourceDirs
, cSources = buildInfoV.cSources
, cSources = map interpretSymbolicPathCWD buildInfoV.cSources
, dependency = mempty
, unknownTools = mempty
, cppOptions = buildInfoV.cppOptions
, targetBuildDepends = buildInfoV.targetBuildDepends
, options = buildInfoV.options
, allLanguages = Cabal.allLanguages buildInfoV
, usedExtensions = Cabal.usedExtensions buildInfoV
, includeDirs = buildInfoV.includeDirs
, includeDirs = map interpretSymbolicPathCWD buildInfoV.includeDirs
, extraLibs = buildInfoV.extraLibs
, extraLibDirs = buildInfoV.extraLibDirs
, frameworks = buildInfoV.frameworks
, extraLibDirs = map interpretSymbolicPathCWD buildInfoV.extraLibDirs
, frameworks = map interpretSymbolicPathCWD buildInfoV.frameworks
}

-- | Iterate on all three dependency list given, and transform and sort them
Expand Down
9 changes: 5 additions & 4 deletions src/Stack/ComponentFile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ import Distribution.PackageDescription
( BenchmarkInterface (..), TestSuiteInterface (..) )
import Distribution.Text ( display )
import Distribution.Utils.Path
( PackageDir, SourceDir, SymbolicPath, getSymbolicPath )
( Pkg, Source, SymbolicPath, getSymbolicPath )
import qualified Distribution.Utils.Path as Cabal
import GHC.Records ( HasField )
import qualified HiFileParser as Iface
import Path
Expand Down Expand Up @@ -87,7 +88,7 @@ stackBenchmarkFiles bench =
exposed :: [DotCabalDescriptor]
exposed =
case bench.interface of
BenchmarkExeV10 _ fp -> [DotCabalMain fp]
BenchmarkExeV10 _ fp -> [DotCabalMain $ getSymbolicPath fp]
BenchmarkUnsupported _ -> []

bnames :: [DotCabalDescriptor]
Expand All @@ -109,7 +110,7 @@ stackTestSuiteFiles test =
exposed :: [DotCabalDescriptor]
exposed =
case test.interface of
TestSuiteExeV10 _ fp -> [DotCabalMain fp]
TestSuiteExeV10 _ fp -> [DotCabalMain $ getSymbolicPath fp]
TestSuiteLibV09 _ mn -> [DotCabalModule mn]
TestSuiteUnsupported _ -> []

Expand Down Expand Up @@ -164,7 +165,7 @@ stackLibraryFiles lib =
-- | Get all files referenced by the component.
resolveComponentFiles ::
( CAndJsSources rec
, HasField "hsSourceDirs" rec [SymbolicPath PackageDir SourceDir]
, HasField "hsSourceDirs" rec [SymbolicPath Pkg (Cabal.Dir Source)]
)
=> NamedComponent
-> rec
Expand Down
6 changes: 3 additions & 3 deletions src/Stack/Package.hs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import Distribution.Simple.PackageDescription ( readHookedBuildInfo )
import Distribution.System ( OS (..), Arch, Platform (..) )
import Distribution.Text ( display )
import qualified Distribution.Types.CondTree as Cabal
import Distribution.Utils.Path ( getSymbolicPath )
import Distribution.Utils.Path ( makeSymbolicPath, getSymbolicPath )
import Distribution.Verbosity ( silent )
import Distribution.Version
( anyVersion, mkVersion, orLaterVersion )
Expand Down Expand Up @@ -125,8 +125,8 @@ import RIO.Seq ((|>))
--
-- NOTE: not to be confused with BuildInfo, an Stack-internal datatype.
readDotBuildinfo :: MonadIO m => Path Abs File -> m HookedBuildInfo
readDotBuildinfo buildinfofp =
liftIO $ readHookedBuildInfo silent (toFilePath buildinfofp)
readDotBuildinfo =
liftIO . readHookedBuildInfo silent Nothing . makeSymbolicPath . toFilePath

-- | Resolve a parsed Cabal file into a 'Package', which contains all of the
-- info needed for Stack to build the 'Package' given the current configuration.
Expand Down
11 changes: 6 additions & 5 deletions src/Stack/PackageFile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import qualified Data.Set as S
import Distribution.CabalSpecVersion ( CabalSpecVersion )
import qualified Distribution.PackageDescription as Cabal
import Distribution.Simple.Glob ( matchDirFileGlob )
import Distribution.Utils.Path ( makeSymbolicPath, getSymbolicPath )
import Path ( parent, (</>) )
import Path.Extra ( forgivingResolveFile, rejectMissingFile )
import Path.IO ( doesFileExist )
Expand Down Expand Up @@ -102,9 +103,9 @@ resolveGlobFiles cabalFileVersion =
FilePath
-> FilePath
-> RIO GetPackageFileContext [FilePath]
matchDirFileGlob' dir glob =
matchDirFileGlob' dir glob = map getSymbolicPath <$> do
catch
(liftIO (matchDirFileGlob minBound cabalFileVersion dir glob))
(liftIO $ matchDirFileGlob minBound cabalFileVersion (Just $ makeSymbolicPath dir) (makeSymbolicPath glob))
( \(e :: IOException) ->
if isUserError e
then do
Expand Down Expand Up @@ -162,9 +163,9 @@ getPackageFile pkg cabalFP =
stackPackageFileFromCabal :: Cabal.PackageDescription -> StackPackageFile
stackPackageFileFromCabal cabalPkg =
StackPackageFile
(Cabal.extraSrcFiles cabalPkg)
(Cabal.dataDir cabalPkg)
(Cabal.dataFiles cabalPkg)
(map getSymbolicPath $ Cabal.extraSrcFiles cabalPkg)
(getSymbolicPath $ Cabal.dataDir cabalPkg)
(map getSymbolicPath $ Cabal.dataFiles cabalPkg)

insertComponentFile ::
PackageComponentFile
Expand Down
13 changes: 1 addition & 12 deletions src/Stack/SDist.hs
Original file line number Diff line number Diff line change
Expand Up @@ -578,18 +578,7 @@ checkPackageInExtractedTarball pkgDir = do
, flow "for common mistakes using Cabal version"
, fromString $ versionString cabalVersion <> "."
]
let pkgChecks =
-- MSS 2017-12-12: Try out a few different variants of pkgDesc to try
-- and provoke an error or warning. I don't know why, but when using
-- `Just pkgDesc`, it appears that Cabal does not detect that `^>=` is
-- used with `cabal-version: 1.24` or earlier. It seems like pkgDesc
-- (the one we create) does not populate the `buildDepends` field,
-- whereas flattenPackageDescription from Cabal does. In any event,
-- using `Nothing` seems more logical for this check anyway, and the
-- fallback to `Just pkgDesc` is just a crazy sanity check.
case Check.checkPackage gpd Nothing of
[] -> Check.checkPackage gpd (Just pkgDesc)
x -> x
let pkgChecks = Check.checkPackage gpd
fileChecks <-
liftIO $ Check.checkPackageFiles minBound pkgDesc (toFilePath pkgDir)
let checks = pkgChecks ++ fileChecks
Expand Down
5 changes: 3 additions & 2 deletions src/Stack/Types/Component.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ import Distribution.ModuleName ( ModuleName )
import Distribution.PackageDescription
( BenchmarkInterface, Dependency, TestSuiteInterface )
import Distribution.Simple ( Extension, Language )
import Distribution.Utils.Path ( PackageDir, SourceDir, SymbolicPath )
import Distribution.Utils.Path ( Pkg, Source, SymbolicPath )
import qualified Distribution.Utils.Path as Cabal
import GHC.Records ( HasField (..) )
import Stack.Prelude
import Stack.Types.ComponentUtils
Expand Down Expand Up @@ -133,7 +134,7 @@ data StackBuildInfo = StackBuildInfo
-- ^ Only used in file gathering. See usage in "Stack.ComponentFile" module.
, jsSources :: [FilePath]
-- ^ Only used in file gathering. See usage in "Stack.ComponentFile" module.
, hsSourceDirs :: [SymbolicPath PackageDir SourceDir]
, hsSourceDirs :: [SymbolicPath Pkg (Cabal.Dir Source)]
-- ^ Only used in file & opts gathering. See usage in "Stack.ComponentFile"
-- module for fle gathering.
, cSources :: [FilePath]
Expand Down
10 changes: 5 additions & 5 deletions stack.cabal

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ snapshot: lts-23.14 # GHC 9.8.4
extra-deps:
# lts-23.14 provides hpack-0.37.0
- hpack-0.38.1
- Cabal-syntax-3.14.1.0
- Cabal-3.14.1.1

docker:
enable: false
Expand Down
14 changes: 14 additions & 0 deletions stack.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@ packages:
size: 3798
original:
hackage: hpack-0.38.1
- completed:
hackage: Cabal-syntax-3.14.1.0@sha256:557a2b20dc85f052c86c5a06dcbd7c6995f2d0391bbff8e62c90b4b5975211da,7380
pantry-tree:
sha256: b515a5cfb9da09c0aae57ca223281d06dad9d11dfc466fc47d2e83720a078fea
size: 10977
original:
hackage: Cabal-syntax-3.14.1.0
- completed:
hackage: Cabal-3.14.1.1@sha256:424e9f5053a17d4598f1d2b9ae657e6f039233a127b7adb148ded7a8d0cb8103,13720
pantry-tree:
sha256: 10fef40e6b2a9f061b9da5fa5daccdbf8ef16f919ed58a9f3604bacb0ba75b80
size: 12219
original:
hackage: Cabal-3.14.1.1
snapshots:
- completed:
sha256: 1964d439d2a152be4238053f3f997a09fb348391984daab86d724975ef9a423f
Expand Down