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

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

Issue 844263004: Properly update git binary snapshots during pub upgrade. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix tests Created 5 years, 11 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 | « no previous file | sdk/lib/_internal/pub/lib/src/source/git.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 241fcb6aae710d27d53e2b951e622d05c459ac78..b339dd24575fc893ba3a4f61f962c0312338b7c9 100644
--- a/sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart
+++ b/sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart
@@ -126,7 +126,7 @@ class BacktrackingSolver {
///
/// Completes with a list of specific package versions if successful or an
/// error if it failed to find a solution.
- Future<SolveResult> solve() {
+ Future<SolveResult> solve() async {
var stopwatch = new Stopwatch();
_logParameters();
@@ -135,35 +135,35 @@ class BacktrackingSolver {
var overrides = _overrides.values.toList();
overrides.sort((a, b) => a.name.compareTo(b.name));
- return newFuture(() {
+ try {
stopwatch.start();
// Pre-cache the root package's known pubspec.
cache.cache(new PackageId.root(root), root.pubspec);
_validateSdkConstraint(root.pubspec);
- return _traverseSolution();
- }).then((packages) {
+ var packages = await _traverseSolution();
var pubspecs = new Map.fromIterable(packages,
key: (id) => id.name,
value: (id) => cache.getCachedPubspec(id));
+ packages = await Future.wait(
+ packages.map((id) => sources[id.source].resolveId(id)));
+
return new SolveResult.success(sources, root, lockFile, packages,
overrides, pubspecs, _getAvailableVersions(packages),
attemptedSolutions);
- }).catchError((error) {
- if (error is! SolveFailure) throw error;
-
+ } on SolveFailure catch (error) {
// Wrap a failure in a result so we can attach some other data.
return new SolveResult.failure(sources, root, lockFile, overrides,
error, attemptedSolutions);
- }).whenComplete(() {
+ } finally {
// Gather some solving metrics.
var buffer = new StringBuffer();
buffer.writeln('${runtimeType} took ${stopwatch.elapsed} seconds.');
buffer.writeln(cache.describeResults());
log.solver(buffer);
- });
+ }
}
/// Generates a map containing all of the known available versions for each
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/lib/src/source/git.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698