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

Side by Side Diff: pkg/analyzer/bin/analyzer.dart

Issue 287653003: set exitCode on errors or warnings (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env dart 1 #!/usr/bin/env dart
2 2
3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
4 // for details. All rights reserved. Use of this source code is governed by a 4 // for details. All rights reserved. Use of this source code is governed by a
5 // BSD-style license that can be found in the LICENSE file. 5 // BSD-style license that can be found in the LICENSE file.
6 6
7 /** The entry point for the analyzer. */ 7 /** The entry point for the analyzer. */
8 library analyzer; 8 library analyzer;
9 9
10 import 'dart:async'; 10 import 'dart:async';
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 PerformanceStatistics.reset(); 63 PerformanceStatistics.reset();
64 startTime = JavaSystem.currentTimeMillis(); 64 startTime = JavaSystem.currentTimeMillis();
65 analyzer = new AnalyzerImpl(sourcePath, options, startTime); 65 analyzer = new AnalyzerImpl(sourcePath, options, startTime);
66 return analyzer.analyzeSync(); 66 return analyzer.analyzeSync();
67 } 67 }
68 int startTime = JavaSystem.currentTimeMillis(); 68 int startTime = JavaSystem.currentTimeMillis();
69 AnalyzerImpl analyzer = new AnalyzerImpl(sourcePath, options, startTime); 69 AnalyzerImpl analyzer = new AnalyzerImpl(sourcePath, options, startTime);
70 if (async) { 70 if (async) {
71 return analyzer.analyzeAsync(); 71 return analyzer.analyzeAsync();
72 } else { 72 } else {
73 return analyzer.analyzeSync(); 73 var errorSeverity = analyzer.analyzeSync();
74 if (errorSeverity == ErrorSeverity.ERROR) {
75 exitCode = errorSeverity.ordinal;
76 }
77 if (options.warningsAreFatal && errorSeverity == ErrorSeverity.WARNING) {
78 exitCode = errorSeverity.ordinal;
79 }
80 return errorSeverity;
74 } 81 }
75 } 82 }
76 83
77 typedef ErrorSeverity BatchRunnerHandler(List<String> args); 84 typedef ErrorSeverity BatchRunnerHandler(List<String> args);
78 85
79 /// Provides a framework to read command line options from stdin and feed them t o a callback. 86 /// Provides a framework to read command line options from stdin and feed them t o a callback.
80 class BatchRunner { 87 class BatchRunner {
81 /** 88 /**
82 * Run the tool in 'batch' mode, receiving command lines through stdin and ret urning pass/fail 89 * Run the tool in 'batch' mode, receiving command lines through stdin and ret urning pass/fail
83 * status through stdout. This feature is intended for use in unit testing. 90 * status through stdout. This feature is intended for use in unit testing.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 stdout.writeln('>>> TEST $resultPassString ${stopwatch.elapsedMillisecon ds}ms'); 132 stdout.writeln('>>> TEST $resultPassString ${stopwatch.elapsedMillisecon ds}ms');
126 } catch (e, stackTrace) { 133 } catch (e, stackTrace) {
127 stderr.writeln(e); 134 stderr.writeln(e);
128 stderr.writeln(stackTrace); 135 stderr.writeln(stackTrace);
129 stderr.writeln('>>> EOF STDERR'); 136 stderr.writeln('>>> EOF STDERR');
130 stdout.writeln('>>> TEST CRASH'); 137 stdout.writeln('>>> TEST CRASH');
131 } 138 }
132 }); 139 });
133 } 140 }
134 } 141 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698