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

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

Issue 105473002: Implicitly constrain barback to versions pub supports. (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 | « sdk/lib/_internal/pub/lib/src/barback.dart ('k') | sdk/lib/_internal/pub/lib/src/version.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 c38295c348871f726025f2b38cd63fb1115e7704..5ff0d082aa54ab164f4c6703ee11d9ec93568ebc 100644
--- a/sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart
+++ b/sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart
@@ -36,6 +36,7 @@ library pub.solver.backtracking_solver;
import 'dart:async';
import 'dart:collection' show Queue;
+import '../barback.dart' as barback;
import '../lock_file.dart';
import '../log.dart' as log;
import '../package.dart';
@@ -594,9 +595,24 @@ class Traverser {
/// Gets the combined [VersionConstraint] currently being placed on package
/// [name].
VersionConstraint _getConstraint(String name) {
- return _getDependencies(name)
+ var constraint = _getDependencies(name)
.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;
}
/// Gets the package [name] that's currently contained in the lockfile if it
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/barback.dart ('k') | sdk/lib/_internal/pub/lib/src/version.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698