foliage/app/Foliage/UpdateCabalFile.hs
2022-08-31 13:17:05 +02:00

19 lines
599 B
Haskell

module Foliage.UpdateCabalFile (rewritePackageVersion) where
import Distribution.Compat.Lens (set)
import Distribution.PackageDescription.PrettyPrint
import Distribution.Simple.PackageDescription
import Distribution.Types.Lens
import Distribution.Types.Version
import Distribution.Verbosity
rewritePackageVersion ::
-- | path to @.cabal@ file
FilePath ->
-- | new version
Version ->
IO ()
rewritePackageVersion cabalPath ver = do
gpd <- readGenericPackageDescription normal cabalPath
writeGenericPackageDescription cabalPath (set (packageDescription . package . pkgVersion) ver gpd)