Commit f63273da authored by Edward Z. Yang's avatar Edward Z. Yang
Browse files

Introduce InstallPlan.depends = nodeNeighbors and use it.


Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
parent c41ead76
......@@ -28,6 +28,7 @@ module Distribution.Client.InstallPlan (
new,
toList,
planIndepGoals,
depends,
fromSolverInstallPlan,
configureInstallPlan,
......@@ -161,6 +162,9 @@ data GenericPlanPackage ipkg srcpkg
type IsUnit a = (IsNode a, Key a ~ UnitId)
depends :: IsUnit a => a -> [UnitId]
depends = nodeNeighbors
-- NB: Expanded constraint synonym here to avoid undecidable
-- instance errors in GHC 7.8 and earlier.
instance (IsNode ipkg, IsNode srcpkg, Key ipkg ~ UnitId, Key srcpkg ~ UnitId)
......
......@@ -351,7 +351,7 @@ foldMInstallPlanDepOrder plan0 visit =
depresults =
map (\ipkgid -> let Just result = Map.lookup ipkgid results
in result)
(nodeNeighbors pkg)
(InstallPlan.depends pkg)
result <- visit pkg depresults
let results' = Map.insert (nodeKey pkg) result results
go results' pkgs
......
......@@ -1744,9 +1744,10 @@ pruneInstallPlanPass1 perPkgTargetsMap pkgs =
-- stanzas in the next pass.
--
pruneOptionalDependencies :: ElaboratedConfiguredPackage -> [UnitId]
pruneOptionalDependencies elab@ElaboratedConfiguredPackage{ elabPkgOrComp = ElabComponent _ } = nodeNeighbors elab -- no pruning
pruneOptionalDependencies ElaboratedConfiguredPackage{ elabPkgOrComp = ElabPackage pkg } =
(CD.flatDeps . CD.filterDeps keepNeeded) (pkgOrderDependencies pkg)
pruneOptionalDependencies elab@ElaboratedConfiguredPackage{ elabPkgOrComp = ElabComponent _ }
= InstallPlan.depends elab -- no pruning
pruneOptionalDependencies ElaboratedConfiguredPackage{ elabPkgOrComp = ElabPackage pkg }
= (CD.flatDeps . CD.filterDeps keepNeeded) (pkgOrderDependencies pkg)
where
keepNeeded (CD.ComponentTest _) _ = TestStanzas `Set.member` stanzas
keepNeeded (CD.ComponentBench _) _ = BenchStanzas `Set.member` stanzas
......@@ -1865,7 +1866,7 @@ pruneInstallPlanPass2 pkgs =
hasReverseLibDeps :: Set UnitId
hasReverseLibDeps =
Set.fromList [ depid | pkg <- pkgs
, depid <- nodeNeighbors pkg ]
, depid <- InstallPlan.depends pkg ]
mapConfiguredPackage :: (srcpkg -> srcpkg')
-> InstallPlan.GenericPlanPackage ipkg srcpkg
......@@ -2211,7 +2212,7 @@ setupHsConfigureFlags (ReadyPackage elab@ElaboratedConfiguredPackage{..})
-- we only use configDependencies, unless we're talking to an old Cabal
-- in which case we use configConstraints
-- NB: This does NOT use nodeNeighbors, which includes executable
-- NB: This does NOT use InstallPlan.depends, which includes executable
-- dependencies which should NOT be fed in here (also you don't have
-- enough info anyway)
configDependencies = [ (packageName srcid, cid)
......
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