hpack 0.35.1 → 0.35.2
raw patch · 8 files changed
+249/−10 lines, 8 filesdep ~Cabaldep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: Cabal, base
API changes (from Hackage documentation)
+ Hpack.Config: [sectionGhcSharedOptions] :: Section a -> [GhcOption]
- Hpack.Config: Section :: a -> [FilePath] -> Dependencies -> [String] -> [String] -> [String] -> Maybe Language -> [GhcOption] -> [GhcProfOption] -> [GhcjsOption] -> [CppOption] -> [CcOption] -> [Path] -> [CxxOption] -> [Path] -> [Path] -> [FilePath] -> [FilePath] -> [FilePath] -> [FilePath] -> [FilePath] -> [FilePath] -> [LdOption] -> Maybe Bool -> [Conditional (Section a)] -> Map BuildTool DependencyVersion -> SystemBuildTools -> [Verbatim] -> Section a
+ Hpack.Config: Section :: a -> [FilePath] -> Dependencies -> [String] -> [String] -> [String] -> Maybe Language -> [GhcOption] -> [GhcProfOption] -> [GhcOption] -> [GhcjsOption] -> [CppOption] -> [CcOption] -> [Path] -> [CxxOption] -> [Path] -> [Path] -> [FilePath] -> [FilePath] -> [FilePath] -> [FilePath] -> [FilePath] -> [FilePath] -> [LdOption] -> Maybe Bool -> [Conditional (Section a)] -> Map BuildTool DependencyVersion -> SystemBuildTools -> [Verbatim] -> Section a
Files
- CHANGELOG.md +7/−0
- LICENSE +1/−1
- hpack.cabal +3/−2
- resources/test/hpack.cabal +213/−0
- src/Hpack/Config.hs +9/−4
- src/Hpack/Render.hs +4/−0
- test/EndToEndSpec.hs +10/−1
- test/HpackSpec.hs +2/−2
CHANGELOG.md view
@@ -1,3 +1,10 @@+## Changes in 0.35.2+ - Add support for `ghc-shared-options`++## Changes in 0.35.1+ - Allow `Cabal-3.8.*`+ - Additions to internal API+ ## Changes in 0.35.0 - Add support for `language` (thanks @mpilgrem) - Accept Cabal names for fields where Hpack and Cabal use different
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2014-2018 Simon Hengel <sol@typeful.net>+Copyright (c) 2014-2023 Simon Hengel <sol@typeful.net> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
hpack.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.0.+-- This file has been generated from package.yaml by hpack version 0.35.1. -- -- see: https://github.com/sol/hpack name: hpack-version: 0.35.1+version: 0.35.2 synopsis: A modern format for Haskell packages description: See README at <https://github.com/sol/hpack#readme> category: Development@@ -17,6 +17,7 @@ build-type: Simple extra-source-files: CHANGELOG.md+ resources/test/hpack.cabal source-repository head type: git
+ resources/test/hpack.cabal view
@@ -0,0 +1,213 @@+cabal-version: 1.12++-- This file has been generated from package.yaml by hpack version 0.35.1.+--+-- see: https://github.com/sol/hpack++name: hpack+version: 0.35.2+synopsis: A modern format for Haskell packages+description: See README at <https://github.com/sol/hpack#readme>+category: Development+homepage: https://github.com/sol/hpack#readme+bug-reports: https://github.com/sol/hpack/issues+maintainer: Simon Hengel <sol@typeful.net>+license: MIT+license-file: LICENSE+build-type: Simple+extra-source-files:+ CHANGELOG.md+ resources/test/hpack.cabal++source-repository head+ type: git+ location: https://github.com/sol/hpack++library+ hs-source-dirs:+ src+ ghc-options: -Wall -fno-warn-incomplete-uni-patterns+ build-depends:+ Cabal >=3.0.0.0 && <3.9+ , Glob >=0.9.0+ , aeson >=1.4.3.0+ , base >=4.9 && <5+ , bifunctors+ , bytestring+ , containers+ , cryptonite+ , deepseq+ , directory >=1.2.5.0+ , filepath+ , http-client+ , http-client-tls+ , http-types+ , infer-license >=0.2.0 && <0.3+ , pretty+ , scientific+ , text+ , transformers+ , unordered-containers+ , vector+ , yaml >=0.10.0+ exposed-modules:+ Hpack+ Hpack.Config+ Hpack.Render+ Hpack.Yaml+ Hpack.Error+ other-modules:+ Data.Aeson.Config.FromValue+ Data.Aeson.Config.Key+ Data.Aeson.Config.KeyMap+ Data.Aeson.Config.Parser+ Data.Aeson.Config.Types+ Data.Aeson.Config.Util+ Hpack.CabalFile+ Hpack.Defaults+ Hpack.Haskell+ Hpack.License+ Hpack.Module+ Hpack.Options+ Hpack.Render.Dsl+ Hpack.Render.Hints+ Hpack.Syntax.BuildTools+ Hpack.Syntax.Defaults+ Hpack.Syntax.Dependencies+ Hpack.Syntax.DependencyVersion+ Hpack.Syntax.Git+ Hpack.Syntax.ParseDependencies+ Hpack.Utf8+ Hpack.Util+ Imports+ Path+ Paths_hpack+ default-language: Haskell2010++executable hpack+ main-is: Main.hs+ hs-source-dirs:+ driver+ ghc-options: -Wall -fno-warn-incomplete-uni-patterns+ build-depends:+ Cabal >=3.0.0.0 && <3.9+ , Glob >=0.9.0+ , aeson >=1.4.3.0+ , base >=4.9 && <5+ , bifunctors+ , bytestring+ , containers+ , cryptonite+ , deepseq+ , directory >=1.2.5.0+ , filepath+ , hpack+ , http-client+ , http-client-tls+ , http-types+ , infer-license >=0.2.0 && <0.3+ , pretty+ , scientific+ , text+ , transformers+ , unordered-containers+ , vector+ , yaml >=0.10.0+ other-modules:+ Paths_hpack+ default-language: Haskell2010++test-suite spec+ type: exitcode-stdio-1.0+ main-is: Spec.hs+ hs-source-dirs:+ test+ src+ ghc-options: -Wall -fno-warn-incomplete-uni-patterns+ cpp-options: -DTEST+ build-depends:+ Cabal >=3.0.0.0 && <3.9+ , Glob >=0.9.0+ , HUnit >=1.6.0.0+ , QuickCheck+ , aeson >=1.4.3.0+ , base >=4.9 && <5+ , bifunctors+ , bytestring+ , containers+ , cryptonite+ , deepseq+ , directory >=1.2.5.0+ , filepath+ , hspec ==2.*+ , http-client+ , http-client-tls+ , http-types+ , infer-license >=0.2.0 && <0.3+ , interpolate+ , mockery >=0.3+ , pretty+ , scientific+ , template-haskell+ , temporary+ , text+ , transformers+ , unordered-containers+ , vector+ , yaml >=0.10.0+ build-tool-depends:+ hspec-discover:hspec-discover+ other-modules:+ Data.Aeson.Config.FromValueSpec+ Data.Aeson.Config.TypesSpec+ Data.Aeson.Config.UtilSpec+ EndToEndSpec+ Helper+ Hpack.CabalFileSpec+ Hpack.ConfigSpec+ Hpack.DefaultsSpec+ Hpack.HaskellSpec+ Hpack.LicenseSpec+ Hpack.ModuleSpec+ Hpack.OptionsSpec+ Hpack.Render.DslSpec+ Hpack.Render.HintsSpec+ Hpack.RenderSpec+ Hpack.Syntax.BuildToolsSpec+ Hpack.Syntax.DefaultsSpec+ Hpack.Syntax.DependenciesSpec+ Hpack.Syntax.GitSpec+ Hpack.Utf8Spec+ Hpack.UtilSpec+ HpackSpec+ Data.Aeson.Config.FromValue+ Data.Aeson.Config.Key+ Data.Aeson.Config.KeyMap+ Data.Aeson.Config.Parser+ Data.Aeson.Config.Types+ Data.Aeson.Config.Util+ Hpack+ Hpack.CabalFile+ Hpack.Config+ Hpack.Defaults+ Hpack.Error+ Hpack.Haskell+ Hpack.License+ Hpack.Module+ Hpack.Options+ Hpack.Render+ Hpack.Render.Dsl+ Hpack.Render.Hints+ Hpack.Syntax.BuildTools+ Hpack.Syntax.Defaults+ Hpack.Syntax.Dependencies+ Hpack.Syntax.DependencyVersion+ Hpack.Syntax.Git+ Hpack.Syntax.ParseDependencies+ Hpack.Utf8+ Hpack.Util+ Hpack.Yaml+ Imports+ Path+ Paths_hpack+ default-language: Haskell2010
src/Hpack/Config.hs view
@@ -190,7 +190,7 @@ deps xs = [(name, info) | (name, info) <- (Map.toList . unDependencies . sectionDependencies) xs] section :: a -> Section a-section a = Section a [] mempty [] [] [] Nothing [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Nothing [] mempty mempty []+section a = Section a [] mempty [] [] [] Nothing [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Nothing [] mempty mempty [] packageConfig :: FilePath packageConfig = "package.yaml"@@ -279,6 +279,7 @@ , commonOptionsLanguage :: Alias 'True "default-language" (Last (Maybe Language)) , commonOptionsGhcOptions :: Maybe (List GhcOption) , commonOptionsGhcProfOptions :: Maybe (List GhcProfOption)+, commonOptionsGhcSharedOptions :: Maybe (List GhcOption) , commonOptionsGhcjsOptions :: Maybe (List GhcjsOption) , commonOptionsCppOptions :: Maybe (List CppOption) , commonOptionsCcOptions :: Maybe (List CcOption)@@ -313,6 +314,7 @@ , commonOptionsLanguage = mempty , commonOptionsGhcOptions = Nothing , commonOptionsGhcProfOptions = Nothing+ , commonOptionsGhcSharedOptions = Nothing , commonOptionsGhcjsOptions = Nothing , commonOptionsCppOptions = Nothing , commonOptionsCcOptions = Nothing@@ -345,6 +347,7 @@ , commonOptionsLanguage = commonOptionsLanguage a <> commonOptionsLanguage b , commonOptionsGhcOptions = commonOptionsGhcOptions a <> commonOptionsGhcOptions b , commonOptionsGhcProfOptions = commonOptionsGhcProfOptions a <> commonOptionsGhcProfOptions b+ , commonOptionsGhcSharedOptions = commonOptionsGhcSharedOptions a <> commonOptionsGhcSharedOptions b , commonOptionsGhcjsOptions = commonOptionsGhcjsOptions a <> commonOptionsGhcjsOptions b , commonOptionsCppOptions = commonOptionsCppOptions a <> commonOptionsCppOptions b , commonOptionsCcOptions = commonOptionsCcOptions a <> commonOptionsCcOptions b@@ -993,6 +996,7 @@ , sectionLanguage :: Maybe Language , sectionGhcOptions :: [GhcOption] , sectionGhcProfOptions :: [GhcProfOption]+, sectionGhcSharedOptions :: [GhcOption] , sectionGhcjsOptions :: [GhcjsOption] , sectionCppOptions :: [CppOption] , sectionCcOptions :: [CcOption]@@ -1468,11 +1472,14 @@ return Section { sectionData = a , sectionSourceDirs = nub $ fromMaybeList (unAlias commonOptionsSourceDirs)+ , sectionDependencies = fromMaybe mempty (unAlias commonOptionsDependencies)+ , sectionPkgConfigDependencies = fromMaybeList (unAlias commonOptionsPkgConfigDependencies) , sectionDefaultExtensions = fromMaybeList commonOptionsDefaultExtensions , sectionOtherExtensions = fromMaybeList commonOptionsOtherExtensions , sectionLanguage = join . getLast $ unAlias commonOptionsLanguage , sectionGhcOptions = fromMaybeList commonOptionsGhcOptions , sectionGhcProfOptions = fromMaybeList commonOptionsGhcProfOptions+ , sectionGhcSharedOptions = fromMaybeList commonOptionsGhcSharedOptions , sectionGhcjsOptions = fromMaybeList commonOptionsGhcjsOptions , sectionCppOptions = fromMaybeList commonOptionsCppOptions , sectionCcOptions = fromMaybeList commonOptionsCcOptions@@ -1488,8 +1495,6 @@ , sectionInstallIncludes = fromMaybeList commonOptionsInstallIncludes , sectionLdOptions = fromMaybeList commonOptionsLdOptions , sectionBuildable = getLast commonOptionsBuildable- , sectionDependencies = fromMaybe mempty (unAlias commonOptionsDependencies)- , sectionPkgConfigDependencies = fromMaybeList (unAlias commonOptionsPkgConfigDependencies) , sectionConditionals = conditionals , sectionBuildTools = buildTools , sectionSystemBuildTools = systemBuildTools <> fromMaybe mempty commonOptionsSystemBuildTools@@ -1505,7 +1510,7 @@ toConditional :: Monad m => ConditionalSection CSources CxxSources JsSources a -> Warnings m (Conditional (Section a)) toConditional x = case x of- ThenElseConditional (Product (ThenElse then_ else_) c) -> conditional c <$> (go then_) <*> (Just <$> go else_)+ ThenElseConditional (Product (ThenElse then_ else_) c) -> conditional c <$> go then_ <*> (Just <$> go else_) FlatConditional (Product sect c) -> conditional c <$> (go sect) <*> pure Nothing where conditional = Conditional . conditionCondition
src/Hpack/Render.hs view
@@ -231,6 +231,7 @@ , renderOtherExtensions sectionOtherExtensions , renderGhcOptions sectionGhcOptions , renderGhcProfOptions sectionGhcProfOptions+ , renderGhcSharedOptions sectionGhcSharedOptions , renderGhcjsOptions sectionGhcjsOptions , renderCppOptions sectionCppOptions , renderCcOptions sectionCcOptions@@ -381,6 +382,9 @@ renderGhcProfOptions :: [GhcProfOption] -> Element renderGhcProfOptions = Field "ghc-prof-options" . WordList++renderGhcSharedOptions :: [GhcOption] -> Element+renderGhcSharedOptions = Field "ghc-shared-options" . WordList renderGhcjsOptions :: [GhcjsOption] -> Element renderGhcjsOptions = Field "ghcjs-options" . WordList
test/EndToEndSpec.hs view
@@ -881,6 +881,15 @@ bar.h |] + describe "ghc-shared-options" $ do+ it "accepts ghc-shared-options" $ do+ [i|+ ghc-shared-options: -Wall+ executable: {}+ |] `shouldRenderTo` executable_ "foo" [i|+ ghc-shared-options: -Wall+ |]+ describe "js-sources" $ before_ (touch "foo.js" >> touch "jsbits/bar.js") $ do it "accepts js-sources" $ do [i|@@ -2034,7 +2043,7 @@ license :: String license = [i|-Copyright (c) 2014-2018 Simon Hengel <sol@typeful.net>+Copyright (c) 2014-2023 Simon Hengel <sol@typeful.net> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
test/HpackSpec.hs view
@@ -50,8 +50,8 @@ describe "renderCabalFile" $ do it "is inverse to readCabalFile" $ do- expected <- lines <$> readFile "hpack.cabal"- Just c <- readCabalFile "hpack.cabal"+ expected <- lines <$> readFile "resources/test/hpack.cabal"+ Just c <- readCabalFile "resources/test/hpack.cabal" renderCabalFile "package.yaml" c `shouldBe` expected describe "hpackResult" $ around_ inTempDirectory $ before_ (writeFile packageConfig "name: foo") $ do