Skip to content

Commit

Permalink
Add cabal-version 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
ffaf1 committed Dec 15, 2023
1 parent 7ba955f commit 43c3cc0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
8 changes: 6 additions & 2 deletions Cabal-syntax/src/Distribution/CabalSpecVersion.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ data CabalSpecVersion
CabalSpecV3_4
| CabalSpecV3_6
| CabalSpecV3_8
-- 3.10: no changes
| -- 3.10: no changes
CabalSpecV3_12
deriving (Eq, Ord, Show, Read, Enum, Bounded, Typeable, Data, Generic)

instance Binary CabalSpecVersion
Expand All @@ -43,6 +44,7 @@ instance NFData CabalSpecVersion where rnf = genericRnf
--
-- @since 3.0.0.0
showCabalSpecVersion :: CabalSpecVersion -> String
showCabalSpecVersion CabalSpecV3_12 = "3.12"
showCabalSpecVersion CabalSpecV3_8 = "3.8"
showCabalSpecVersion CabalSpecV3_6 = "3.6"
showCabalSpecVersion CabalSpecV3_4 = "3.4"
Expand All @@ -63,13 +65,14 @@ showCabalSpecVersion CabalSpecV1_2 = "1.2"
showCabalSpecVersion CabalSpecV1_0 = "1.0"

cabalSpecLatest :: CabalSpecVersion
cabalSpecLatest = CabalSpecV3_8
cabalSpecLatest = CabalSpecV3_12

-- | Parse 'CabalSpecVersion' from version digits.
--
-- It may fail if for recent versions the version is not exact.
cabalSpecFromVersionDigits :: [Int] -> Maybe CabalSpecVersion
cabalSpecFromVersionDigits v
| v == [3, 12] = Just CabalSpecV3_12
| v == [3, 8] = Just CabalSpecV3_8
| v == [3, 6] = Just CabalSpecV3_6
| v == [3, 4] = Just CabalSpecV3_4
Expand All @@ -92,6 +95,7 @@ cabalSpecFromVersionDigits v

-- | @since 3.4.0.0
cabalSpecToVersionDigits :: CabalSpecVersion -> [Int]
cabalSpecToVersionDigits CabalSpecV3_12 = [3, 12]
cabalSpecToVersionDigits CabalSpecV3_8 = [3, 8]
cabalSpecToVersionDigits CabalSpecV3_6 = [3, 6]
cabalSpecToVersionDigits CabalSpecV3_4 = [3, 4]
Expand Down
8 changes: 4 additions & 4 deletions Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ md5Check proxy md5Int = structureHash proxy @?= md5FromInteger md5Int
md5CheckGenericPackageDescription :: Proxy GenericPackageDescription -> Assertion
md5CheckGenericPackageDescription proxy = md5Check proxy
#if MIN_VERSION_base(4,19,0)
0x87037bc65fba873f53c03ce572a42229
0xc638caeb7531f107f64d12773f9430d0
#else
0x5817c798e23df281d794ad27754ad43f
0x7a231bff7bb37049ec7f2ebfd98d3243
#endif

md5CheckLocalBuildInfo :: Proxy LocalBuildInfo -> Assertion
md5CheckLocalBuildInfo proxy = md5Check proxy
#if MIN_VERSION_base(4,19,0)
0x83cb87bceb4c1634e7dda192c3ad6579
0x23942cff98237dc167ef90d64d7ef893
#else
0x4beeb42e94807be904bc5d15355c98cd
0xa4e9f8a7e1583906880d6ec2d1bbb14b
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ cabalVersionPrompt flags = getCabalVersion flags $ do
parseCabalVersion "2.4" = CabalSpecV2_4
parseCabalVersion "3.0" = CabalSpecV3_0
parseCabalVersion "3.4" = CabalSpecV3_4
parseCabalVersion "3.12" = CabalSpecV3_12
parseCabalVersion _ = defaultCabalVersion -- 2.4
displayCabalVersion :: CabalSpecVersion -> String
displayCabalVersion v = case v of
Expand Down

0 comments on commit 43c3cc0

Please sign in to comment.