proto-lens-setup 0.4.0.9 → 0.4.0.10
raw patch · 3 files changed
+56/−9 lines, 3 filesdep ~Cabaldep ~basedep ~bytestringPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: Cabal, base, bytestring, containers
API changes (from Hackage documentation)
Files
- Changelog.md +4/−0
- proto-lens-setup.cabal +6/−6
- src/Data/ProtoLens/Setup.hs +46/−3
Changelog.md view
@@ -1,5 +1,9 @@ # Changelog for `proto-lens-setup` +## v0.4.0.10+- Support GHC 9.12 (add compatibility shim for Cabal >= 3.14 `SymbolicPath` API).+- Support GHC 9.14.+ ## v0.4.0.9 - Relax upper bounds for ghc-9.10.
proto-lens-setup.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.37.0.+-- This file has been generated from package.yaml by hpack version 0.39.1. -- -- see: https://github.com/sol/hpack name: proto-lens-setup-version: 0.4.0.9+version: 0.4.0.10 synopsis: Cabal support for codegen with proto-lens. description: This package provides Cabal support for the @proto-lens@ package. It automatically generates Haskell source files from protocol buffer@@ -68,10 +68,10 @@ hs-source-dirs: src build-depends:- Cabal >=2.0 && <3.13- , base >=4.10 && <4.21- , bytestring >=0.10 && <0.13- , containers >=0.5 && <0.8+ Cabal >=3 && <3.17+ , base >=4.10 && <4.23+ , bytestring >=0.10 && <0.14+ , containers >=0.5 && <0.9 , deepseq >=1.4 && <1.6 , directory >=1.2 && <1.4 , filepath >=1.4 && <1.6
src/Data/ProtoLens/Setup.hs view
@@ -13,7 +13,12 @@ -- `build-dependencies`. -- -- See @README.md@ for instructions on how to use proto-lens with Cabal.+ {-# LANGUAGE CPP #-}+{-# LANGUAGE RankNTypes #-}+{-# LANGUAGE KindSignatures #-}+{-# LANGUAGE DataKinds #-}+ module Data.ProtoLens.Setup ( defaultMainGeneratingProtos , defaultMainGeneratingSpecificProtos@@ -28,6 +33,9 @@ import qualified Data.Map as Map import Data.Maybe (maybeToList) import qualified Data.Set as Set+#if MIN_VERSION_Cabal(3,4,0)+import Distribution.CabalSpecVersion (CabalSpecVersion)+#endif import Distribution.ModuleName (ModuleName) import qualified Distribution.ModuleName as ModuleName import qualified Distribution.InstalledPackageInfo as InstalledPackageInfo@@ -74,11 +82,19 @@ ) #if MIN_VERSION_Cabal(2,4,0) import Distribution.Simple.Glob (matchDirFileGlob)+#if MIN_VERSION_Cabal(3,14,0)+import Distribution.Utils.Path (getSymbolicPath, CWD, AllowAbsolute, SymbolicPath, SymbolicPathX, FileOrDir(..))+import Distribution.Utils.Path (makeSymbolicPath) #endif+#endif import Distribution.Simple ( defaultMainWithHooks , simpleUserHooks , UserHooks(..)+#if MIN_VERSION_Cabal(3,4,0)+#else+ , Version+#endif ) import Distribution.Verbosity ( Verbosity@@ -109,6 +125,33 @@ import Data.ProtoLens.Compiler.ModuleName (protoModuleName) +-- Compatibility shim for the change of 'FilePath' to 'SymbolicPath' in Cabal-3.14.1 in few places+#if MIN_VERSION_Cabal(3,14,0)+getSymbolicPath' :: forall (a :: AllowAbsolute) f t. SymbolicPathX a f t -> FilePath+getSymbolicPath' = getSymbolicPath++matchDirFileGlob' :: forall dir (allowAbs :: AllowAbsolute) (file :: FileOrDir). Verbosity -> CabalSpecVersion -> SymbolicPath CWD (Dir dir) -> SymbolicPathX allowAbs dir file -> IO [SymbolicPathX allowAbs dir file]+matchDirFileGlob' ver specVer path = matchDirFileGlob ver specVer (Just path)+#elif MIN_VERSION_Cabal(3,4,0)+getSymbolicPath' :: FilePath -> FilePath+getSymbolicPath' = id++matchDirFileGlob' :: Verbosity -> CabalSpecVersion -> FilePath -> FilePath -> IO [FilePath]+matchDirFileGlob' = matchDirFileGlob++makeSymbolicPath :: FilePath -> FilePath+makeSymbolicPath = id+#else+getSymbolicPath' :: FilePath -> FilePath+getSymbolicPath' = id++matchDirFileGlob' :: Verbosity -> Version -> FilePath -> FilePath -> IO [FilePath]+matchDirFileGlob' = matchDirFileGlob++makeSymbolicPath :: FilePath -> FilePath+makeSymbolicPath = id+#endif+ -- | This behaves the same as 'Distribution.Simple.defaultMain', but -- auto-generates Haskell files from .proto files which are: --@@ -170,7 +213,7 @@ getProtos l = do -- Replicate Cabal's own logic for parsing file globs. files <- concat <$> mapM (match $ localPkgDescr l)- (extraSrcFiles $ localPkgDescr l)+ (map getSymbolicPath' $ extraSrcFiles $ localPkgDescr l) pure . filter (\f -> takeExtension f == ".proto") . map (makeRelative root)@@ -179,7 +222,7 @@ match :: PackageDescription -> FilePath -> IO [FilePath] #if MIN_VERSION_Cabal(2,4,0)-match desc f = matchDirFileGlob normal (specVersion desc) "." f+match desc f = map getSymbolicPath' <$> matchDirFileGlob' normal (specVersion desc) (makeSymbolicPath ".") (makeSymbolicPath f) #else match _ f = matchFileGlob f #endif@@ -254,7 +297,7 @@ let sourcePath = tmpDir </> f sourceExists <- doesFileExist sourcePath when sourceExists $ do- let dest = autogenComponentModulesDir l compBI </> f+ let dest = getSymbolicPath' (autogenComponentModulesDir l compBI) </> f copyIfDifferent sourcePath dest -- Note: we do a copy rather than a move since a given module may be used in