Skip to content
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

Support (only) Cabal 3.14 #103

Merged
merged 3 commits into from
Sep 28, 2024
Merged
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
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ jobs:
name: ghc ${{ matrix.ghc }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
cabal: ["3.8"]
ghc:
- "8.8.4"
- "8.10.7"
- "9.0.2"
- "9.2.4"
- "9.4.2"
- "9.4.8"
- "9.6.3"
- "9.8.1"
- "9.10.1"
Expand Down
2 changes: 1 addition & 1 deletion extensions.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ library
-- this causes problems in practice let's
-- revisit this decision and come up with
-- another approach.
, Cabal ^>= 3.12
, Cabal ^>= 3.14
, containers >= 0.6 && < 0.8
, directory ^>= 1.3
, filepath >= 1.4 && < 1.6
Expand Down
21 changes: 15 additions & 6 deletions src/Extensions/Cabal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ extractCabalExtensions GenericPackageDescription{..} = mconcat
foreignToExtensions = condTreeToExtensions (const []) foreignLibBuildInfo

exeToExtensions :: CondTree var deps Executable -> IO (Map FilePath ParsedExtensions)
exeToExtensions = condTreeToExtensions (\Executable{..} -> [modulePath]) buildInfo
exeToExtensions = condTreeToExtensions (\Executable{..} -> [getSymbolicPath modulePath]) buildInfo

testToExtensions :: CondTree var deps TestSuite -> IO (Map FilePath ParsedExtensions)
testToExtensions = condTreeToExtensions testMainPath testBuildInfo
where
testMainPath :: TestSuite -> [FilePath]
testMainPath TestSuite{..} = case testInterface of
TestSuiteExeV10 _ path -> [path]
TestSuiteExeV10 _ path -> [getSymbolicPath path]
TestSuiteLibV09 _ m -> [toModulePath m]
TestSuiteUnsupported _ -> []

Expand All @@ -133,7 +133,7 @@ extractCabalExtensions GenericPackageDescription{..} = mconcat
where
benchMainPath :: Benchmark -> [FilePath]
benchMainPath Benchmark{..} = case benchmarkInterface of
BenchmarkExeV10 _ path -> [path]
BenchmarkExeV10 _ path -> [getSymbolicPath path]
BenchmarkUnsupported _ -> []

condTreeToExtensions
Expand Down Expand Up @@ -399,16 +399,25 @@ toGhcExtension = \case
Cabal.TypeAbstractions -> Nothing
#endif
#if __GLASGOW_HASKELL__ >= 910
-- This branch cannot be satisfied yet but we're including it so
-- we don't forget to enable RequiredTypeArguments when it
-- becomes available.
Cabal.RequiredTypeArguments -> Just RequiredTypeArguments
Cabal.ExtendedLiterals -> Just ExtendedLiterals
Cabal.ListTuplePuns -> Just ListTuplePuns
#else
Cabal.RequiredTypeArguments -> Nothing
Cabal.ExtendedLiterals -> Nothing
Cabal.ListTuplePuns -> Nothing
#endif
#if __GLASGOW_HASKELL__ >= 912
-- This branch cannot be satisfied yet but we're including it so
-- we don't forget to enable RequiredTypeArguments when it
-- becomes available.
Cabal.NamedDefaults -> Just NamedDefaults
Cabal.MultilineStrings -> Just MultilineStrings
Cabal.OrPatterns -> Just OrPatterns
#else
Cabal.NamedDefaults -> Nothing
Cabal.MultilineStrings -> Nothing
Cabal.OrPatterns -> Nothing
#endif
-- GHC extensions, parsed by both Cabal and GHC, but don't have an Extension constructor
Cabal.Safe -> Nothing
Expand Down
Loading