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

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

Issue 725143004: Format and sort analyzer and analysis_server packages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | « pkg/analysis_server/tool/spec/to_html.dart ('k') | pkg/analyzer/bin/coverage.dart » ('j') | 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
3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 2 // 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 3 // 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. 4 // BSD-style license that can be found in the LICENSE file.
6 5
7 /** The entry point for the analyzer. */ 6 /** The entry point for the analyzer. */
8 library analyzer; 7 library analyzer;
9 8
10 import 'dart:async'; 9 import 'dart:async';
11 import 'dart:convert'; 10 import 'dart:convert';
12 import 'dart:io'; 11 import 'dart:io';
13 12
13 import 'package:analyzer/options.dart';
14 import 'package:analyzer/src/analyzer_impl.dart'; 14 import 'package:analyzer/src/analyzer_impl.dart';
15 import 'package:analyzer/src/generated/engine.dart'; 15 import 'package:analyzer/src/generated/engine.dart';
16 import 'package:analyzer/src/generated/error.dart'; 16 import 'package:analyzer/src/generated/error.dart';
17 import 'package:analyzer/src/generated/interner.dart'; 17 import 'package:analyzer/src/generated/interner.dart';
18 import 'package:analyzer/src/generated/java_core.dart' show JavaSystem; 18 import 'package:analyzer/src/generated/java_core.dart' show JavaSystem;
19 import 'package:analyzer/src/generated/java_engine.dart'; 19 import 'package:analyzer/src/generated/java_engine.dart';
20 import 'package:analyzer/options.dart';
21 20
22 void main(List<String> args) { 21 void main(List<String> args) {
23 StringUtilities.INTERNER = new MappedInterner(); 22 StringUtilities.INTERNER = new MappedInterner();
24 CommandLineOptions options = CommandLineOptions.parse(args); 23 CommandLineOptions options = CommandLineOptions.parse(args);
25 if (options.shouldBatch) { 24 if (options.shouldBatch) {
26 BatchRunner.runAsBatch(args, (List<String> args) { 25 BatchRunner.runAsBatch(args, (List<String> args) {
27 CommandLineOptions options = CommandLineOptions.parse(args); 26 CommandLineOptions options = CommandLineOptions.parse(args);
28 return _analyzeAll(options); 27 return _analyzeAll(options);
29 }); 28 });
30 } else { 29 } else {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 * status through stdout. This feature is intended for use in unit testing. 96 * status through stdout. This feature is intended for use in unit testing.
98 */ 97 */
99 static void runAsBatch(List<String> sharedArgs, BatchRunnerHandler handler) { 98 static void runAsBatch(List<String> sharedArgs, BatchRunnerHandler handler) {
100 stdout.writeln('>>> BATCH START'); 99 stdout.writeln('>>> BATCH START');
101 Stopwatch stopwatch = new Stopwatch(); 100 Stopwatch stopwatch = new Stopwatch();
102 stopwatch.start(); 101 stopwatch.start();
103 int testsFailed = 0; 102 int testsFailed = 0;
104 int totalTests = 0; 103 int totalTests = 0;
105 ErrorSeverity batchResult = ErrorSeverity.NONE; 104 ErrorSeverity batchResult = ErrorSeverity.NONE;
106 // read line from stdin 105 // read line from stdin
107 Stream cmdLine = stdin 106 Stream cmdLine =
108 .transform(UTF8.decoder) 107 stdin.transform(UTF8.decoder).transform(new LineSplitter());
109 .transform(new LineSplitter());
110 cmdLine.listen((String line) { 108 cmdLine.listen((String line) {
111 // may be finish 109 // may be finish
112 if (line.isEmpty) { 110 if (line.isEmpty) {
113 var time = stopwatch.elapsedMilliseconds; 111 var time = stopwatch.elapsedMilliseconds;
114 stdout.writeln('>>> BATCH END (${totalTests - testsFailed}/$totalTests) ${time}ms'); 112 stdout.writeln(
113 '>>> BATCH END (${totalTests - testsFailed}/$totalTests) ${time}ms') ;
115 exitCode = batchResult.ordinal; 114 exitCode = batchResult.ordinal;
116 } 115 }
117 // prepare aruments 116 // prepare aruments
118 var args; 117 var args;
119 { 118 {
120 var lineArgs = line.split(new RegExp('\\s+')); 119 var lineArgs = line.split(new RegExp('\\s+'));
121 args = new List<String>(); 120 args = new List<String>();
122 args.addAll(sharedArgs); 121 args.addAll(sharedArgs);
123 args.addAll(lineArgs); 122 args.addAll(lineArgs);
124 args.remove('-b'); 123 args.remove('-b');
125 args.remove('--batch'); 124 args.remove('--batch');
126 } 125 }
127 // analyze single set of arguments 126 // analyze single set of arguments
128 try { 127 try {
129 totalTests++; 128 totalTests++;
130 ErrorSeverity result = handler(args); 129 ErrorSeverity result = handler(args);
131 bool resultPass = result != ErrorSeverity.ERROR; 130 bool resultPass = result != ErrorSeverity.ERROR;
132 if (!resultPass) { 131 if (!resultPass) {
133 testsFailed++; 132 testsFailed++;
134 } 133 }
135 batchResult = batchResult.max(result); 134 batchResult = batchResult.max(result);
136 // Write stderr end token and flush. 135 // Write stderr end token and flush.
137 stderr.writeln('>>> EOF STDERR'); 136 stderr.writeln('>>> EOF STDERR');
138 String resultPassString = resultPass ? 'PASS' : 'FAIL'; 137 String resultPassString = resultPass ? 'PASS' : 'FAIL';
139 stdout.writeln('>>> TEST $resultPassString ${stopwatch.elapsedMillisecon ds}ms'); 138 stdout.writeln(
139 '>>> TEST $resultPassString ${stopwatch.elapsedMilliseconds}ms');
140 } catch (e, stackTrace) { 140 } catch (e, stackTrace) {
141 stderr.writeln(e); 141 stderr.writeln(e);
142 stderr.writeln(stackTrace); 142 stderr.writeln(stackTrace);
143 stderr.writeln('>>> EOF STDERR'); 143 stderr.writeln('>>> EOF STDERR');
144 stdout.writeln('>>> TEST CRASH'); 144 stdout.writeln('>>> TEST CRASH');
145 } 145 }
146 }); 146 });
147 } 147 }
148 } 148 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/tool/spec/to_html.dart ('k') | pkg/analyzer/bin/coverage.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698