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

Unified Diff: pkg/analyzer/lib/src/analyzer_impl.dart

Issue 200423006: Fix batch mode to now print out errors, this gets us closer to the FYI bot passing (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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/analyzer/bin/analyzer.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/analyzer_impl.dart
diff --git a/pkg/analyzer/lib/src/analyzer_impl.dart b/pkg/analyzer/lib/src/analyzer_impl.dart
index ea4783449e03725470c8687399168d46d2c7b7db..4a80e44f5db55fbdf36f53251cea6eb30e533ad4 100644
--- a/pkg/analyzer/lib/src/analyzer_impl.dart
+++ b/pkg/analyzer/lib/src/analyzer_impl.dart
@@ -109,6 +109,9 @@ class AnalyzerImpl {
prepareSources(libraryElement);
prepareErrors();
+ // print errors and performance numbers
+ _printErrorsAndPerf();
+
// compute max severity and set exitCode
ErrorSeverity status = maxErrorSeverity;
if (status == ErrorSeverity.WARNING && options.warningsAreFatal) {
@@ -136,44 +139,57 @@ class AnalyzerImpl {
// prepare errors
prepareErrors();
+ // print errors and performance numbers
+ _printErrorsAndPerf();
+
// compute max severity and set exitCode
ErrorSeverity status = maxErrorSeverity;
if (status == ErrorSeverity.WARNING && options.warningsAreFatal) {
status = ErrorSeverity.ERROR;
}
exitCode = status.ordinal;
-
- // print errors
- ErrorFormatter formatter = new ErrorFormatter(stdout, options);
- formatter.formatErrors(errorInfos);
-
- // print performance numbers
- if (options.perf) {
- int totalTime = JavaSystem.currentTimeMillis() - startTime;
- int ioTime = PerformanceStatistics.io.result;
- int scanTime = PerformanceStatistics.scan.result;
- int parseTime = PerformanceStatistics.parse.result;
- int resolveTime = PerformanceStatistics.resolve.result;
- int errorsTime = PerformanceStatistics.errors.result;
- int hintsTime = PerformanceStatistics.hints.result;
- int angularTime = PerformanceStatistics.angular.result;
- stdout.writeln("io:$ioTime");
- stdout.writeln("scan:$scanTime");
- stdout.writeln("parse:$parseTime");
- stdout.writeln("resolve:$resolveTime");
- stdout.writeln("errors:$errorsTime");
- stdout.writeln("hints:$hintsTime");
- stdout.writeln("angular:$angularTime");
- stdout.writeln("other:${totalTime
- - (ioTime + scanTime + parseTime + resolveTime + errorsTime + hintsTime
- + angularTime)}");
- stdout.writeln("total:$totalTime");
- }
}).catchError((ex, st) {
AnalysisEngine.instance.logger.logError("${ex}\n${st}");
});
}
+ _printErrorsAndPerf() {
+ // The following is a hack. We currently print out to stderr to ensure that
+ // when in batch mode we print to stderr, this is because the prints from
+ // batch are made to stderr. The reason that options.shouldBatch isn't used
+ // is because when the argument flags are constructed in BatchRunner and
+ // passed in from batch mode which removes the batch flag to prevent the
+ // "cannot have the batch flag and source file" error message.
+ IOSink sink = options.machineFormat ? stderr : stdout;
+
+ // print errors
+ ErrorFormatter formatter = new ErrorFormatter(sink, options);
+ formatter.formatErrors(errorInfos);
+
+ // print performance numbers
+ if (options.perf) {
+ int totalTime = JavaSystem.currentTimeMillis() - startTime;
+ int ioTime = PerformanceStatistics.io.result;
+ int scanTime = PerformanceStatistics.scan.result;
+ int parseTime = PerformanceStatistics.parse.result;
+ int resolveTime = PerformanceStatistics.resolve.result;
+ int errorsTime = PerformanceStatistics.errors.result;
+ int hintsTime = PerformanceStatistics.hints.result;
+ int angularTime = PerformanceStatistics.angular.result;
+ stdout.writeln("io:$ioTime");
+ stdout.writeln("scan:$scanTime");
+ stdout.writeln("parse:$parseTime");
+ stdout.writeln("resolve:$resolveTime");
+ stdout.writeln("errors:$errorsTime");
+ stdout.writeln("hints:$hintsTime");
+ stdout.writeln("angular:$angularTime");
+ stdout.writeln("other:${totalTime
+ - (ioTime + scanTime + parseTime + resolveTime + errorsTime + hintsTime
+ + angularTime)}");
+ stdout.writeln("total:$totalTime");
+ }
+ }
+
/// Returns the maximal [ErrorSeverity] of the recorded errors.
ErrorSeverity get maxErrorSeverity {
var status = ErrorSeverity.NONE;
« no previous file with comments | « pkg/analyzer/bin/analyzer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698