hpack 0.38.1 → 0.38.2
raw patch · 5 files changed
+69/−14 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Hpack.Yaml: ($dmfromValue) :: forall (d :: Meta) (m :: Type -> Type). (FromValue a, Generic a, Rep a ~ D1 d m, Datatype d, GenericDecode (Rep a)) => Value -> Parser a
- Hpack.Error: data () => Status
+ Hpack.Error: data Status
- Hpack.Yaml: class () => Generic a
+ Hpack.Yaml: class Generic a
- Hpack.Yaml: class GenericDecode f
+ Hpack.Yaml: class GenericDecode (f :: Type -> Type)
- Hpack.Yaml: data () => Key
+ Hpack.Yaml: data Key
- Hpack.Yaml: data () => ParseException
+ Hpack.Yaml: data ParseException
- Hpack.Yaml: data () => Value
+ Hpack.Yaml: data Value
- Hpack.Yaml: fromValue :: forall d m. (FromValue a, Generic a, Rep a ~ D1 d m, Datatype d, GenericDecode (Rep a)) => Value -> Parser a
+ Hpack.Yaml: fromValue :: FromValue a => Value -> Parser a
- Hpack.Yaml: genericFromValue :: forall a d m. (Generic a, Rep a ~ D1 d m, Datatype d, GenericDecode (Rep a)) => Value -> Parser a
+ Hpack.Yaml: genericFromValue :: forall a (d :: Meta) (m :: Type -> Type). (Generic a, Rep a ~ D1 d m, Datatype d, GenericDecode (Rep a)) => Value -> Parser a
- Hpack.Yaml: unAlias :: Alias deprecated alias a -> a
+ Hpack.Yaml: unAlias :: forall (deprecated :: Bool) (alias :: Symbol) a. Alias deprecated alias a -> a
Files
- CHANGELOG.md +3/−0
- hpack.cabal +5/−5
- resources/test/hpack.cabal +5/−5
- src/Hpack/Config.hs +25/−4
- test/EndToEndSpec.hs +31/−0
CHANGELOG.md view
@@ -1,3 +1,6 @@+## Changes in 0.38.2+ - Infer `cabal-version: 3.12` when `PackageInfo_*` is used (see #620)+ ## Changes in 0.38.1 - Add support for `extra-files` (see #603) - Preserve empty lines in `description` when `cabal-version >= 3` (see #612)
hpack.cabal view
@@ -1,11 +1,11 @@ cabal-version: 2.0 --- This file has been generated from package.yaml by hpack version 0.38.0.+-- This file has been generated from package.yaml by hpack version 0.38.1. -- -- see: https://github.com/sol/hpack name: hpack-version: 0.38.1+version: 0.38.2 synopsis: A modern format for Haskell packages description: See README at <https://github.com/sol/hpack#readme> category: Development@@ -63,7 +63,7 @@ src ghc-options: -Wall -fno-warn-incomplete-uni-patterns build-depends:- Cabal >=3.0.0.0 && <3.15+ Cabal >=3.0.0.0 && <3.17 , Glob >=0.9.0 , aeson >=1.4.3.0 , base >=4.13 && <5@@ -97,7 +97,7 @@ driver ghc-options: -Wall -fno-warn-incomplete-uni-patterns build-depends:- Cabal >=3.0.0.0 && <3.15+ Cabal >=3.0.0.0 && <3.17 , Glob >=0.9.0 , aeson >=1.4.3.0 , base >=4.13 && <5@@ -193,7 +193,7 @@ build-tool-depends: hspec-discover:hspec-discover build-depends:- Cabal >=3.0.0.0 && <3.15+ Cabal >=3.0.0.0 && <3.17 , Glob >=0.9.0 , HUnit >=1.6.0.0 , QuickCheck
resources/test/hpack.cabal view
@@ -1,11 +1,11 @@ cabal-version: 2.0 --- This file has been generated from package.yaml by hpack version 0.38.0.+-- This file has been generated from package.yaml by hpack version 0.38.1. -- -- see: https://github.com/sol/hpack name: hpack-version: 0.38.1+version: 0.38.2 synopsis: A modern format for Haskell packages description: See README at <https://github.com/sol/hpack#readme> category: Development@@ -63,7 +63,7 @@ src ghc-options: -Wall -fno-warn-incomplete-uni-patterns build-depends:- Cabal >=3.0.0.0 && <3.15+ Cabal >=3.0.0.0 && <3.17 , Glob >=0.9.0 , aeson >=1.4.3.0 , base >=4.13 && <5@@ -97,7 +97,7 @@ driver ghc-options: -Wall -fno-warn-incomplete-uni-patterns build-depends:- Cabal >=3.0.0.0 && <3.15+ Cabal >=3.0.0.0 && <3.17 , Glob >=0.9.0 , aeson >=1.4.3.0 , base >=4.13 && <5@@ -193,7 +193,7 @@ build-tool-depends: hspec-discover:hspec-discover build-depends:- Cabal >=3.0.0.0 && <3.15+ Cabal >=3.0.0.0 && <3.17 , Glob >=0.9.0 , HUnit >=1.6.0.0 , QuickCheck
src/Hpack/Config.hs view
@@ -846,12 +846,24 @@ makeVersion [1,22] <$ guard (has libraryReexportedModules) , makeVersion [2,0] <$ guard (has librarySignatures) , makeVersion [2,0] <$ guard (has libraryGeneratedModules)+ , makeVersion [3,12] <$ guard (libraryHasPackageInfoModule sect) , makeVersion [3,0] <$ guard (has libraryVisibility) , sectionCabalVersion (concatMap getLibraryModules) sect ] where has field = any (not . null . field) sect + libraryHasPackageInfoModule :: Section Library -> Bool+ libraryHasPackageInfoModule =+ any (hasPackageInfoModule . libraryGeneratedModules)++ packageInfoModule :: Module+ packageInfoModule =+ Module ("PackageInfo_" ++ moduleNameFromPackageName packageName)++ hasPackageInfoModule :: [Module] -> Bool+ hasPackageInfoModule = any (== packageInfoModule)+ internalLibsCabalVersion :: Map String (Section Library) -> Maybe CabalVersion internalLibsCabalVersion internalLibraries | Map.null internalLibraries = Nothing@@ -865,12 +877,17 @@ executableCabalVersion :: Section Executable -> Maybe CabalVersion executableCabalVersion sect = maximum [ makeVersion [2,0] <$ guard (executableHasGeneratedModules sect)+ , makeVersion [3,12] <$ guard (executableHasPackageInfoModule sect) , sectionCabalVersion (concatMap getExecutableModules) sect ] executableHasGeneratedModules :: Section Executable -> Bool executableHasGeneratedModules = any (not . null . executableGeneratedModules) + executableHasPackageInfoModule :: Section Executable -> Bool+ executableHasPackageInfoModule =+ any (hasPackageInfoModule . executableGeneratedModules)+ sectionCabalVersion :: (Section a -> [Module]) -> Section a -> Maybe CabalVersion sectionCabalVersion getMentionedModules sect = maximum $ [ makeVersion [2,2] <$ guard (sectionSatisfies (not . null . sectionCxxSources) sect)@@ -1659,7 +1676,11 @@ warnLegacySystemTool name = tell ["Listing " ++ show name ++ " under build-tools is deperecated! Please list system executables under system-build-tools instead!"] pathsModuleFromPackageName :: String -> Module-pathsModuleFromPackageName name = Module ("Paths_" ++ map f name)- where- f '-' = '_'- f x = x+pathsModuleFromPackageName name =+ Module ("Paths_" ++ moduleNameFromPackageName name)++moduleNameFromPackageName :: String -> String+moduleNameFromPackageName = map f+ where+ f '-' = '_'+ f x = x
test/EndToEndSpec.hs view
@@ -1327,6 +1327,20 @@ default-language: Haskell2010 |]) {packageCabalVersion = "2.0"} + context "with PackageInfo_my_package" $ do+ it "infers cabal-version 3.12" $ do+ [i|+ spec-version: 0.36.0+ library:+ generated-other-modules: PackageInfo_my_package+ |] `shouldRenderTo` (library [i|+ other-modules:+ PackageInfo_my_package+ autogen-modules:+ PackageInfo_my_package+ default-language: Haskell2010+ |]) {packageCabalVersion = "3.12"}+ describe "internal-libraries" $ do it "accepts internal-libraries" $ do touch "src/Foo.hs"@@ -1683,6 +1697,23 @@ Foo default-language: Haskell2010 |]) {packageCabalVersion = "2.0"}++ context "with PackageInfo_my_package" $ do+ it "infers cabal-version 3.12" $ do+ [i|+ spec-version: 0.36.0+ executables:+ foo:+ main: Main.hs+ generated-other-modules: PackageInfo_my_package+ |] `shouldRenderTo` (executable "foo" [i|+ main-is: Main.hs+ other-modules:+ PackageInfo_my_package+ autogen-modules:+ PackageInfo_my_package+ default-language: Haskell2010+ |]) {packageCabalVersion = "3.12"} context "with a conditional" $ do it "doesn't infer any modules mentioned in that conditional" $ do