Commit ce30b4ad authored by John Ericson's avatar John Ericson
Browse files

Make `getAllInternalToolDependencies` only returns exe names

Because we resolve those internally, the pkg name and version bound are
both irrelevant
parent 6d993e21
-- | See <https://github.com/ezyang/ghc-proposals/blob/backpack/proposals/0000-backpack.rst>
module Distribution.Backpack.ComponentsGraph (
ComponentsGraph,
dispComponentsGraph,
......@@ -7,15 +6,16 @@ module Distribution.Backpack.ComponentsGraph (
componentCycleMsg
) where
import Prelude ()
import Distribution.Compat.Prelude
import Distribution.Package
import Distribution.PackageDescription as PD hiding (Flag)
import Distribution.Simple.BuildToolDepends
import Distribution.Simple.LocalBuildInfo
import Distribution.Types.ComponentRequestedSpec
import Distribution.Types.Dependency
import Distribution.Types.ExeDependency
import Distribution.Types.UnqualComponentName
import Distribution.Simple.Utils
import Distribution.Compat.Graph (Node(..))
import qualified Distribution.Compat.Graph as Graph
......@@ -55,9 +55,7 @@ toComponentsGraph enabled pkg_descr =
where
-- The dependencies for the given component
componentDeps component =
[ CExeName toolname
| (ExeDependency _ toolname _)
<- getAllInternalToolDependencies pkg_descr bi ]
(CExeName <$> getAllInternalToolDependencies pkg_descr bi)
++ [ if pkgname == packageName pkg_descr
then CLibName
......
......@@ -19,7 +19,6 @@ import Distribution.Compat.Prelude hiding ((<>))
import Distribution.Backpack.Id
import Distribution.Types.Dependency
import Distribution.Types.ExeDependency
import Distribution.Types.IncludeRenaming
import Distribution.Types.Mixin
import Distribution.Types.UnqualComponentName
......@@ -170,8 +169,7 @@ toConfiguredComponent pkg_descr this_cid
| otherwise
= Map.toList external_lib_map
exe_deps = [ cid
| (ExeDependency _ toolName _)
<- getAllInternalToolDependencies pkg_descr bi
| toolName <- getAllInternalToolDependencies pkg_descr bi
, Just cid <- [ Map.lookup toolName exe_map ] ]
-- | Also computes the 'ComponentId', and sets cc_public if necessary.
......
......@@ -603,7 +603,8 @@ checkFields pkg =
internalExeDeps =
[ dep
| bi <- allBuildInfo pkg
, dep <- getAllInternalToolDependencies pkg bi
, dep <- getAllToolDependencies pkg bi
, isInternal pkg dep
]
depInternalLibraryWithExtraVersion =
......
......@@ -30,7 +30,6 @@ import Prelude ()
import Distribution.Compat.Prelude
import Distribution.Types.Dependency
import Distribution.Types.ExeDependency
import Distribution.Types.LocalBuildInfo
import Distribution.Types.TargetInfo
import Distribution.Types.ComponentRequestedSpec
......@@ -537,7 +536,7 @@ addInternalBuildTools pkg lbi bi progs =
where
internalBuildTools =
[ simpleConfiguredProgram toolName' (FoundOnSystem toolLocation)
| ExeDependency _ toolName _ <- getAllInternalToolDependencies pkg bi
| toolName <- getAllInternalToolDependencies pkg bi
, let toolName' = unUnqualComponentName toolName
, let toolLocation = buildDir lbi </> toolName' </> toolName' <.> exeExtension ]
......
......@@ -5,7 +5,9 @@
-- the functions contained to access those fields directly.
module Distribution.Simple.BuildToolDepends where
import Data.Maybe
import Prelude ()
import Distribution.Compat.Prelude
import qualified Data.Map as Map
import Distribution.Package
......@@ -86,6 +88,9 @@ isInternal pkg (ExeDependency n _ _) = n == packageName pkg
-- restrictions that apply to `isInternal` also apply to this function.
getAllInternalToolDependencies :: PackageDescription
-> BuildInfo
-> [ExeDependency]
-> [UnqualComponentName]
getAllInternalToolDependencies pkg bi =
filter (isInternal pkg) $ getAllToolDependencies pkg bi
[ toolname
| dep@(ExeDependency _ toolname _) <- getAllToolDependencies pkg bi
, isInternal pkg dep
]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment