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

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

Issue 136063005: Add a "cache add" command to download packages to the cache. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 6 years, 10 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 | « sdk/lib/_internal/pub/lib/src/command/cache_add.dart ('k') | sdk/lib/_internal/pub/lib/src/source.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/version_solver.dart
diff --git a/sdk/lib/_internal/pub/lib/src/solver/version_solver.dart b/sdk/lib/_internal/pub/lib/src/solver/version_solver.dart
index 60e71a6f453f3cd5c49a9bddcef87ced4f2ba44f..6ac4aad5513ee2aed95501249761406ba679c942 100644
--- a/sdk/lib/_internal/pub/lib/src/solver/version_solver.dart
+++ b/sdk/lib/_internal/pub/lib/src/solver/version_solver.dart
@@ -181,17 +181,11 @@ class PubspecCache {
var source = _sources[package.source];
return source.getVersions(package.name, package.description)
.then((versions) {
- // Sort by descending version so we try newer versions first.
- versions.sort((a, b) {
- // Sort all prerelease versions after all normal versions. This way
- // the solver will prefer stable packages over unstable ones.
- if (a.isPreRelease && !b.isPreRelease) return 1;
- if (!a.isPreRelease && b.isPreRelease) return -1;
+ // Sort by priority so we try preferred versions first.
+ versions.sort(Version.prioritize);
- return b.compareTo(a);
- });
-
- var ids = versions.map((version) => package.atVersion(version)).toList();
+ var ids = versions.reversed.map(
+ (version) => package.atVersion(version)).toList();
_versions[package] = ids;
return ids;
});
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/command/cache_add.dart ('k') | sdk/lib/_internal/pub/lib/src/source.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698