summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimonHengel <>2017-10-12 16:59:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2017-10-12 16:59:00 (GMT)
commit2b6a02ea406568ad22b3bbf16a57448fad6022a3 (patch)
tree854181a21fec7457e79a6f2d5c79d0ef2e225f0c
parent1fc7ef241c7bb5d08b63dd669964a18edf0acc04 (diff)
version 0.19.3HEAD0.19.3master
-rw-r--r--CHANGELOG.md6
-rw-r--r--hpack.cabal2
-rw-r--r--src/Hpack/Config.hs10
-rw-r--r--src/Hpack/Run.hs2
-rw-r--r--test/Hpack/ConfigSpec.hs18
-rw-r--r--test/Hpack/RunSpec.hs30
6 files changed, 66 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1fa6e6d..fd27e82 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+## Changes in 0.19.3
+ - Add support for `frameworks` and `extra-frameworks-dirs`
+
+## Changes in 0.19.2
+ - Compatibility with `Glob >= 0.9.0`
+
## Changes in 0.19.1
- Add `IsList` instance for `Dependencies`
diff --git a/hpack.cabal b/hpack.cabal
index 93df318..da848cc 100644
--- a/hpack.cabal
+++ b/hpack.cabal
@@ -3,7 +3,7 @@
-- see: https://github.com/sol/hpack
name: hpack
-version: 0.19.2
+version: 0.19.3
synopsis: An alternative format for Haskell packages
description: See README at <https://github.com/sol/hpack#readme>
category: Development
diff --git a/src/Hpack/Config.hs b/src/Hpack/Config.hs
index 436c16e..4ef13bd 100644
--- a/src/Hpack/Config.hs
+++ b/src/Hpack/Config.hs
@@ -126,7 +126,7 @@ packageDependencies Package{..} = nub . sortBy (comparing (lexicographically . f
deps xs = [(name, version) | (name, version) <- (Map.toList . unDependencies . sectionDependencies) xs]
section :: a -> Section a
-section a = Section a [] mempty [] [] [] [] [] [] [] [] [] [] [] [] [] [] Nothing [] mempty
+section a = Section a [] mempty [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Nothing [] mempty
packageConfig :: FilePath
packageConfig = "package.yaml"
@@ -241,6 +241,8 @@ data CommonOptions = CommonOptions {
, commonOptionsJsSources :: Maybe (List FilePath)
, commonOptionsExtraLibDirs :: Maybe (List FilePath)
, commonOptionsExtraLibraries :: Maybe (List FilePath)
+, commonOptionsExtraFrameworksDirs :: Maybe (List FilePath)
+, commonOptionsFrameworks :: Maybe (List String)
, commonOptionsIncludeDirs :: Maybe (List FilePath)
, commonOptionsInstallIncludes :: Maybe (List FilePath)
, commonOptionsLdOptions :: Maybe (List LdOption)
@@ -436,6 +438,8 @@ data Section a = Section {
, sectionJsSources :: [FilePath]
, sectionExtraLibDirs :: [FilePath]
, sectionExtraLibraries :: [FilePath]
+, sectionExtraFrameworksDirs :: [FilePath]
+, sectionFrameworks :: [FilePath]
, sectionIncludeDirs :: [FilePath]
, sectionInstallIncludes :: [FilePath]
, sectionLdOptions :: [LdOption]
@@ -736,6 +740,8 @@ mergeSections globalOptions options
, sectionJsSources = sectionJsSources globalOptions ++ sectionJsSources options
, sectionExtraLibDirs = sectionExtraLibDirs globalOptions ++ sectionExtraLibDirs options
, sectionExtraLibraries = sectionExtraLibraries globalOptions ++ sectionExtraLibraries options
+ , sectionExtraFrameworksDirs = sectionExtraFrameworksDirs globalOptions ++ sectionExtraFrameworksDirs options
+ , sectionFrameworks = sectionFrameworks globalOptions ++ sectionFrameworks options
, sectionIncludeDirs = sectionIncludeDirs globalOptions ++ sectionIncludeDirs options
, sectionInstallIncludes = sectionInstallIncludes globalOptions ++ sectionInstallIncludes options
, sectionLdOptions = sectionLdOptions globalOptions ++ sectionLdOptions options
@@ -762,6 +768,8 @@ toSection a CommonOptions{..}
, sectionJsSources = fromMaybeList commonOptionsJsSources
, sectionExtraLibDirs = fromMaybeList commonOptionsExtraLibDirs
, sectionExtraLibraries = fromMaybeList commonOptionsExtraLibraries
+ , sectionExtraFrameworksDirs = fromMaybeList commonOptionsExtraFrameworksDirs
+ , sectionFrameworks = fromMaybeList commonOptionsFrameworks
, sectionIncludeDirs = fromMaybeList commonOptionsIncludeDirs
, sectionInstallIncludes = fromMaybeList commonOptionsInstallIncludes
, sectionLdOptions = fromMaybeList commonOptionsLdOptions
diff --git a/src/Hpack/Run.hs b/src/Hpack/Run.hs
index 6cead16..c666f19 100644
--- a/src/Hpack/Run.hs
+++ b/src/Hpack/Run.hs
@@ -232,6 +232,8 @@ renderSection Section{..} = [
, Field "js-sources" (LineSeparatedList sectionJsSources)
, renderDirectories "extra-lib-dirs" sectionExtraLibDirs
, Field "extra-libraries" (LineSeparatedList sectionExtraLibraries)
+ , renderDirectories "extra-frameworks-dirs" sectionExtraFrameworksDirs
+ , Field "frameworks" (LineSeparatedList sectionFrameworks)
, renderLdOptions sectionLdOptions
, renderDependencies "build-depends" sectionDependencies
, renderDependencies "build-tools" sectionBuildTools
diff --git a/test/Hpack/ConfigSpec.hs b/test/Hpack/ConfigSpec.hs
index 6833b45..f7e9564 100644
--- a/test/Hpack/ConfigSpec.hs
+++ b/test/Hpack/ConfigSpec.hs
@@ -148,6 +148,24 @@ spec = do
captureUnknownFieldsValue <$> decodeEither input
`shouldBe` Right (section Empty){sectionExtraLibraries = ["foo", "bar"]}
+ it "accepts extra-frameworks-dirs" $ do
+ let input = [i|
+ extra-frameworks-dirs:
+ - foo
+ - bar
+ |]
+ captureUnknownFieldsValue <$> decodeEither input
+ `shouldBe` Right (section Empty){sectionExtraFrameworksDirs = ["foo", "bar"]}
+
+ it "accepts frameworks" $ do
+ let input = [i|
+ frameworks:
+ - foo
+ - bar
+ |]
+ captureUnknownFieldsValue <$> decodeEither input
+ `shouldBe` Right (section Empty){sectionFrameworks = ["foo", "bar"]}
+
context "when parsing conditionals" $ do
it "accepts conditionals" $ do
let input = [i|
diff --git a/test/Hpack/RunSpec.hs b/test/Hpack/RunSpec.hs
index 6d255c4..d269e57 100644
--- a/test/Hpack/RunSpec.hs
+++ b/test/Hpack/RunSpec.hs
@@ -254,6 +254,36 @@ spec = do
, " default-language: Haskell2010"
]
+ it "includes frameworks" $ do
+ renderPackage_ package {packageExecutables = [(section $ Executable "foo" "Main.hs" []) {sectionFrameworks = ["foo", "bar"]}]} `shouldBe` unlines [
+ "name: foo"
+ , "version: 0.0.0"
+ , "build-type: Simple"
+ , "cabal-version: >= 1.10"
+ , ""
+ , "executable foo"
+ , " main-is: Main.hs"
+ , " frameworks:"
+ , " foo"
+ , " bar"
+ , " default-language: Haskell2010"
+ ]
+
+ it "includes extra-framework-dirs" $ do
+ renderPackage_ package {packageExecutables = [(section $ Executable "foo" "Main.hs" []) {sectionExtraFrameworksDirs = ["foo", "bar"]}]} `shouldBe` unlines [
+ "name: foo"
+ , "version: 0.0.0"
+ , "build-type: Simple"
+ , "cabal-version: >= 1.10"
+ , ""
+ , "executable foo"
+ , " main-is: Main.hs"
+ , " extra-frameworks-dirs:"
+ , " foo"
+ , " bar"
+ , " default-language: Haskell2010"
+ ]
+
it "includes GHC profiling options" $ do
renderPackage_ package {packageExecutables = [(section $ Executable "foo" "Main.hs" []) {sectionGhcProfOptions = ["-fprof-auto", "-rtsopts"]}]} `shouldBe` unlines [
"name: foo"