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

Unified Diff: utils/pub/entrypoint.dart

Issue 10952015: Delete the packages/ directory before installing new packages to it. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 | utils/tests/pub/pub_install_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 abce4db8777548f03890d1710be4bb9d40cc9157..7f4db15c7d142ed7b8f133ec334bcca3acb10160 100644
--- a/utils/pub/entrypoint.dart
+++ b/utils/pub/entrypoint.dart
@@ -137,11 +137,11 @@ class Entrypoint {
}
/**
- * Installs all dependencies listed in [packageVersions] and writes a
- * [LockFile].
+ * Removes the old packages directory, installs all dependencies listed in
+ * [packageVersions], and writes a [LockFile].
*/
Future _installDependencies(List<PackageId> packageVersions) {
- return _removeUnusedDependencies(packageVersions).chain((_) {
+ return cleanDir(path).chain((_) {
return Futures.wait(packageVersions.map((id) {
if (id.source is RootSource) return new Future.immediate(id);
return install(id);
@@ -182,27 +182,6 @@ class Entrypoint {
}
/**
- * Removes all dependencies that are no longer depended on from the `packages`
- * directory. [packageIds] is a list of all packages that are still depended
- * on.
- */
- Future _removeUnusedDependencies(List<PackageId> packageIds) {
- var dependenciesToKeep = packageIds.map((id) => id.name);
-
- return dirExists(path).chain((exists) {
- if (exists) return listDir(path);
- return new Future.immediate([]);
- }).chain((existingDependencies) {
- existingDependencies = existingDependencies.map(basename);
- var dependenciesToRemove =
- new List.from(setMinus(existingDependencies, dependenciesToKeep));
- return Futures.wait(dependenciesToRemove.map((dependency) {
- return deleteDir(join(path, dependency));
- }));
- });
- }
-
- /**
* Saves a list of concrete package versions to the `pubspec.lock` file.
*/
Future _saveLockFile(List<PackageId> packageIds) {
« no previous file with comments | « no previous file | utils/tests/pub/pub_install_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698