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

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

Issue 115533003: Show implicit pub dependency on barback in errors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
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 d1f687ee9beaf0ad59ae48bc4c6fe73df592e10d..e80db88465f295c627f17a4a2941514ea3dc6426 100644
--- a/sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart
+++ b/sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart
@@ -509,6 +509,26 @@ class Traverser {
var dependencies = _getDependencies(dep.name);
dependencies.add(new Dependency(depender, dep));
+ // If the package is barback, pub has an implicit version constraint on it
+ // since pub itself uses barback too. Note that we don't check for the
+ // hosted source here because we still want to do this even when people on
+ // the Dart team are on the bleeding edge and have a path dependency on the
nweiz 2013/12/13 23:15:21 Long lines.
Bob Nystrom 2013/12/14 00:07:35 Done.
+ // tip version of barback in the Dart repo.
+ if (dep.name == "barback" && dependencies.length == 1) {
nweiz 2013/12/13 23:15:21 Document why you're checking [dependencies.length]
Bob Nystrom 2013/12/14 00:07:35 Yup. Done.
+ var range = new VersionRange(
+ min: barback.supportedVersion, includeMin: true,
+ max: barback.supportedVersion.nextMinor, includeMax: false);
+ _solver.logSolve('add implicit $range pub dependency on barback');
+
+ // Use the same source and description as the explicit dependency.
+ // That way, this doesn't fail with a source/desc conflict if users
+ // (like Dart team members) use things like a path dependency to
+ // find barback.
+ var barbackDep = new PackageDep(dep.name, dep.source, range,
+ dep.description);
+ dependencies.add(new Dependency("pub", barbackDep));
nweiz 2013/12/13 23:15:21 Just using the string "pub" here worries me. If we
Bob Nystrom 2013/12/14 00:07:35 Changed it to "pub itself" and then tweaked SolveF
+ }
+
var constraint = _getConstraint(dep.name);
// See if it's possible for a package to match that constraint.
@@ -639,19 +659,6 @@ class Traverser {
.map((dep) => dep.dep.constraint)
.fold(VersionConstraint.any, (a, b) => a.intersect(b));
- // If the package is barback, pub has an implicit version constraint on it
- // since pub itself uses barback too. Note that we don't check for the
- // hosted source here because we still want to do this even when people on
- // the Dart team are on the bleeding edge and have a path dependency on the
- // tip version of barback in the Dart repo.
- if (name == "barback") {
- var range = new VersionRange(
- min: barback.supportedVersion, includeMin: true,
- max: barback.supportedVersion.nextMinor, includeMax: false);
- constraint = constraint.intersect(range);
- _solver.logSolve('add implicit $range constraint to barback');
- }
-
return constraint;
}

Powered by Google App Engine
This is Rietveld 408576698