Skip to content

Commit

Permalink
Cabal should look for unknown build-tools entries on the PATH too
Browse files Browse the repository at this point in the history
This is a bug from `first build-tool-depends` PR: haskell#4104

Also, remove TODO about factoring things out. The exact set of deps filter
here is no longer so globally relevant, and
`Distribution.Simple.BuildToolDepends` exposes better filters which are.
  • Loading branch information
Ericson2314 committed Jan 20, 2017
1 parent a6a9d7a commit e9dee12
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions Cabal/Distribution/Simple/Configure.hs
Original file line number Diff line number Diff line change
Expand Up @@ -570,19 +570,31 @@ configure (pkg_descr0', pbi) cfg = do
die $ "Cannot build some foreign libraries: "
++ intercalate "," unsupportedFLibs

-- Configure known/required programs & external build tools.
-- Exclude build-tool deps on "internal" exes in the same package
-- Configure certain external build tools, see below for which ones.
--
-- TODO: Factor this into a helper package.
---
-- TODO: HACK we're currently ignoring wildcard deps as we don't know
-- precisely which executables the resolved package will contain.
let requiredBuildTools =
[ LegacyExeDependency (unUnqualComponentName eName) versionRange
| bi <- enabledBuildInfos pkg_descr enabled
, buildTool@(ExeDependency _ (Just eName) versionRange)
<- getAllToolDependencies pkg_descr bi
, not $ isInternal pkg_descr buildTool ]
let requiredBuildTools = do
bi <- enabledBuildInfos pkg_descr enabled
-- First, we collect any tool dep that we know is external. This is,
-- in practice:
--
-- 1. `build-tools` entries on the whitelist
--
-- 2. `build-tool-depends` that aren't from the current package.
let externBuildToolDeps =
[ LegacyExeDependency (unUnqualComponentName eName) versionRange
| buildTool@(ExeDependency _ (Just eName) versionRange)
<- getAllToolDependencies pkg_descr bi
, not $ isInternal pkg_descr buildTool ]
-- Second, we collect any build-tools entry we don't know how to
-- desugar. We'll never have no idea how to build them, so we just
-- hope they are already on the PATH.
let unknownBuildTools =
[ buildTool
| buildTool <- buildTools bi
, Nothing == desugarBuildTool pkg_descr buildTool ]
externBuildToolDeps ++ unknownBuildTools

programDb' <-
configureAllKnownPrograms (lessVerbose verbosity) programDb
Expand Down

0 comments on commit e9dee12

Please sign in to comment.