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

Unified Diff: lib/src/compiler.dart

Issue 1402713002: Implement --dump-info for batch mode. (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 5 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 | « bin/dartdevc.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/compiler.dart
diff --git a/lib/src/compiler.dart b/lib/src/compiler.dart
index 819451840f309b9434d9019e5edd5548f99202a2..eb84ce9451c16f688ea9ea794782be11b7eb626c 100644
--- a/lib/src/compiler.dart
+++ b/lib/src/compiler.dart
@@ -7,6 +7,7 @@ library dev_compiler.src.compiler;
import 'dart:async';
import 'dart:collection';
+import 'dart:convert' show JSON;
import 'dart:math' as math;
import 'dart:io';
@@ -60,12 +61,25 @@ CompilerOptions validateOptions(List<String> args, {bool forceOutDir: false}) {
return options;
}
+/// Compile with the given options and return success or failure.
bool compile(CompilerOptions options) {
assert(!options.serverMode);
+
var context = createAnalysisContextWithSources(
options.strongOptions, options.sourceOptions);
var reporter = createErrorReporter(context, options);
- return new BatchCompiler(context, options, reporter: reporter).run();
+ bool status = new BatchCompiler(context, options, reporter: reporter).run();
+
+ if (options.dumpInfo && reporter is SummaryReporter) {
Jennifer Messerly 2015/10/13 00:14:21 is this code from somewhere else? Would it make se
+ var result = (reporter as SummaryReporter).result;
+ print(summaryToString(result));
+ if (options.dumpInfoFile != null) {
+ var file = new File(options.dumpInfoFile);
+ file.writeAsStringSync(JSON.encode(result.toJsonMap()));
+ }
+ }
+
+ return status;
}
// Callback on each individual compiled library
« no previous file with comments | « bin/dartdevc.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698