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

Unified Diff: pkg/dev_compiler/lib/src/compiler/command.dart

Issue 2435203002: Emit API-only summaries (Closed)
Patch Set: Created 4 years, 2 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 | « pkg/dev_compiler/lib/src/compiler/code_generator.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dev_compiler/lib/src/compiler/command.dart
diff --git a/pkg/dev_compiler/lib/src/compiler/command.dart b/pkg/dev_compiler/lib/src/compiler/command.dart
index eff733c6e4a3ad82ac940353793313066c846110..352fb0880cba81d2d66bcd34e00437cfc7008a02 100644
--- a/pkg/dev_compiler/lib/src/compiler/command.dart
+++ b/pkg/dev_compiler/lib/src/compiler/command.dart
@@ -81,6 +81,15 @@ $stackTrace
}
}
+bool _changed(List<int> list1, List<int> list2) {
+ var length = list1.length;
+ if (length != list2.length) return true;
+ for (var i = 0; i < length; ++i) {
+ if (list1[i] != list2[i]) return true;
+ }
+ return false;
+}
+
void _compile(ArgResults argResults, void printFn(Object obj)) {
var compiler =
new ModuleCompiler(new AnalyzerOptions.fromArguments(argResults));
@@ -150,7 +159,13 @@ void _compile(ArgResults argResults, void printFn(Object obj)) {
if (module.summaryBytes != null) {
var summaryPath =
path.withoutExtension(outPath) + '.${compilerOpts.summaryExtension}';
- new File(summaryPath).writeAsBytesSync(module.summaryBytes);
+ // Only overwrite if summary changed. This plays better with timestamp
+ // based build systems.
+ var file = new File(summaryPath);
+ if (!file.existsSync() ||
+ _changed(file.readAsBytesSync(), module.summaryBytes)) {
+ file.writeAsBytesSync(module.summaryBytes);
+ }
}
}
}
« no previous file with comments | « pkg/dev_compiler/lib/src/compiler/code_generator.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698