staversion 0.2.4.1 → 0.2.4.2
raw patch · 5 files changed
+64/−25 lines, 5 filesdep ~Cabaldep ~aesondep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: Cabal, aeson, base, bytestring, hashable, megaparsec, optparse-applicative, semigroups, text, transformers, transformers-compat
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- src/Staversion/Internal/BuildPlan/Stackage.hs +14/−3
- src/Staversion/Internal/BuildPlan/V1.hs +13/−1
- src/Staversion/Internal/Version.hs +14/−2
- staversion.cabal +19/−19
ChangeLog.md view
@@ -1,5 +1,9 @@ # Revision history for staversion +## 0.2.4.2 -- 2023-03-16++* Support Cabal >= 3.6 and aeson >= 2 (#10)+ ## 0.2.4.1 -- 2021-05-16 * Confirm test with `base-4.15.0.0` and `Cabal-3.4.0.0`.
src/Staversion/Internal/BuildPlan/Stackage.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- | -- Module: Staversion.Internal.BuildPlan.Stackage -- Description: dealing with Stackage and build-plan repositories online.@@ -7,6 +8,7 @@ -- -- This module is meant to be exposed only to -- "Staversion.Internal.BuildPlan" and test modules.+ module Staversion.Internal.BuildPlan.Stackage ( -- * High level API ExactResolver(..),@@ -27,11 +29,16 @@ import qualified Data.Aeson as Aeson import qualified Data.ByteString.Lazy as BSL import Data.Function (on)+#if MIN_VERSION_aeson(2,0,0)+import Data.Aeson.Key (toString)+import qualified Data.Aeson.KeyMap as HM+#else+import Data.Text (unpack) import qualified Data.HashMap.Strict as HM+#endif import qualified Data.Map as M import Data.Maybe (listToMaybe) import Data.List (sortBy)-import Data.Text (unpack) import Data.Word (Word) import Data.IORef (IORef) import System.IO.Error (ioError, userError)@@ -99,12 +106,16 @@ newtype DisamMap = DisamMap { unDisamMap :: M.Map PartialResolver ExactResolver } instance FromJSON DisamMap where- parseJSON (Object o) = fmap (DisamMap . M.fromList) $ mapM parsePair $ HM.toList o where+ parseJSON (Object o) = fmap (DisamMap . M.fromList) $ mapM parsePair $ HM.toList o+ where parsePair (k,v) = (,) <$> parseKey k <*> parseValue v- parseKey key = maybe empty return $ parseResolverString $ unpack key+ parseKey key = maybe empty return $ parseResolverString $ toString key parseValue v = (expectExact . parseResolverString) =<< parseJSON v expectExact (Just (PartialExact e)) = return e expectExact _ = empty+#if !MIN_VERSION_aeson(2,0,0)+ toString = unpack+#endif parseJSON _ = empty parseDisambiguator :: BSL.ByteString -- ^ disambiguation JSON text.
src/Staversion/Internal/BuildPlan/V1.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- | -- Module: Staversion.Internal.BuildPlan.V1 -- Description: The legacy "version 1" of build plan YAML files@@ -6,6 +7,7 @@ -- __This is an internal module. End-users should not use it.__ -- -- @since 0.2.4.0+ module Staversion.Internal.BuildPlan.V1 ( fetchBuildPlanYAML, parseBuildPlanMapYAML,@@ -13,7 +15,12 @@ ) where import Control.Applicative (empty)+ import Data.Aeson (FromJSON(..), (.:), Value(..), Object)+#if MIN_VERSION_aeson(2,0,0)+import Data.Aeson.KeyMap (toHashMapText)+#endif+ import qualified Data.ByteString as BS import qualified Data.ByteString.Lazy as BSL import qualified Data.HashMap.Strict as HM@@ -41,7 +48,9 @@ newtype V1BuildPlanMap = V1BuildPlanMap (HM.HashMap PackageName Version) deriving (Show,Eq) instance FromJSON V1BuildPlanMap where- parseJSON (Object object) = (\p1 p2 -> V1BuildPlanMap $ p1 <> p2) <$> core_packages <*> other_packages where+ parseJSON (Object object) =+ (\p1 p2 -> V1BuildPlanMap $ toHashMapText p1 <> toHashMapText p2) <$> core_packages <*> other_packages+ where core_packages = parseSysInfo =<< (object .: "system-info") parseSysInfo (Object o) = parseCorePackages =<< (o .: "core-packages") parseSysInfo _ = empty@@ -53,6 +62,9 @@ parsePackages _ = empty parsePackageObject (Object o) = unVersionJSON <$> (o .: "version") parsePackageObject _ = empty+#if !MIN_VERSION_aeson(2,0,0)+ toHashMapText = id+#endif parseJSON _ = empty toBuildPlanMap :: V1BuildPlanMap -> BuildPlanMap
src/Staversion/Internal/Version.hs view
@@ -32,11 +32,24 @@ import Data.Maybe (listToMaybe, fromJust) import Data.Text (Text, unpack) -import qualified Distribution.Version as V #if MIN_VERSION_Cabal(2,2,0)++#if MIN_VERSION_Cabal(3,6,0)+import qualified Distribution.Types.VersionInterval.Legacy as V+#else+import qualified Distribution.Types.VersionInterval as V+#endif++import qualified Distribution.Version as V (simplifyVersionRange)+import qualified Distribution.Types.Version as V+import qualified Distribution.Types.VersionRange as V import qualified Distribution.Pretty as DP+ #else++import qualified Distribution.Version as V import qualified Distribution.Text as DT+ #endif import Data.Version (parseVersion)@@ -75,7 +88,6 @@ versionNumbers = V.versionBranch #endif- #if MIN_VERSION_Cabal(2,2,0)
staversion.cabal view
@@ -1,5 +1,5 @@ name: staversion-version: 0.2.4.1+version: 0.2.4.2 author: Toshio Ito <debug.ito@gmail.com> maintainer: Toshio Ito <debug.ito@gmail.com> license: BSD3@@ -31,7 +31,7 @@ test/data/stack/stack_multi.yaml, test/data/stack/stack_sample.yaml, test/data/stack/stack_empty_packages.yaml- + homepage: https://github.com/debug-ito/staversion bug-reports: https://github.com/debug-ito/staversion/issues @@ -64,25 +64,25 @@ Staversion.Internal.HTTP, Staversion.Internal.Megaparsec, Staversion.Internal.EIO- build-depends: base >=4.8 && <4.16,+ build-depends: base >=4.8 && <4.19, unordered-containers >=0.2.3 && <0.3,- hashable >=1.2.6.1 && <1.4,- aeson >=0.8.0 && <1.6,- text >=0.11.3 && <1.3,- bytestring >=0.10.0 && <0.11,+ hashable >=1.2.6.1 && <1.5,+ aeson >=0.8.0 && <2.2,+ text >=0.11.3 && <2.1,+ bytestring >=0.10.0 && <0.12, yaml >=0.8.3 && <0.12, filepath >=1.3.0 && <1.5, directory >=1.2.0 && <1.4,- optparse-applicative >=0.11.0 && <0.17,+ optparse-applicative >=0.11.0 && <0.18, containers >=0.5.5 && <0.7, http-client >=0.4.18 && <0.8, http-client-tls >=0.2.2 && <0.4, http-types >=0.8.6 && <0.13,- transformers >=0.3.0 && <0.6,- transformers-compat >=0.4.0 && <0.7,- megaparsec >=4.2.0 && <9.1,- semigroups >=0.18.0.1 && <0.20,- Cabal >=1.22.6.0 && <3.5,+ transformers >=0.3.0 && <0.7,+ transformers-compat >=0.4.0 && <0.8,+ megaparsec >=4.2.0 && <9.4,+ semigroups >=0.18.0.1 && <0.21,+ Cabal >=1.22.6.0 && <3.11, pretty >=1.1.2.0 && <1.2, ansi-wl-pprint >=0.6.7.3 && <0.7, process >=1.2.3.0 && <1.7@@ -92,9 +92,9 @@ hs-source-dirs: app main-is: Main.hs ghc-options: -Wall -fno-warn-unused-imports -rtsopts -threaded "-with-rtsopts=-N"- -- other-modules: - -- default-extensions: - -- other-extensions: + -- other-modules:+ -- default-extensions:+ -- other-extensions: build-depends: base, staversion test-suite spec@@ -104,7 +104,7 @@ ghc-options: -Wall -fno-warn-unused-imports -fno-warn-orphans "-with-rtsopts=-M512m" main-is: Spec.hs default-extensions: OverloadedStrings, QuasiQuotes- -- other-extensions: + -- other-extensions: other-modules: Staversion.Internal.BuildPlanSpec, Staversion.Internal.BuildPlan.StackageSpec, Staversion.Internal.BuildPlan.HackageSpec,@@ -138,13 +138,13 @@ default-extensions: OverloadedStrings if !flag(network-test) buildable: False- -- other-extensions: + -- other-extensions: other-modules: Staversion.Internal.TestUtil build-depends: base, staversion, http-client, http-client-tls, bytestring, Cabal, unordered-containers, text, hspec - + source-repository head type: git location: https://github.com/debug-ito/staversion.git