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

Unified Diff: utils/pub/entrypoint.dart

Issue 10809057: Make "pub update" update all packages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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/command_update.dart ('k') | utils/tests/pub/pub_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/entrypoint.dart
diff --git a/utils/pub/entrypoint.dart b/utils/pub/entrypoint.dart
index a8202ae6aa45263fbb79688f9361ca8f27bca944..6729381df8e05163dbafbc7b552a1a83e995aece 100644
--- a/utils/pub/entrypoint.dart
+++ b/utils/pub/entrypoint.dart
@@ -102,26 +102,34 @@ class Entrypoint {
/**
* Installs all dependencies of the [root] package to its "packages"
- * directory. Returns a [Future] that completes when all dependencies are
- * installed.
+ * directory, respecting the [LockFile] if present. Returns a [Future] that
+ * completes when all dependencies are installed.
*/
Future installDependencies() {
- return _getResolvedDependencies().chain((packageVersions) {
- return Futures.wait(packageVersions.map((id) {
- if (id.source is RootSource) return new Future.immediate(id);
- return install(id);
- }));
- }).chain(_saveLockFile);
+ return _loadLockFile()
+ .chain((lockFile) => resolveVersions(cache.sources, root, lockFile))
+ .chain(_installDependencies);
}
/**
- * Gets a list of all the [PackageId]s that this entrypoint transitively
- * depends on. The concrete versions of these ids are given by the
- * [VersionSolver] and the `pubspec.lock` file, if it exists.
+ * Installs the latest available versions of all dependencies of the [root]
+ * package to its "package" directory, writing a new [LockFile]. Returns a
+ * [Future] that completes when all dependencies are installed.
*/
- Future<List<PackageId>> _getResolvedDependencies() {
- return _loadLockFile().chain((lockFile) =>
- resolveVersions(cache.sources, root, lockFile));
+ Future updateDependencies() {
+ return resolveVersions(cache.sources, root, new LockFile.empty()).
+ chain(_installDependencies);
+ }
+
+ /**
+ * Installs all dependencies listed in [packageVersions] and writes a
+ * [LockFile].
+ */
+ Future _installDependencies(List<PackageId> packageVersions) {
+ return Futures.wait(packageVersions.map((id) {
+ if (id.source is RootSource) return new Future.immediate(id);
+ return install(id);
+ })).chain(_saveLockFile);
}
/**
« no previous file with comments | « utils/pub/command_update.dart ('k') | utils/tests/pub/pub_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698