cartel 0.8.0.0 → 0.10.0.0
raw patch · 9 files changed
+292/−138 lines, 9 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Cartel.Ast: buildInfo :: Field a => BuildInfoField -> a
- Cartel.Ast: class Field a
- Cartel.Ast: conditional :: Field a => CondBlock a -> a
- Cartel.Ast: instance Field BenchmarkField
- Cartel.Ast: instance Field ExecutableField
- Cartel.Ast: instance Field LibraryField
- Cartel.Ast: instance Field TestSuiteField
- Cartel.Defaults: cabal :: Cabal
- Cartel.Defaults: flag :: Flag
- Cartel.Defaults: properties :: Properties
- Cartel.Defaults: repository :: Vcs -> Maybe String -> String -> Repository
+ Cartel.Empty: class Empty a
+ Cartel.Empty: empty :: Empty a => a
+ Cartel.Empty: instance Empty Cabal
+ Cartel.Empty: instance Empty Flag
+ Cartel.Empty: instance Empty Properties
+ Cartel.Empty: instance Empty Repository
+ Cartel.Tools: arch :: String -> CondTree
+ Cartel.Tools: buildDepends :: Field a => [Package] -> a
+ Cartel.Tools: buildInfo :: Field a => BuildInfoField -> a
+ Cartel.Tools: buildTools :: Field a => [Package] -> a
+ Cartel.Tools: buildable :: Field a => Bool -> a
+ Cartel.Tools: cSources :: Field a => [String] -> a
+ Cartel.Tools: ccOptions :: Field a => [String] -> a
+ Cartel.Tools: cif :: Field a => CondTree -> [a] -> [a] -> a
+ Cartel.Tools: class Field a
+ Cartel.Tools: class LogicTree a
+ Cartel.Tools: conditional :: Field a => CondBlock a -> a
+ Cartel.Tools: cppOptions :: Field a => [String] -> a
+ Cartel.Tools: defaultLanguage :: Field a => Language -> a
+ Cartel.Tools: extensions :: Field a => [String] -> a
+ Cartel.Tools: extraLibDirs :: Field a => [String] -> a
+ Cartel.Tools: extraLibraries :: Field a => [String] -> a
+ Cartel.Tools: false :: CondTree
+ Cartel.Tools: flag :: String -> CondTree
+ Cartel.Tools: frameworks :: Field a => [String] -> a
+ Cartel.Tools: ghcOptions :: Field a => [String] -> a
+ Cartel.Tools: ghcProfOptions :: Field a => [String] -> a
+ Cartel.Tools: ghcSharedOptions :: Field a => [String] -> a
+ Cartel.Tools: hsSourceDirs :: Field a => [String] -> a
+ Cartel.Tools: hugsOptions :: Field a => [String] -> a
+ Cartel.Tools: impl :: Compiler -> Maybe ConstrTree -> CondTree
+ Cartel.Tools: includeDirs :: Field a => [String] -> a
+ Cartel.Tools: includes :: Field a => [String] -> a
+ Cartel.Tools: installIncludes :: Field a => [String] -> a
+ Cartel.Tools: instance Field BenchmarkField
+ Cartel.Tools: instance Field ExecutableField
+ Cartel.Tools: instance Field LibraryField
+ Cartel.Tools: instance Field TestSuiteField
+ Cartel.Tools: instance LogicTree CondTree
+ Cartel.Tools: instance LogicTree ConstrTree
+ Cartel.Tools: ldOptions :: Field a => [String] -> a
+ Cartel.Tools: nhc98Options :: Field a => [String] -> a
+ Cartel.Tools: otherModules :: Field a => [String] -> a
+ Cartel.Tools: pkgConfigDepends :: Field a => [Package] -> a
+ Cartel.Tools: system :: String -> CondTree
+ Cartel.Tools: true :: CondTree
- Cartel.Tools: (&&&) :: ConstrTree -> ConstrTree -> ConstrTree
+ Cartel.Tools: (&&&) :: LogicTree a => a -> a -> a
- Cartel.Tools: (|||) :: ConstrTree -> ConstrTree -> ConstrTree
+ Cartel.Tools: (|||) :: LogicTree a => a -> a -> a
Files
- cartel.cabal +4/−4
- current-versions.txt +3/−3
- genCabal.hs +1/−1
- lib/Cartel.hs +2/−2
- lib/Cartel/Ast.hs +1/−31
- lib/Cartel/Defaults.hs +0/−86
- lib/Cartel/Empty.hs +79/−0
- lib/Cartel/Tools.hs +199/−8
- minimum-versions.txt +3/−3
cartel.cabal view
@@ -3,10 +3,10 @@ -- http://www.github.com/massysett/cartel -- -- Script name used to generate: genCabal.hs--- Generated on: 2014-05-29 21:17:51.6472 EDT--- Cartel library version: 0.6.0.0+-- Generated on: 2014-05-30 10:21:35.348429 EDT+-- Cartel library version: Version {versionBranch = [0,1,0,0], versionTags = []} name: cartel-version: 0.8.0.0+version: 0.10.0.0 cabal-version: >= 1.14 build-type: Simple license: BSD3@@ -36,7 +36,7 @@ exposed-modules: Cartel , Cartel.Ast- , Cartel.Defaults+ , Cartel.Empty , Cartel.Render , Cartel.Tools exposed: True
current-versions.txt view
@@ -1,7 +1,7 @@ This package was tested to work with these dependency versions and compiler version. These are the default versions fetched by cabal install.-Tested as of: 2014-05-28 23:55:01.837807 UTC+Tested as of: 2014-05-30 16:15:53.772569 UTC Path to compiler: ghc-7.8.2 Compiler description: 7.8.2 @@ -33,6 +33,6 @@ transformers-0.3.0.0 unix-2.7.0.1 -/home/massysett/cartel/sunlight-24643/db:- cartel-0.4.0.0+/home/massysett/cartel/sunlight-11214/db:+ cartel-0.10.0.0
genCabal.hs view
@@ -49,7 +49,7 @@ properties :: A.Properties properties = A.properties { A.prName = "cartel"- , A.prVersion = A.Version [0,8,0,0]+ , A.prVersion = A.Version [0,10,0,0] , A.prCabalVersion = (1, 14) , A.prBuildType = A.Simple , A.prLicense = A.BSD3
lib/Cartel.hs view
@@ -48,10 +48,10 @@ module Cartel ( module Cartel.Ast- , module Cartel.Defaults+ , module Cartel.Empty , module Cartel.Tools ) where import Cartel.Ast-import Cartel.Defaults+import Cartel.Empty import Cartel.Tools
lib/Cartel/Ast.hs view
@@ -44,9 +44,6 @@ , CondTree(..) , CondBlock(..) - -- * Field class- , Field(..)- -- * Libraries , LibraryField(..) , Library(..)@@ -145,7 +142,7 @@ -- | Global package properties. Most of the 'String' fields are -- optional; to leave them blank, use the empty string. To future--- proof your code, use 'Cartel.Defaults.properties', which provides+-- proof your code, use 'Cartel.Empty.empty', which provides -- this record already filled in with default values (which are -- typically blank.) Then you only alter the fields you wish to -- fill in.@@ -241,17 +238,6 @@ } deriving (Eq, Ord, Show) --- | Things that can be an item in a field in a Cabal file.--class Field a where-- -- | Takes a conditional block and wraps it in the field type.- conditional :: CondBlock a -> a-- -- | Takes a build information field and wraps it in the field- -- type.- buildInfo :: BuildInfoField -> a- -- | A field in the @Library@ section of the Cabal file. A -- @Library@ section can have multiple fields. data LibraryField@@ -269,10 +255,6 @@ -- ^ The @Library@ section can contain build information. deriving (Eq, Ord, Show) -instance Field LibraryField where- conditional = LibConditional- buildInfo = LibInfo- -- | The entire @Library@ section. newtype Library = Library { libFields :: [LibraryField]@@ -294,10 +276,6 @@ deriving (Eq, Ord, Show) -instance Field ExecutableField where- conditional = ExeConditional- buildInfo = ExeInfo- -- | An entire @Executable@ section. data Executable = Executable { exeName :: String@@ -345,10 +323,6 @@ deriving (Eq, Ord, Show) -instance Field TestSuiteField where- conditional = TestConditional- buildInfo = TestInfo- -- | An entire test suite section. data TestSuite = TestSuite { tsName :: String@@ -367,10 +341,6 @@ | BenchmarkInfo BuildInfoField -- ^ A benchmark can have build information fields. deriving (Eq, Ord, Show)--instance Field BenchmarkField where- conditional = BenchmarkConditional- buildInfo = BenchmarkInfo data Benchmark = Benchmark { bmName :: String
− lib/Cartel/Defaults.hs
@@ -1,86 +0,0 @@--- | Default values for the data types in "Cartel.Ast". These--- defaults are genrally filled in with blank values. Use these--- default values where you can; by doing so you help future-proof--- your code. Use the default as a starting point and fill in the--- values that you need.-module Cartel.Defaults where--import qualified Cartel.Ast as A---- | A default 'A.Properties'. 'A.prCabalVersion' is @(1, 14)@ to--- specify Cabal version 1.14; 'A.prBuildType' is 'A.Simple', and--- 'A.prLicense' is 'A.BSD3'. All other items are either the empty--- 'String' or the empty list, including the 'A.prVersion', which is--- left empty.-properties :: A.Properties-properties = A.Properties- { A.prName = ""- , A.prVersion = A.Version []- , A.prCabalVersion = (1, 14)- , A.prBuildType = A.Simple- , A.prLicense = A.BSD3- , A.prLicenseFile = ""- , A.prLicenseFiles = []- , A.prCopyright = ""- , A.prAuthor = ""- , A.prMaintainer = ""- , A.prStability = ""- , A.prHomepage = ""- , A.prBugReports = ""- , A.prPackageUrl = ""- , A.prSynopsis = ""- , A.prDescription = []- , A.prCategory = ""- , A.prTestedWith = []- , A.prDataFiles = []- , A.prDataDir = ""- , A.prExtraSourceFiles = []- , A.prExtraDocFiles = []- , A.prExtraTmpFiles = []- }---- | A default 'A.Cabal'. 'properties' is used for 'A.cProperties',--- and 'A.cLibrary' is 'Nothing'; all other lists are empty.-cabal :: A.Cabal-cabal = A.Cabal- { A.cProperties = properties- , A.cRepositories = []- , A.cFlags = []- , A.cLibrary = Nothing- , A.cExecutables = []- , A.cTestSuites = []- , A.cBenchmarks = []- }---- | A default 'A.Repository'. You must supply the VCS type,--- information about the kind of repository ('A.Head' or 'A.This'),--- and the repository location. 'A.repoBranch' and 'A.repoSubdir'--- are empty.-repository- :: A.Vcs- -- ^ Type of VCS in use- -> Maybe String- -- ^ To use the @this@ repo kind, use Just String, where the- -- String is the tag corresponding to the current branch. To use- -- the @head@ repository kind, use Nothing.- -> String- -- ^ Repo location- -> A.Repository-repository v ms l = A.Repository- { A.repoVcs = v- , A.repoKind = maybe A.Head (const A.This) ms- , A.repoLocation = l- , A.repoBranch = ""- , A.repoTag = maybe "" id ms- , A.repoSubdir = ""- }---- | A default 'A.Flag'. 'A.flName' and 'A.flDescription' are--- empty; 'A.flDefault' is 'True', and 'A.flManual' is 'False'.-flag :: A.Flag-flag = A.Flag- { A.flName = ""- , A.flDescription = ""- , A.flDefault = True- , A.flManual = False- }
+ lib/Cartel/Empty.hs view
@@ -0,0 +1,79 @@+-- | Default values for the data types in "Cartel.Ast". These+-- defaults are genrally filled in with blank values. Use these+-- default values where you can; by doing so you help future-proof+-- your code. Use the empty value as a starting point and fill in+-- the components of the record that you need.+module Cartel.Empty where++import qualified Cartel.Ast as A++class Empty a where+ empty :: a++-- | A default 'A.Properties'. 'A.prCabalVersion' is @(1, 14)@ to+-- specify Cabal version 1.14; 'A.prBuildType' is 'A.Simple', and+-- 'A.prLicense' is 'A.BSD3'. All other items are either the empty+-- 'String' or the empty list, including the 'A.prVersion', which is+-- left empty.+instance Empty A.Properties where+ empty = A.Properties+ { A.prName = ""+ , A.prVersion = A.Version []+ , A.prCabalVersion = (1, 14)+ , A.prBuildType = A.Simple+ , A.prLicense = A.BSD3+ , A.prLicenseFile = ""+ , A.prLicenseFiles = []+ , A.prCopyright = ""+ , A.prAuthor = ""+ , A.prMaintainer = ""+ , A.prStability = ""+ , A.prHomepage = ""+ , A.prBugReports = ""+ , A.prPackageUrl = ""+ , A.prSynopsis = ""+ , A.prDescription = []+ , A.prCategory = ""+ , A.prTestedWith = []+ , A.prDataFiles = []+ , A.prDataDir = ""+ , A.prExtraSourceFiles = []+ , A.prExtraDocFiles = []+ , A.prExtraTmpFiles = []+ }++-- | A default 'A.Cabal'. 'empty' is used for 'A.cProperties',+-- and 'A.cLibrary' is 'Nothing'; all other lists are empty.+instance Empty A.Cabal where+ empty = A.Cabal+ { A.cProperties = empty+ , A.cRepositories = []+ , A.cFlags = []+ , A.cLibrary = Nothing+ , A.cExecutables = []+ , A.cTestSuites = []+ , A.cBenchmarks = []+ }++-- | A default 'A.Repository'. The VCS type is 'A.Git' and the+-- repository kind is 'A.Head'. All other values are the empty+-- string.+instance Empty A.Repository where+ empty = A.Repository+ { A.repoVcs = A.Git+ , A.repoKind = A.Head+ , A.repoLocation = ""+ , A.repoBranch = ""+ , A.repoTag = ""+ , A.repoSubdir = ""+ }++-- | A default 'A.Flag'. 'A.flName' and 'A.flDescription' are+-- empty; 'A.flDefault' is 'True', and 'A.flManual' is 'False'.+instance Empty A.Flag where+ empty = A.Flag+ { A.flName = ""+ , A.flDescription = ""+ , A.flDefault = True+ , A.flManual = False+ }
lib/Cartel/Tools.hs view
@@ -1,11 +1,12 @@ module Cartel.Tools- ( -- * Building constraints+ ( -- * Logic trees+ LogicTree(..)+ + -- * Building constraints -- | Helpers to build many common version constraints. -- ** Building constraint trees- (&&&)- , (|||) , lt , gt , eq@@ -19,6 +20,43 @@ , nextMajor , exactly + -- * Field class+ , Field(..)++ -- ** Conditionals+ , cif+ , system+ , arch+ , impl+ , flag+ , true+ , false++ -- ** Build info builders+ , buildDepends+ , otherModules+ , hsSourceDirs+ , extensions+ , buildTools+ , buildable+ , ghcOptions+ , ghcProfOptions+ , ghcSharedOptions+ , hugsOptions+ , nhc98Options+ , includes+ , installIncludes+ , includeDirs+ , cSources+ , extraLibraries+ , extraLibDirs+ , ccOptions+ , cppOptions+ , ldOptions+ , pkgConfigDepends+ , frameworks+ , defaultLanguage+ -- * Rendering a cabal file , render , renderString@@ -42,16 +80,22 @@ import qualified Paths_cartel import qualified System.IO as IO -(&&&) :: A.ConstrTree -> A.ConstrTree -> A.ConstrTree-l &&& r = A.Branch A.And l r+class LogicTree a where+ (&&&) :: a -> a -> a+ (|||) :: a -> a -> a infixr 3 &&&+infixr 2 ||| -(|||) :: A.ConstrTree -> A.ConstrTree -> A.ConstrTree-l ||| r = A.Branch A.Or l r+instance LogicTree A.ConstrTree where+ l &&& r = A.Branch A.And l r+ l ||| r = A.Branch A.Or l r -infixr 2 |||+instance LogicTree A.CondTree where+ l &&& r = A.CBranch A.And l r+ l ||| r = A.CBranch A.Or l r + lt :: [Int] -> A.ConstrTree lt = A.Leaf . A.Constraint LT . A.Version @@ -274,6 +318,153 @@ else return $ if interestingFile exts this then [(P.dropExtension this : dirs)] else []++-- | Things that can be an item in a field in a Cabal file.+class Field a where++ -- | Takes a conditional block and wraps it in the field type.+ conditional :: A.CondBlock a -> a++ -- | Takes a build information field and wraps it in the field+ -- type.+ buildInfo :: A.BuildInfoField -> a++instance Field A.LibraryField where+ conditional = A.LibConditional+ buildInfo = A.LibInfo++instance Field A.ExecutableField where+ conditional = A.ExeConditional+ buildInfo = A.ExeInfo++instance Field A.TestSuiteField where+ conditional = A.TestConditional+ buildInfo = A.TestInfo++instance Field A.BenchmarkField where+ conditional = A.BenchmarkConditional+ buildInfo = A.BenchmarkInfo++-- # Build info helpers+buildDepends :: Field a => [A.Package] -> a+buildDepends = buildInfo . A.BuildDepends++otherModules :: Field a => [String] -> a+otherModules = buildInfo . A.OtherModules++hsSourceDirs :: Field a => [String] -> a+hsSourceDirs = buildInfo . A.HsSourceDirs++extensions :: Field a => [String] -> a+extensions = buildInfo . A.Extensions++buildTools :: Field a => [A.Package] -> a+buildTools = buildInfo . A.BuildTools++buildable :: Field a => Bool -> a+buildable = buildInfo . A.Buildable++ghcOptions :: Field a => [String] -> a+ghcOptions = buildInfo . A.GHCOptions++ghcProfOptions :: Field a => [String] -> a+ghcProfOptions = buildInfo . A.GHCProfOptions++ghcSharedOptions :: Field a => [String] -> a+ghcSharedOptions = buildInfo . A.GHCSharedOptions++hugsOptions :: Field a => [String] -> a+hugsOptions = buildInfo . A.HugsOptions++nhc98Options :: Field a => [String] -> a+nhc98Options = buildInfo . A.Nhc98Options++includes :: Field a => [String] -> a+includes = buildInfo . A.Includes++installIncludes :: Field a => [String] -> a+installIncludes = buildInfo . A.InstallIncludes++includeDirs :: Field a => [String] -> a+includeDirs = buildInfo . A.IncludeDirs++cSources :: Field a => [String] -> a+cSources = buildInfo . A.CSources++extraLibraries :: Field a => [String] -> a+extraLibraries = buildInfo . A.ExtraLibraries++extraLibDirs :: Field a => [String] -> a+extraLibDirs = buildInfo . A.ExtraLibDirs++ccOptions :: Field a => [String] -> a+ccOptions = buildInfo . A.CCOptions++cppOptions :: Field a => [String] -> a+cppOptions = buildInfo . A.CPPOptions++ldOptions :: Field a => [String] -> a+ldOptions = buildInfo . A.LDOptions++pkgConfigDepends :: Field a => [A.Package] -> a+pkgConfigDepends = buildInfo . A.PkgConfigDepends++frameworks :: Field a => [String] -> a+frameworks = buildInfo . A.Frameworks++defaultLanguage :: Field a => A.Language -> a+defaultLanguage = buildInfo . A.DefaultLanguage++-- | Builds @if@ statements. Use with the following functions, such+-- as 'flag', to make it easy to build conditional blocks. For+-- example:+--+-- > cif (flag "buildExe") [buildable True] [buildable False]+--+-- A little more complicated:+--+-- > cif (flag "buildExe" &&& system "windows")+-- > [buildable True] [buildable False]+cif+ :: Field a+ => A.CondTree+ -- ^ Condition to satisfy+ -> [a]+ -- ^ Use these results if condition is true+ -> [a]+ -- ^ Use these results if condition if false+ -> a+cif tree ifTrue ifFalse =+ conditional $ A.CondBlock tree ifTrue ifFalse++-- | Operating system; tested against @System.Info.os@ on the+-- target system.+system :: String -> A.CondTree+system = A.CLeaf . A.OS++-- | Argument is matched against @System.Info.arch@ on the target+-- system.+arch :: String -> A.CondTree+arch = A.CLeaf . A.Arch++-- | Tests for the configured Haskell implementation.+impl :: A.Compiler -> Maybe A.ConstrTree -> A.CondTree+impl cm cn = A.CLeaf $ A.Impl (cm, cn)++-- | Evaluates to the current assignment of the flag of the given+-- name. Flag names are case insensitive. Testing for flags that+-- have not been introduced with a flag section is an error.+flag :: String -> A.CondTree+flag = A.CLeaf . A.CFlag++-- | Always true.+true :: A.CondTree+true = A.CLeaf A.CTrue++-- | Always false.+false :: A.CondTree+false = A.CLeaf A.CFalse+ -- | Renders a 'A.Cabal' data type as a string. renderString
minimum-versions.txt view
@@ -1,7 +1,7 @@ This package was tested to work with these dependency versions and compiler version. These are the minimum versions given in the .cabal file.-Tested as of: 2014-05-28 23:55:01.837807 UTC+Tested as of: 2014-05-30 16:15:53.772569 UTC Path to compiler: ghc-7.4.1 Compiler description: 7.4.1 @@ -33,6 +33,6 @@ time-1.4 unix-2.5.1.0 -/home/massysett/cartel/sunlight-24643/db:- cartel-0.4.0.0+/home/massysett/cartel/sunlight-11214/db:+ cartel-0.10.0.0