Index: sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart |
diff --git a/sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart b/sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart |
index a466c2cfc890b2582ea1075a2153e3a6d4152311..3d08e204e3b39fc6e207a5f533127ba68b8a1632 100644 |
--- a/sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart |
+++ b/sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart |
@@ -298,19 +298,23 @@ class BacktrackingSolver { |
// Generate a reverse dependency graph. For each package, create edges to |
// each package that depends on it. |
var dependers = new Map<String, Set<String>>(); |
+ |
+ addDependencies(name, deps) { |
+ dependers.putIfAbsent(name, () => new Set<String>()); |
+ for (var dep in deps) { |
+ dependers.putIfAbsent(dep.name, () => new Set<String>()).add(name); |
+ } |
+ } |
+ |
for (var i = 0; i < _selected.length; i++) { |
var id = _selected[i].current; |
var pubspec = cache.getCachedPubspec(id); |
- if (pubspec == null) continue; |
- dependers.putIfAbsent(id.name, () => new Set<String>()); |
- |
- for (var dep in pubspec.dependencies) { |
- var depender = dependers.putIfAbsent(dep.name, |
- () => new Set<String>()); |
- depender.add(id.name); |
- } |
+ if (pubspec != null) addDependencies(id.name, pubspec.dependencies); |
} |
+ // Include the root package's dependencies. |
+ addDependencies(root.name, root.immediateDependencies); |
+ |
// Now walk the depending graph to see which packages transitively depend |
// on [dependency]. |
var visited = new Set<String>(); |