Chromium Code Reviews| 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..9e5462fdb2caaf3f445a599a03bea40850fc2f00 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<String>(); |
|
nweiz
2014/09/10 21:08:18
Nit: I wouldn't type this.
Bob Nystrom
2014/09/10 22:42:34
Done.
|
| 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; |
|
nweiz
2014/09/10 21:08:18
If there are specific non-Dart files we don't want
Bob Nystrom
2014/09/10 22:42:34
I think it's better to whitelist this. The compile
|
| + |
| + 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); |
| } |