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

Unified Diff: utils/pub/solver/version_solver.dart

Issue 14298006: Select packages that match SDK constraints. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix an import. Created 7 years, 8 months 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 | « utils/pub/solver/backtracking_solver.dart ('k') | utils/tests/pub/sdk_constraint_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/solver/version_solver.dart
diff --git a/utils/pub/solver/version_solver.dart b/utils/pub/solver/version_solver.dart
index a3d058e0e6cf60c3a320feda671deae63cddea65..cf60e22c53decc9b5c965fc86d0693e629e10099 100644
--- a/utils/pub/solver/version_solver.dart
+++ b/utils/pub/solver/version_solver.dart
@@ -73,12 +73,14 @@ class VersionSolver {
/// successful or an error if it failed to find a solution.
Future<SolveResult> solve() {
var stopwatch = new Stopwatch();
- stopwatch.start();
- // Pre-cache the root package's known pubspec.
- cache.cache(new PackageId.root(root), root.pubspec);
+ return new Future(() {
+ stopwatch.start();
- return runSolver().then((packages) {
+ // Pre-cache the root package's known pubspec.
+ cache.cache(new PackageId.root(root), root.pubspec);
+ return runSolver();
+ }).then((packages) {
return new SolveResult(packages, null, attemptedSolutions);
}).catchError((error) {
if (error is! SolveFailure) throw error;
@@ -304,12 +306,13 @@ class SolveFailure implements Exception {
/// Exception thrown when the [VersionSolver] fails to find a solution after a
/// certain number of iterations.
class CouldNotSolveException extends SolveFailure {
- CouldNotSolveException()
- : super(null, null);
+ CouldNotSolveException([String message])
+ : super(null, null),
+ _message = (message != null) ? message :
+ "Could not find a solution that met all constraints.";
/// A message describing the specific kind of solve failure.
- String get _message =>
- "Could not find a solution that met all constraints.";
+ final String _message;
}
/// Exception thrown when the [VersionConstraint] used to match a package is
« no previous file with comments | « utils/pub/solver/backtracking_solver.dart ('k') | utils/tests/pub/sdk_constraint_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698