mirror of
https://github.com/input-output-hk/foliage.git
synced 2024-12-02 07:54:45 +03:00
19 lines
599 B
Haskell
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)
|