From 354905baaa4113a22fb585d5b4dd2dd0c90adc60 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 12 Nov 2016 12:12:53 -0800 Subject: [PATCH] Add "tool-depends" field to `BuildInfo` and parse it (with caveat) #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. --- Cabal/Distribution/PackageDescription/Parse.hs | 3 +++ Cabal/Distribution/PackageDescription/Parsec/FieldDescr.hs | 3 +++ Cabal/Distribution/Types/BuildInfo.hs | 3 +++ 3 files changed, 9 insertions(+) diff --git a/Cabal/Distribution/PackageDescription/Parse.hs b/Cabal/Distribution/PackageDescription/Parse.hs index 0ee2eeae5ab..be8d58abaf5 100644 --- a/Cabal/Distribution/PackageDescription/Parse.hs +++ b/Cabal/Distribution/PackageDescription/Parse.hs @@ -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}) diff --git a/Cabal/Distribution/PackageDescription/Parsec/FieldDescr.hs b/Cabal/Distribution/PackageDescription/Parsec/FieldDescr.hs index 3b9029256a2..45123681195 100644 --- a/Cabal/Distribution/PackageDescription/Parsec/FieldDescr.hs +++ b/Cabal/Distribution/PackageDescription/Parsec/FieldDescr.hs @@ -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}) diff --git a/Cabal/Distribution/Types/BuildInfo.hs b/Cabal/Distribution/Types/BuildInfo.hs index 3b60c573a81..3204e5b497a 100644 --- a/Cabal/Distribution/Types/BuildInfo.hs +++ b/Cabal/Distribution/Types/BuildInfo.hs @@ -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 @@ -69,6 +70,7 @@ instance Monoid BuildInfo where mempty = BuildInfo { buildable = True, buildTools = [], + toolDepends = [], cppOptions = [], ccOptions = [], ldOptions = [], @@ -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,