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

Side by Side Diff: sdk/lib/_internal/pub/lib/src/solver/dependency_queue.dart

Issue 122463002: Fix version_negotiation_test timing out. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library pub.solver.dependency_queue; 5 library pub.solver.dependency_queue;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection' show Queue; 8 import 'dart:collection' show Queue;
9 9
10 import '../log.dart' as log; 10 import '../log.dart' as log;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 _isSorted = true; 118 _isSorted = true;
119 }); 119 });
120 120
121 return _sortFuture; 121 return _sortFuture;
122 } 122 }
123 123
124 /// Given a dependency, returns a future that completes to the number of 124 /// Given a dependency, returns a future that completes to the number of
125 /// versions available for it. 125 /// versions available for it.
126 Future<int> _getNumVersions(PackageDep dep) { 126 Future<int> _getNumVersions(PackageDep dep) {
127 // There is only ever one version of the root package. 127 // There is only ever one version of the root package.
128 if (dep.isRoot) { 128 if (dep.isRoot) return new Future.value(1);
129 return new Future.value(1);
130 }
131 129
132 return _solver.cache.getVersions(dep.toRef()).then((versions) { 130 return _solver.cache.getVersions(dep.toRef())
133 return versions.length; 131 .then((versions) => versions.length);
134 }).catchError((error, trace) {
135 // If it fails for any reason, just treat that as no versions. This
136 // will sort this reference higher so that we can traverse into it
137 // and report the error more properly.
138 log.solver("Could not get versions for $dep:\n$error\n\n$trace");
139 return 0;
140 });
141 } 132 }
142 } 133 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/pub.status » ('j') | sdk/lib/_internal/pub/test/hosted/version_negotiation_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698