| OLD | NEW |
| 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'; |
| 11 import 'dart:convert'; | 11 import 'dart:convert'; |
| 12 import 'dart:io'; | 12 import 'dart:io'; |
| 13 | 13 |
| 14 import 'package:analyzer_experimental/src/generated/engine.dart'; | 14 import 'package:analyzer_experimental/src/generated/engine.dart'; |
| 15 import 'package:analyzer_experimental/src/generated/error.dart'; | 15 import 'package:analyzer_experimental/src/generated/error.dart'; |
| 16 import 'package:analyzer_experimental/src/generated/java_core.dart' show JavaSys
tem; |
| 16 import 'package:analyzer_experimental/options.dart'; | 17 import 'package:analyzer_experimental/options.dart'; |
| 17 | 18 |
| 18 import 'package:analyzer_experimental/src/analyzer_impl.dart'; | 19 import 'package:analyzer_experimental/src/analyzer_impl.dart'; |
| 19 import 'package:analyzer_experimental/src/error_formatter.dart'; | 20 import 'package:analyzer_experimental/src/error_formatter.dart'; |
| 20 | 21 |
| 21 void main() { | 22 void main() { |
| 22 var args = new Options().arguments; | 23 var args = new Options().arguments; |
| 23 var options = CommandLineOptions.parse(args); | 24 var options = CommandLineOptions.parse(args); |
| 24 if (options.shouldBatch) { | 25 if (options.shouldBatch) { |
| 25 BatchRunner.runAsBatch(args, (List<String> args) { | 26 BatchRunner.runAsBatch(args, (List<String> args) { |
| 26 var options = CommandLineOptions.parse(args); | 27 var options = CommandLineOptions.parse(args); |
| 27 return _runAnalyzer(options); | 28 return _runAnalyzer(options); |
| 28 }); | 29 }); |
| 29 } else { | 30 } else { |
| 31 int startTime = JavaSystem.currentTimeMillis(); |
| 32 |
| 30 ErrorSeverity result = _runAnalyzer(options); | 33 ErrorSeverity result = _runAnalyzer(options); |
| 34 |
| 35 if (options.perf) { |
| 36 int totalTime = JavaSystem.currentTimeMillis() - startTime; |
| 37 print("scan:${PerformanceStatistics.scan.result}"); |
| 38 print("parse:${PerformanceStatistics.parse.result}"); |
| 39 print("resolve:${PerformanceStatistics.resolve.result}"); |
| 40 print("errors:${PerformanceStatistics.errors.result}"); |
| 41 print("hints:${PerformanceStatistics.hints.result}"); |
| 42 print("total:$totalTime"); |
| 43 } |
| 44 |
| 31 exit(result.ordinal); | 45 exit(result.ordinal); |
| 32 } | 46 } |
| 33 } | 47 } |
| 34 | 48 |
| 35 ErrorSeverity _runAnalyzer(CommandLineOptions options) { | 49 ErrorSeverity _runAnalyzer(CommandLineOptions options) { |
| 36 if (!options.machineFormat) { | 50 if (!options.machineFormat) { |
| 37 stdout.writeln("Analyzing ${options.sourceFiles}..."); | 51 stdout.writeln("Analyzing ${options.sourceFiles}..."); |
| 38 } | 52 } |
| 39 ErrorSeverity allResult = ErrorSeverity.NONE; | 53 ErrorSeverity allResult = ErrorSeverity.NONE; |
| 40 String sourcePath = options.sourceFiles[0]; | 54 String sourcePath = options.sourceFiles[0]; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 stdout.writeln('>>> TEST $resultPassString ${stopwatch.elapsedMillisecon
ds}ms'); | 130 stdout.writeln('>>> TEST $resultPassString ${stopwatch.elapsedMillisecon
ds}ms'); |
| 117 } catch (e, stackTrace) { | 131 } catch (e, stackTrace) { |
| 118 stderr.writeln(e); | 132 stderr.writeln(e); |
| 119 stderr.writeln(stackTrace); | 133 stderr.writeln(stackTrace); |
| 120 stderr.writeln('>>> EOF STDERR'); | 134 stderr.writeln('>>> EOF STDERR'); |
| 121 stdout.writeln('>>> TEST CRASH'); | 135 stdout.writeln('>>> TEST CRASH'); |
| 122 } | 136 } |
| 123 }); | 137 }); |
| 124 } | 138 } |
| 125 } | 139 } |
| OLD | NEW |