| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analyze_helper; | 5 library analyze_helper; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 import 'package:compiler/compiler.dart' as api; | 9 import 'package:compiler/compiler.dart' as api; |
| 10 import 'package:compiler/src/apiimpl.dart'; | 10 import 'package:compiler/src/apiimpl.dart'; |
| 11 import 'package:compiler/src/commandline_options.dart'; |
| 11 import 'package:compiler/src/diagnostics/messages.dart' show | 12 import 'package:compiler/src/diagnostics/messages.dart' show |
| 12 Message; | 13 Message; |
| 13 import 'package:compiler/src/filenames.dart'; | 14 import 'package:compiler/src/filenames.dart'; |
| 14 import 'package:compiler/src/source_file_provider.dart'; | 15 import 'package:compiler/src/source_file_provider.dart'; |
| 15 import 'package:compiler/src/util/uri_extras.dart'; | 16 import 'package:compiler/src/util/uri_extras.dart'; |
| 16 | 17 |
| 17 /** | 18 /** |
| 18 * Map of whitelisted warnings and errors. | 19 * Map of whitelisted warnings and errors. |
| 19 * | 20 * |
| 20 * Only add a whitelisting together with a bug report to dartbug.com and add | 21 * Only add a whitelisting together with a bug report to dartbug.com and add |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 === | 149 === |
| 149 | 150 |
| 150 | 151 |
| 151 """); | 152 """); |
| 152 | 153 |
| 153 var libraryRoot = currentDirectory.resolve('sdk/'); | 154 var libraryRoot = currentDirectory.resolve('sdk/'); |
| 154 var packageRoot = | 155 var packageRoot = |
| 155 currentDirectory.resolveUri(new Uri.file('${Platform.packageRoot}/')); | 156 currentDirectory.resolveUri(new Uri.file('${Platform.packageRoot}/')); |
| 156 var provider = new CompilerSourceFileProvider(); | 157 var provider = new CompilerSourceFileProvider(); |
| 157 var handler = new CollectingDiagnosticHandler(whiteList, provider); | 158 var handler = new CollectingDiagnosticHandler(whiteList, provider); |
| 158 var options = <String>['--analyze-only', '--categories=Client,Server', | 159 var options = <String>[Flags.analyzeOnly, '--categories=Client,Server', |
| 159 '--show-package-warnings']; | 160 Flags.showPackageWarnings]; |
| 160 if (analyzeAll) options.add('--analyze-all'); | 161 if (analyzeAll) options.add(Flags.analyzeAll); |
| 161 var compiler = new Compiler( | 162 var compiler = new Compiler( |
| 162 provider, | 163 provider, |
| 163 null, | 164 null, |
| 164 handler, | 165 handler, |
| 165 libraryRoot, | 166 libraryRoot, |
| 166 packageRoot, | 167 packageRoot, |
| 167 options, | 168 options, |
| 168 {}); | 169 {}); |
| 169 String MESSAGE = """ | 170 String MESSAGE = """ |
| 170 | 171 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 188 exit(1); | 189 exit(1); |
| 189 } | 190 } |
| 190 } | 191 } |
| 191 if (analyzeAll) { | 192 if (analyzeAll) { |
| 192 compiler.librariesToAnalyzeWhenRun = uriList; | 193 compiler.librariesToAnalyzeWhenRun = uriList; |
| 193 return compiler.run(null).then(onCompletion); | 194 return compiler.run(null).then(onCompletion); |
| 194 } else { | 195 } else { |
| 195 return compiler.run(uriList.single).then(onCompletion); | 196 return compiler.run(uriList.single).then(onCompletion); |
| 196 } | 197 } |
| 197 } | 198 } |
| OLD | NEW |