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

Unified Diff: sdk/lib/_internal/pub_generated/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
Index: sdk/lib/_internal/pub_generated/bin/async_compile.dart
diff --git a/sdk/lib/_internal/pub_generated/bin/async_compile.dart b/sdk/lib/_internal/pub_generated/bin/async_compile.dart
index b291ab389f61c03632377677c46f935db656501b..736ba80e0d283e8d8432ce78beabbd59b2e9b98d 100644
--- a/sdk/lib/_internal/pub_generated/bin/async_compile.dart
+++ b/sdk/lib/_internal/pub_generated/bin/async_compile.dart
@@ -52,10 +52,12 @@ void main(List<String> arguments) {
lastCommit = match[0];
var numFiles = 0;
var numCompiled = 0;
+ var sources = new Set<String>();
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);
var destFile = new File(destPath);
@@ -68,12 +70,21 @@ void main(List<String> arguments) {
if (verbose) print("Compiled $relative");
}
}
+ 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");
+ }
+ }
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);
}
void _compile(String sourcePath, String source, String destPath) {
« no previous file with comments | « sdk/lib/_internal/pub/bin/async_compile.dart ('k') | sdk/lib/_internal/pub_generated/lib/src/barback/asset_environment.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698