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

Unified Diff: sdk/lib/_internal/pub/bin/async_compile.dart

Issue 542193005: Delete stale compiled files. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise! Created 6 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 | sdk/lib/_internal/pub_generated/bin/async_compile.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/bin/async_compile.dart
diff --git a/sdk/lib/_internal/pub/bin/async_compile.dart b/sdk/lib/_internal/pub/bin/async_compile.dart
index c0d13e64b14b7f9032bdd33e7c6a20c04720f49f..3230302c7cc3b2a955eb74f0ce8cb8baa1591350 100644
--- a/sdk/lib/_internal/pub/bin/async_compile.dart
+++ b/sdk/lib/_internal/pub/bin/async_compile.dart
@@ -95,11 +95,13 @@ void main(List<String> arguments) {
var numCompiled = 0;
// Compile any modified or missing files.
+ var sources = new Set();
for (var entry in new Directory(sourceDir).listSync(recursive: true)) {
if (p.extension(entry.path) != ".dart") continue;
numFiles++;
var relative = p.relative(entry.path, from: sourceDir);
+ sources.add(relative);
var sourceFile = entry as File;
var destPath = p.join(generatedDir, relative);
@@ -114,16 +116,29 @@ void main(List<String> arguments) {
}
}
+ // Delete any previously compiled files whose source no longer exists.
+ for (var entry in new Directory(generatedDir).listSync(recursive: true)) {
+ if (p.extension(entry.path) != ".dart") continue;
+
+ var relative = p.relative(entry.path, from: generatedDir);
+
+ if (!sources.contains(relative)) {
+ _deleteFile(entry.path);
+ if (verbose) print("Deleted $relative");
+ }
+ }
+
// Update the README.
if (currentCommit != lastCommit) {
readme = readme.replaceAll(_commitPattern, currentCommit);
_writeFile(readmePath, readme);
+ if (verbose) print("Updated README.md");
}
- if (verbose) print("Compiled $numCompiled out of $numFiles files");
-
if (numCompiled > 0) _generateSnapshot(buildDir);
+ if (verbose) print("Compiled $numCompiled out of $numFiles files");
+
if (hadFailure) exit(1);
}
« no previous file with comments | « no previous file | sdk/lib/_internal/pub_generated/bin/async_compile.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698