Skip to content

Commit 3ac512e

Browse files
committed
defer build-tools-depends choices as well as setup choices
1 parent dab09b2 commit 3ac512e

File tree

1 file changed

+10
-9
lines changed
  • cabal-install-solver/src/Distribution/Solver/Modular

1 file changed

+10
-9
lines changed

cabal-install-solver/src/Distribution/Solver/Modular/Preference.hs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
-- | Reordering or pruning the tree in order to prefer or make certain choices.
33
module Distribution.Solver.Modular.Preference
44
( avoidReinstalls
5-
, deferSetupChoices
5+
, deferSetupExeChoices
66
, deferWeakFlagChoices
77
, enforceManualFlags
88
, enforcePackageConstraints
@@ -407,17 +407,18 @@ preferBaseGoalChoice = trav go
407407
isBase (Goal (P (Q _pp pn)) _) = unPN pn == "base"
408408
isBase _ = False
409409

410-
-- | Deal with setup dependencies after regular dependencies, so that we can
411-
-- will link setup dependencies against package dependencies when possible
412-
deferSetupChoices :: Tree d c -> Tree d c
413-
deferSetupChoices = trav go
410+
-- | Deal with setup and build-tool-depends dependencies after regular dependencies,
411+
-- so we will link setup/exe dependencies against package dependenc ies when possible
412+
deferSetupExeChoices :: Tree d c -> Tree d c
413+
deferSetupExeChoices = trav go
414414
where
415-
go (GoalChoiceF rdm xs) = GoalChoiceF rdm (P.preferByKeys noSetup xs)
415+
go (GoalChoiceF rdm xs) = GoalChoiceF rdm (P.preferByKeys noSetupOrExe xs)
416416
go x = x
417417

418-
noSetup :: Goal QPN -> Bool
419-
noSetup (Goal (P (Q (PackagePath _ns (QualSetup _)) _)) _) = False
420-
noSetup _ = True
418+
noSetupOrExe :: Goal QPN -> Bool
419+
noSetupOrExe (Goal (P (Q (PackagePath _ns (QualSetup _)) _)) _) = False
420+
noSetupOrExe (Goal (P (Q (PackagePath _ns (QualExe _ _)) _)) _) = False
421+
noSetupOrExe _ = True
421422

422423
-- | Transformation that tries to avoid making weak flag choices early.
423424
-- Weak flags are trivial flags (not influencing dependencies) or such

0 commit comments

Comments
 (0)