Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 analyzer_cli.src.driver; | 5 library analyzer_cli.src.driver; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 import 'dart:io' as io; | 9 import 'dart:io' as io; |
| 10 | 10 |
| 11 import 'package:analyzer/error/error.dart'; | 11 import 'package:analyzer/error/error.dart'; |
| 12 import 'package:analyzer/file_system/file_system.dart' as file_system; | 12 import 'package:analyzer/file_system/file_system.dart' as file_system; |
| 13 import 'package:analyzer/file_system/file_system.dart'; | 13 import 'package:analyzer/file_system/file_system.dart'; |
| 14 import 'package:analyzer/file_system/physical_file_system.dart'; | 14 import 'package:analyzer/file_system/physical_file_system.dart'; |
| 15 import 'package:analyzer/plugin/resolver_provider.dart'; | 15 import 'package:analyzer/plugin/resolver_provider.dart'; |
| 16 import 'package:analyzer/source/analysis_options_provider.dart'; | |
| 17 import 'package:analyzer/source/package_map_provider.dart'; | 16 import 'package:analyzer/source/package_map_provider.dart'; |
| 18 import 'package:analyzer/source/package_map_resolver.dart'; | 17 import 'package:analyzer/source/package_map_resolver.dart'; |
| 19 import 'package:analyzer/source/pub_package_map_provider.dart'; | 18 import 'package:analyzer/source/pub_package_map_provider.dart'; |
| 20 import 'package:analyzer/source/sdk_ext.dart'; | 19 import 'package:analyzer/source/sdk_ext.dart'; |
| 21 import 'package:analyzer/src/context/builder.dart'; | 20 import 'package:analyzer/src/context/builder.dart'; |
| 22 import 'package:analyzer/src/dart/analysis/byte_store.dart'; | 21 import 'package:analyzer/src/dart/analysis/byte_store.dart'; |
| 23 import 'package:analyzer/src/dart/analysis/driver.dart'; | 22 import 'package:analyzer/src/dart/analysis/driver.dart'; |
| 24 import 'package:analyzer/src/dart/analysis/file_state.dart'; | 23 import 'package:analyzer/src/dart/analysis/file_state.dart'; |
| 25 import 'package:analyzer/src/dart/sdk/sdk.dart'; | 24 import 'package:analyzer/src/dart/sdk/sdk.dart'; |
| 26 import 'package:analyzer/src/generated/constant.dart'; | 25 import 'package:analyzer/src/generated/constant.dart'; |
| 27 import 'package:analyzer/src/generated/engine.dart'; | 26 import 'package:analyzer/src/generated/engine.dart'; |
| 28 import 'package:analyzer/src/generated/interner.dart'; | 27 import 'package:analyzer/src/generated/interner.dart'; |
| 29 import 'package:analyzer/src/generated/java_engine.dart'; | 28 import 'package:analyzer/src/generated/java_engine.dart'; |
| 30 import 'package:analyzer/src/generated/sdk.dart'; | 29 import 'package:analyzer/src/generated/sdk.dart'; |
| 31 import 'package:analyzer/src/generated/source.dart'; | 30 import 'package:analyzer/src/generated/source.dart'; |
| 32 import 'package:analyzer/src/generated/source_io.dart'; | 31 import 'package:analyzer/src/generated/source_io.dart'; |
| 33 import 'package:analyzer/src/generated/utilities_general.dart' | 32 import 'package:analyzer/src/generated/utilities_general.dart' |
| 34 show PerformanceTag; | 33 show PerformanceTag; |
| 35 import 'package:analyzer/src/lint/registry.dart'; | |
| 36 import 'package:analyzer/src/source/source_resource.dart'; | 34 import 'package:analyzer/src/source/source_resource.dart'; |
| 37 import 'package:analyzer/src/summary/idl.dart'; | 35 import 'package:analyzer/src/summary/idl.dart'; |
| 38 import 'package:analyzer/src/summary/package_bundle_reader.dart'; | 36 import 'package:analyzer/src/summary/package_bundle_reader.dart'; |
| 39 import 'package:analyzer/src/summary/summary_sdk.dart' show SummaryBasedDartSdk; | 37 import 'package:analyzer/src/summary/summary_sdk.dart' show SummaryBasedDartSdk; |
| 40 import 'package:analyzer/src/task/options.dart'; | |
| 41 import 'package:analyzer_cli/src/analyzer_impl.dart'; | 38 import 'package:analyzer_cli/src/analyzer_impl.dart'; |
| 42 import 'package:analyzer_cli/src/build_mode.dart'; | 39 import 'package:analyzer_cli/src/build_mode.dart'; |
| 43 import 'package:analyzer_cli/src/error_formatter.dart'; | 40 import 'package:analyzer_cli/src/error_formatter.dart'; |
| 44 import 'package:analyzer_cli/src/options.dart'; | 41 import 'package:analyzer_cli/src/options.dart'; |
| 45 import 'package:analyzer_cli/src/perf_report.dart'; | 42 import 'package:analyzer_cli/src/perf_report.dart'; |
| 46 import 'package:analyzer_cli/starter.dart' show CommandLineStarter; | 43 import 'package:analyzer_cli/starter.dart' show CommandLineStarter; |
| 47 import 'package:linter/src/rules.dart' as linter; | 44 import 'package:linter/src/rules.dart' as linter; |
| 48 import 'package:package_config/discovery.dart' as pkg_discovery; | 45 import 'package:package_config/discovery.dart' as pkg_discovery; |
| 49 import 'package:package_config/packages.dart' show Packages; | 46 import 'package:package_config/packages.dart' show Packages; |
| 50 import 'package:package_config/packages_file.dart' as pkgfile show parse; | 47 import 'package:package_config/packages_file.dart' as pkgfile show parse; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 218 } | 215 } |
| 219 | 216 |
| 220 for (io.File file in files) { | 217 for (io.File file in files) { |
| 221 Source source = _computeLibrarySource(file.absolute.path); | 218 Source source = _computeLibrarySource(file.absolute.path); |
| 222 if (!knownSources.contains(source)) { | 219 if (!knownSources.contains(source)) { |
| 223 changeSet.addedSource(source); | 220 changeSet.addedSource(source); |
| 224 } | 221 } |
| 225 sourcesToAnalyze.add(source); | 222 sourcesToAnalyze.add(source); |
| 226 } | 223 } |
| 227 | 224 |
| 228 if (analysisDriver != null) { | 225 if (analysisDriver != null) {} else { |
|
Brian Wilkerson
2017/02/23 22:18:09
Reverse the condition and remove the "{} else"?
| |
| 229 files.forEach((file) { | |
| 230 analysisDriver.addFile(file.path); | |
| 231 }); | |
| 232 } else { | |
| 233 context.applyChanges(changeSet); | 226 context.applyChanges(changeSet); |
| 234 } | 227 } |
| 235 } | 228 } |
| 236 | 229 |
| 237 // Analyze the libraries. | 230 // Analyze the libraries. |
| 238 ErrorSeverity allResult = ErrorSeverity.NONE; | 231 ErrorSeverity allResult = ErrorSeverity.NONE; |
| 239 List<Uri> libUris = <Uri>[]; | 232 List<Uri> libUris = <Uri>[]; |
| 240 Set<Source> partSources = new Set<Source>(); | 233 Set<Source> partSources = new Set<Source>(); |
| 241 | 234 |
| 242 for (Source source in sourcesToAnalyze) { | 235 for (Source source in sourcesToAnalyze) { |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 906 for (var package in packages) { | 899 for (var package in packages) { |
| 907 var packageName = path.basename(package.path); | 900 var packageName = path.basename(package.path); |
| 908 var realPath = package.resolveSymbolicLinksSync(); | 901 var realPath = package.resolveSymbolicLinksSync(); |
| 909 result[packageName] = [ | 902 result[packageName] = [ |
| 910 PhysicalResourceProvider.INSTANCE.getFolder(realPath) | 903 PhysicalResourceProvider.INSTANCE.getFolder(realPath) |
| 911 ]; | 904 ]; |
| 912 } | 905 } |
| 913 return result; | 906 return result; |
| 914 } | 907 } |
| 915 } | 908 } |
| OLD | NEW |