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

Unified Diff: sdk/lib/_internal/pub/lib/src/entrypoint.dart

Issue 792993004: Properly delete cached dependencies that should no longer be cached. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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/test/get/cache_transformed_dependency_test.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/entrypoint.dart
diff --git a/sdk/lib/_internal/pub/lib/src/entrypoint.dart b/sdk/lib/_internal/pub/lib/src/entrypoint.dart
index 5c2c8454d28963c6504371957d724f6a340add0b..811ae0bf7507e597b00cedf3fd8929d6ebcecdce 100644
--- a/sdk/lib/_internal/pub/lib/src/entrypoint.dart
+++ b/sdk/lib/_internal/pub/lib/src/entrypoint.dart
@@ -183,6 +183,22 @@ class Entrypoint {
changed);
}).map((package) => package.name).toSet();
+ if (dirExists(depsDir)) {
+ // Delete any cached dependencies that are going to be recached.
+ for (var package in dependenciesToPrecompile) {
+ deleteEntry(path.join(depsDir, package));
+ }
+
+ // Also delete any cached dependencies that should no longer be cached.
+ for (var subdir in listDir(depsDir)) {
+ var package = graph.packages[path.basename(subdir)];
+ if (package == null || package.pubspec.transformers.isEmpty ||
+ graph.isPackageMutable(package.name)) {
+ deleteEntry(subdir);
+ }
+ }
+ }
+
if (dependenciesToPrecompile.isEmpty) return;
await log.progress("Precompiling dependencies", () async {
@@ -190,11 +206,6 @@ class Entrypoint {
unionAll(dependenciesToPrecompile.map(graph.transitiveDependencies))
.map((package) => package.name).toSet();
- // TODO(nweiz): Use for/in here when
- // https://github.com/dart-lang/async_await/issues/68 is fixed.
- dependenciesToPrecompile.forEach((package) =>
- deleteEntry(path.join(depsDir, package)));
-
var environment = await AssetEnvironment.create(this, BarbackMode.DEBUG,
packages: packagesToLoad, useDart2JS: false);
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/test/get/cache_transformed_dependency_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698