hpack-convert 0.14.2 → 0.14.3
raw patch · 7 files changed
+57/−60 lines, 7 filesdep ~Cabaldep ~aesondep ~unordered-containers
Dependency ranges changed: Cabal, aeson, unordered-containers
Files
- hpack-convert.cabal +13/−13
- src/Hpack.hs +0/−9
- src/Hpack/Config.hs +30/−20
- src/Hpack/Convert.hs +4/−2
- src/Hpack/Convert/Run.hs +4/−2
- test/Hpack/RunSpec.hs +4/−4
- test/HpackSpec.hs +2/−10
hpack-convert.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack name: hpack-convert-version: 0.14.2+version: 0.14.3 synopsis: Convert Cabal manifests into hpack's package.yamls category: Development homepage: https://github.com/yamadapc/hpack-convert#readme@@ -21,11 +21,11 @@ library hs-source-dirs: src- ghc-options: -Wall+ ghc-options: -Wall -fcontext-stack=100 build-depends: base >= 4.7 && < 5 , base-compat >= 0.8- , Cabal+ , Cabal >= 1.22 , pretty , deepseq , directory@@ -33,11 +33,11 @@ , Glob , text , containers- , unordered-containers+ , unordered-containers >= 0.2.7.1 , yaml , bytestring , vector- , aeson >= 0.8+ , aeson == 0.11.* exposed-modules: Hpack Hpack.Convert@@ -58,11 +58,11 @@ main-is: Main.hs hs-source-dirs: driver- ghc-options: -Wall+ ghc-options: -Wall -fcontext-stack=100 build-depends: base >= 4.7 && < 5 , base-compat >= 0.8- , Cabal+ , Cabal >= 1.22 , pretty , deepseq , directory@@ -70,12 +70,12 @@ , Glob , text , containers- , unordered-containers+ , unordered-containers >= 0.2.7.1 , yaml , bytestring , vector+ , aeson == 0.11.* , hpack-convert- , aeson >= 0.8 default-language: Haskell2010 test-suite spec@@ -84,12 +84,12 @@ hs-source-dirs: test , src- ghc-options: -Wall+ ghc-options: -Wall -fcontext-stack=100 cpp-options: -DTEST build-depends: base >= 4.7 && < 5 , base-compat >= 0.8- , Cabal+ , Cabal >= 1.22 , pretty , deepseq , directory@@ -97,17 +97,17 @@ , Glob , text , containers- , unordered-containers+ , unordered-containers >= 0.2.7.1 , yaml , bytestring , vector+ , aeson == 0.11.* , hspec == 2.* , QuickCheck , temporary , mockery >= 0.3 , interpolate , aeson-qq- , aeson >= 0.10 other-modules: Helper Hpack.ConfigSpec
src/Hpack.hs view
@@ -8,7 +8,6 @@ , main #ifdef TEST , hpackWithVersion-, parseVerbosity , extractVersion , parseVersion #endif@@ -25,7 +24,6 @@ import Data.Version (Version) import qualified Data.Version as Version import System.Environment-import System.Exit import System.IO import System.IO.Error import Text.ParserCombinators.ReadP@@ -61,13 +59,6 @@ , " hpack-convert --version" , " hpack-convert --help" ]--parseVerbosity :: [String] -> (Bool, [String])-parseVerbosity xs = (verbose, ys)- where- silentFlag = "--silent"- verbose = not (silentFlag `elem` xs)- ys = filter (/= silentFlag) xs safeInit :: [a] -> [a] safeInit [] = []
src/Hpack/Config.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-}@@ -5,11 +6,13 @@ {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE OverloadedStrings #-}+#if __GLASGOW_HASKELL__ < 710+{-# LANGUAGE OverlappingInstances #-}+#endif {-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE CPP #-} {-# LANGUAGE UndecidableInstances #-} module Hpack.Config ( packageConfig@@ -332,24 +335,27 @@ "license-file" o ) $- pullCommonFields "build-tools" $- pullCommonFields "conditionals" $- pullCommonFields "buildable" $- pullCommonFields "ld-options" $- pullCommonFields "install-includes" $- pullCommonFields "include-dirs" $- pullCommonFields "extra-libraries" $- pullCommonFields "extra-lib-dirs" $- pullCommonFields "c-sources" $- pullCommonFields "cc-options" $- pullCommonFields "cpp-options" $- pullCommonFields "ghc-prof-options" $- pullCommonFields "ghc-options" $- pullCommonFields "other-extensions" $- pullCommonFields "default-extensions" $- pullCommonFields "other-modules" $- pullCommonFields "source-dirs" $- pullCommonFields "dependencies" (genericToJSON_ p)+ foldr pullCommonFields+ (genericToJSON_ p)+ ([ "build-tools"+ , "conditionals"+ , "buildable"+ , "ld-options"+ , "install-includes"+ , "include-dirs"+ , "extra-libraries"+ , "extra-lib-dirs"+ , "c-sources"+ , "cc-options"+ , "cpp-options"+ , "ghc-prof-options"+ , "ghc-options"+ , "other-extensions"+ , "default-extensions"+ , "other-modules"+ , "source-dirs"+ , "dependencies"+ ] :: [Text]) pullCommonFields :: Text -> Value -> Value pullCommonFields field topLevel@(Object topLevelObj) =@@ -451,7 +457,11 @@ , toJSON sect ) +#if __GLASGOW_HASKELL__ >= 710 instance {-# OVERLAPS #-} ToJSON (Section ()) where+#else+instance ToJSON (Section ()) where+#endif toJSON sect@Section{..} = (omitSection (mergeObjects
src/Hpack/Convert.hs view
@@ -3,7 +3,9 @@ {-# LANGUAGE RecordWildCards #-} module Hpack.Convert where -import Control.Applicative+import Prelude ()+import Prelude.Compat+ import Data.Maybe import qualified Data.Version as Version import qualified Distribution.Compiler as Compiler@@ -93,7 +95,7 @@ -- ) fromDependency :: Cabal.Dependency -> Dependency-fromDependency (Cabal.Dependency pn Cabal.AnyVersion) =+fromDependency (Cabal.Dependency pn vr) | vr == Cabal.anyVersion = Dependency (show (Cabal.disp pn)) Nothing fromDependency (Cabal.Dependency pn vr) = Dependency (show (Cabal.disp pn <+> Cabal.disp vr)) Nothing
src/Hpack/Convert/Run.hs view
@@ -4,13 +4,15 @@ ) where -import Control.Applicative+import Prelude ()+import Prelude.Compat+ import Control.Monad import Data.List import Data.Maybe import System.Directory import System.Environment-import System.Exit+import System.Exit.Compat import System.FilePath import System.FilePath.Glob
test/Hpack/RunSpec.hs view
@@ -172,7 +172,7 @@ ] it "retains section field order" $ do- renderPackage defaultRenderSettings 0 [] [("executable foo", ["default-language", "main-is", "ghc-options"])] package {packageExecutables = [(section $ executable "foo" "Main.hs") {sectionGhcOptions = ["-Wall", "-Werror"]}]} `shouldBe` unlines [+ renderPackage defaultRenderSettings 0 [] [("executable foo", ["default-language", "main-is", "ghc-options"])] package {packageExecutables = [(section $ executable "foo" "Main.hs") {sectionGhcOptions = ["-Wall"]}]} `shouldBe` unlines [ "name: foo" , "version: 0.0.0" , "build-type: Simple"@@ -181,7 +181,7 @@ , "executable foo" , " default-language: Haskell2010" , " main-is: Main.hs"- , " ghc-options: -Wall -Werror"+ , " ghc-options: -Wall" ] @@ -204,7 +204,7 @@ ] it "includes GHC options" $ do- renderPackage_ package {packageExecutables = [(section $ executable "foo" "Main.hs") {sectionGhcOptions = ["-Wall", "-Werror"]}]} `shouldBe` unlines [+ renderPackage_ package {packageExecutables = [(section $ executable "foo" "Main.hs") {sectionGhcOptions = ["-Wall"]}]} `shouldBe` unlines [ "name: foo" , "version: 0.0.0" , "build-type: Simple"@@ -212,7 +212,7 @@ , "" , "executable foo" , " main-is: Main.hs"- , " ghc-options: -Wall -Werror"+ , " ghc-options: -Wall" , " default-language: Haskell2010" ]
test/HpackSpec.hs view
@@ -12,22 +12,14 @@ import Test.QuickCheck import Hpack-import Hpack.Config-import Hpack.Convert+import Hpack.Config ()+import Hpack.Convert () makeVersion :: [Int] -> Version makeVersion v = Version v [] spec :: Spec spec = do- describe "parseVerbosity" $ do- it "returns True by default" $ do- parseVerbosity ["foo"] `shouldBe` (True, ["foo"])-- context "with --silent" $ do- it "returns False" $ do- parseVerbosity ["--silent"] `shouldBe` (False, [])- describe "extractVersion" $ do it "extracts Hpack version from a cabal file" $ do let cabalFile = ["-- This file has been generated from package.yaml by hpack version 0.10.0."]