2022-05-18 07:12:20 +03:00
|
|
|
module Foliage.UpdateCabalFile (rewritePackageVersion) where
|
|
|
|
|
2022-08-31 14:17:05 +03:00
|
|
|
import Distribution.Compat.Lens (set)
|
|
|
|
import Distribution.PackageDescription.PrettyPrint
|
|
|
|
import Distribution.Simple.PackageDescription
|
|
|
|
import Distribution.Types.Lens
|
2022-05-18 07:12:20 +03:00
|
|
|
import Distribution.Types.Version
|
2022-08-31 14:17:05 +03:00
|
|
|
import Distribution.Verbosity
|
2022-05-18 07:12:20 +03:00
|
|
|
|
|
|
|
rewritePackageVersion ::
|
|
|
|
-- | path to @.cabal@ file
|
|
|
|
FilePath ->
|
|
|
|
-- | new version
|
|
|
|
Version ->
|
|
|
|
IO ()
|
|
|
|
rewritePackageVersion cabalPath ver = do
|
2022-08-31 14:17:05 +03:00
|
|
|
gpd <- readGenericPackageDescription normal cabalPath
|
|
|
|
writeGenericPackageDescription cabalPath (set (packageDescription . package . pkgVersion) ver gpd)
|