cabal-bounds 1.0.5 → 1.1.0
raw patch · 5 files changed
+27/−19 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG +6/−0
- README.md +8/−15
- cabal-bounds.cabal +1/−1
- lib/CabalBounds/Update.hs +11/−2
- tests/goldenFiles/UpdateByHaskellPlatform.cabal +1/−1
CHANGELOG view
@@ -1,3 +1,9 @@+1.1.0+-----+* By default 'update' now only widens the lower and upper bounds.+ So it's easier to raise the upper bounds by just calling+ 'cabal install --allow-newer' and then 'cabal-bounds update'.+ 1.0.4 ----- * Raise upper bounds of dependencies
README.md view
@@ -34,20 +34,21 @@ # update the version infos of all libraries $> cabal update - # drops the upper bound of all dependencies of the cabal file in the working directory- $> cabal-bounds drop --upper- # create a cabal sandbox for building your project, this ensures that you're really using # the newest available versions of the dependencies, otherwise you would be constraint # to the already installed versions $> cabal sandbox init - # build your project- $> cabal install+ # build your project and allow newer library versions used as specified by the cabal file.+ $> cabal install --allow-newer # update the upper bound of all dependencies of the cabal file in the working directory+ # if their upper bound is lower then the version used by the build $> cabal-bounds update --upper +If you're leaving out the `--upper` flag then `update` will widen the bounds on both directions.+So the upper bound will only be updated it it's lower and the lower bound only if it's greater.+ Example: Update Bounds by Haskell Platform ========================================== @@ -70,16 +71,8 @@ # build and test the project - # initialize the lower bounds of libraries not present in the haskell platform- $> cabal-bounds update --lower --missing-- # drop the upper bounds to test your project with the newest available library versions- $> cabal-bounds drop --upper-- # build and test the project-- # set the upper bounds to the ones used in the current build- $> cabal-bounds update --upper+ # initialize the bounds not present in the haskell platform+ $> cabal-bounds update Example: Update Bounds by File ==============================
cabal-bounds.cabal view
@@ -1,5 +1,5 @@ name: cabal-bounds-version: 1.0.5+version: 1.1.0 cabal-version: >=1.9.2 build-type: Simple license: BSD3
lib/CabalBounds/Update.hs view
@@ -48,7 +48,7 @@ lowerVersion <- HM.lookup pkgName_ libs let newLowerVersion = comp `compOf` lowerVersion newLowerBound = V.LowerBound newLowerVersion V.InclusiveBound- newIntervals = (versionRange_ ^. CL.intervals) & _head . CL.lowerBound .~ newLowerBound+ newIntervals = (versionRange_ ^. CL.intervals) & _head . CL.lowerBound %~ updateIf (>) newLowerBound vrange = fromMaybe (V.orLaterVersion newLowerVersion) (mkVersionRange newIntervals) return $ dep & CL.versionRange .~ vrange where@@ -56,6 +56,11 @@ versionRange_ = dep ^. CL.versionRange lowerBound_ = fromMaybe CL.noLowerBound $ versionRange_ ^? CL.intervals . _head . CL.lowerBound + updateIf f newBound oldBound+ | f oldBound newBound = newBound+ | otherwise = oldBound++ updateDependency (UpdateUpper comp ifMissing) libs dep = fromMaybe dep $ if ifMissing && upperBound_ /= V.NoUpperBound@@ -64,13 +69,17 @@ upperVersion <- HM.lookup pkgName_ libs let newUpperVersion = nextVersion comp upperVersion newUpperBound = V.UpperBound newUpperVersion V.ExclusiveBound- newIntervals = (versionRange_ ^. CL.intervals) & _last . CL.upperBound .~ newUpperBound+ newIntervals = (versionRange_ ^. CL.intervals) & _last . CL.upperBound %~ updateIf (<) newUpperBound vrange = fromMaybe (V.earlierVersion newUpperVersion) (mkVersionRange newIntervals) return $ dep & CL.versionRange .~ vrange where versionRange_ = dep ^. CL.versionRange pkgName_ = dep ^. CL.packageName . _Wrapped upperBound_ = fromMaybe V.NoUpperBound $ versionRange_ ^? CL.intervals . _last . CL.upperBound++ updateIf f newBound oldBound+ | f oldBound newBound = newBound+ | otherwise = oldBound updateDependency (UpdateBoth lowerComp upperComp ifMissing) libs dep = updateDependency (UpdateLower lowerComp ifMissing) libs $
tests/goldenFiles/UpdateByHaskellPlatform.cabal view
@@ -17,7 +17,7 @@ A >=0.1 && <0.2, B >=0.2 && <0.3, C >=0.1 && <0.4,- directory >=1.2.0.1 && <1.3+ directory >=1.0 && <1.3 hs-source-dirs: src other-modules: Paths_setup_config