Skip to content

Commit

Permalink
Add "tool-depends" field to BuildInfo and parse it (with caveat)
Browse files Browse the repository at this point in the history
haskell#3708 says that an entry without an explicit exe component is shorthand for
all exe components, but this complicates parsing so I'm punting for now: an
explicit component name is required.
  • Loading branch information
Ericson2314 committed Nov 12, 2016
1 parent f87fc8e commit 354905b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Cabal/Distribution/PackageDescription/Parse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,9 @@ binfoFieldDescrs =
, commaListField "build-tools"
disp parse
buildTools (\xs binfo -> binfo{buildTools=xs})
, commaListField "tool-depends"
disp parse
toolDepends (\xs binfo -> binfo{toolDepends=xs})
, commaListFieldWithSep vcat "build-depends"
disp parse
targetBuildDepends (\xs binfo -> binfo{targetBuildDepends=xs})
Expand Down
3 changes: 3 additions & 0 deletions Cabal/Distribution/PackageDescription/Parsec/FieldDescr.hs
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,9 @@ binfoFieldDescrs =
, commaListField "build-tools"
disp parsec
buildTools (\xs binfo -> binfo{buildTools=xs})
, commaListField "tool-depends"
disp parsec
toolDepends (\xs binfo -> binfo{toolDepends=xs})
, commaListFieldWithSep vcat "build-depends"
disp parsec
targetBuildDepends (\xs binfo -> binfo{targetBuildDepends=xs})
Expand Down
3 changes: 3 additions & 0 deletions Cabal/Distribution/Types/BuildInfo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import Language.Haskell.Extension
data BuildInfo = BuildInfo {
buildable :: Bool, -- ^ component is buildable here
buildTools :: [LegacyExeDependency], -- ^ tools needed to build this bit
toolDepends :: [ExeDependency], -- ^ haskell tools needed to build this bit
cppOptions :: [String], -- ^ options for pre-processing Haskell code
ccOptions :: [String], -- ^ options for C compiler
ldOptions :: [String], -- ^ options for linker
Expand Down Expand Up @@ -69,6 +70,7 @@ instance Monoid BuildInfo where
mempty = BuildInfo {
buildable = True,
buildTools = [],
toolDepends = [],
cppOptions = [],
ccOptions = [],
ldOptions = [],
Expand Down Expand Up @@ -104,6 +106,7 @@ instance Semigroup BuildInfo where
a <> b = BuildInfo {
buildable = buildable a && buildable b,
buildTools = combine buildTools,
toolDepends = combine toolDepends,
cppOptions = combine cppOptions,
ccOptions = combine ccOptions,
ldOptions = combine ldOptions,
Expand Down

0 comments on commit 354905b

Please sign in to comment.