Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1220)

Unified Diff: sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart

Issue 112473002: Don't crash if a failed dependency is in the root package. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/test/version_solver_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>();
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/test/version_solver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698