Skip to content

Commit 721f422

Browse files
committed
Add "tool-depends" field to BuildInfo and parse it (with caveat)
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.
1 parent 56ef995 commit 721f422

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

Cabal/Distribution/PackageDescription/Parse.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,9 @@ binfoFieldDescrs =
411411
, commaListField "build-tools"
412412
disp parse
413413
buildTools (\xs binfo -> binfo{buildTools=xs})
414+
, commaListField "tool-depends"
415+
disp parse
416+
toolDepends (\xs binfo -> binfo{toolDepends=xs})
414417
, commaListFieldWithSep vcat "build-depends"
415418
disp parse
416419
targetBuildDepends (\xs binfo -> binfo{targetBuildDepends=xs})

Cabal/Distribution/PackageDescription/Parsec/FieldDescr.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,9 @@ binfoFieldDescrs =
417417
, commaListField "build-tools"
418418
disp parsec
419419
buildTools (\xs binfo -> binfo{buildTools=xs})
420+
, commaListField "tool-depends"
421+
disp parsec
422+
toolDepends (\xs binfo -> binfo{toolDepends=xs})
420423
, commaListFieldWithSep vcat "build-depends"
421424
disp parsec
422425
targetBuildDepends (\xs binfo -> binfo{targetBuildDepends=xs})

Cabal/Distribution/Types/BuildInfo.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import Language.Haskell.Extension
3030
data BuildInfo = BuildInfo {
3131
buildable :: Bool, -- ^ component is buildable here
3232
buildTools :: [LegacyExeDependency], -- ^ tools needed to build this bit
33+
toolDepends :: [ExeDependency], -- ^ haskell tools needed to build this bit
3334
cppOptions :: [String], -- ^ options for pre-processing Haskell code
3435
ccOptions :: [String], -- ^ options for C compiler
3536
ldOptions :: [String], -- ^ options for linker
@@ -71,6 +72,7 @@ instance Monoid BuildInfo where
7172
mempty = BuildInfo {
7273
buildable = True,
7374
buildTools = [],
75+
toolDepends = [],
7476
cppOptions = [],
7577
ccOptions = [],
7678
ldOptions = [],
@@ -106,6 +108,7 @@ instance Semigroup BuildInfo where
106108
a <> b = BuildInfo {
107109
buildable = buildable a && buildable b,
108110
buildTools = combine buildTools,
111+
toolDepends = combine toolDepends,
109112
cppOptions = combine cppOptions,
110113
ccOptions = combine ccOptions,
111114
ldOptions = combine ldOptions,

0 commit comments

Comments
 (0)