| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 library testing.analyze; | 5 library testing.analyze; |
| 6 | 6 |
| 7 import 'dart:async' show Stream, Future; | 7 import 'dart:async' show Stream, Future; |
| 8 | 8 |
| 9 import 'dart:convert' show LineSplitter, UTF8; | 9 import 'dart:convert' show LineSplitter, UTF8; |
| 10 | 10 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 if (uris.isEmpty) return; | 109 if (uris.isEmpty) return; |
| 110 const String analyzerPath = "pkg/analyzer_cli/bin/analyzer.dart"; | 110 const String analyzerPath = "pkg/analyzer_cli/bin/analyzer.dart"; |
| 111 Uri analyzer = Uri.base.resolve(analyzerPath); | 111 Uri analyzer = Uri.base.resolve(analyzerPath); |
| 112 if (!await new File.fromUri(analyzer).exists()) { | 112 if (!await new File.fromUri(analyzer).exists()) { |
| 113 throw "Couldn't find '$analyzerPath' in '${Uri.base.toFilePath()}'"; | 113 throw "Couldn't find '$analyzerPath' in '${Uri.base.toFilePath()}'"; |
| 114 } | 114 } |
| 115 List<String> arguments = <String>[ | 115 List<String> arguments = <String>[ |
| 116 "--packages=${packages.toFilePath()}", | 116 "--packages=${packages.toFilePath()}", |
| 117 "--package-warnings", | 117 "--package-warnings", |
| 118 "--format=machine", | 118 "--format=machine", |
| 119 "--dart-sdk=${Uri.base.resolve('sdk/').toFilePath()}", |
| 119 ]; | 120 ]; |
| 120 if (analysisOptions != null) { | 121 if (analysisOptions != null) { |
| 121 arguments.add("--options=${analysisOptions.toFilePath()}"); | 122 arguments.add("--options=${analysisOptions.toFilePath()}"); |
| 122 } | 123 } |
| 123 arguments.addAll(uris.map((Uri uri) => uri.toFilePath())); | 124 arguments.addAll(uris.map((Uri uri) => uri.toFilePath())); |
| 124 if (isVerbose) { | 125 if (isVerbose) { |
| 125 print("Running:\n ${analyzer.toFilePath()} ${arguments.join(' ')}"); | 126 print("Running:\n ${analyzer.toFilePath()} ${arguments.join(' ')}"); |
| 126 } else { | 127 } else { |
| 127 print("Running dartanalyzer."); | 128 print("Running dartanalyzer."); |
| 128 } | 129 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 145 hasOutput = true; | 146 hasOutput = true; |
| 146 print(message); | 147 print(message); |
| 147 } | 148 } |
| 148 } | 149 } |
| 149 if (hasOutput) { | 150 if (hasOutput) { |
| 150 throw "Non-empty output from analyzer."; | 151 throw "Non-empty output from analyzer."; |
| 151 } | 152 } |
| 152 sw.stop(); | 153 sw.stop(); |
| 153 print("Running analyzer took: ${sw.elapsed}."); | 154 print("Running analyzer took: ${sw.elapsed}."); |
| 154 } | 155 } |
| OLD | NEW |