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 |
(...skipping 24 matching lines...) Expand all Loading... |
35 import 'package:analyzer/src/summary/package_bundle_reader.dart'; | 35 import 'package:analyzer/src/summary/package_bundle_reader.dart'; |
36 import 'package:analyzer/src/summary/summary_sdk.dart' show SummaryBasedDartSdk; | 36 import 'package:analyzer/src/summary/summary_sdk.dart' show SummaryBasedDartSdk; |
37 import 'package:analyzer/src/task/options.dart'; | 37 import 'package:analyzer/src/task/options.dart'; |
38 import 'package:analyzer_cli/src/analyzer_impl.dart'; | 38 import 'package:analyzer_cli/src/analyzer_impl.dart'; |
39 import 'package:analyzer_cli/src/build_mode.dart'; | 39 import 'package:analyzer_cli/src/build_mode.dart'; |
40 import 'package:analyzer_cli/src/error_formatter.dart'; | 40 import 'package:analyzer_cli/src/error_formatter.dart'; |
41 import 'package:analyzer_cli/src/options.dart'; | 41 import 'package:analyzer_cli/src/options.dart'; |
42 import 'package:analyzer_cli/src/perf_report.dart'; | 42 import 'package:analyzer_cli/src/perf_report.dart'; |
43 import 'package:analyzer_cli/starter.dart'; | 43 import 'package:analyzer_cli/starter.dart'; |
44 import 'package:linter/src/plugin/linter_plugin.dart'; | 44 import 'package:linter/src/plugin/linter_plugin.dart'; |
45 import 'package:linter/src/rules.dart' as linter; | |
46 import 'package:package_config/discovery.dart' as pkg_discovery; | 45 import 'package:package_config/discovery.dart' as pkg_discovery; |
47 import 'package:package_config/packages.dart' show Packages; | 46 import 'package:package_config/packages.dart' show Packages; |
48 import 'package:package_config/packages_file.dart' as pkgfile show parse; | 47 import 'package:package_config/packages_file.dart' as pkgfile show parse; |
49 import 'package:package_config/src/packages_impl.dart' show MapPackages; | 48 import 'package:package_config/src/packages_impl.dart' show MapPackages; |
50 import 'package:path/path.dart' as path; | 49 import 'package:path/path.dart' as path; |
51 import 'package:plugin/manager.dart'; | 50 import 'package:plugin/manager.dart'; |
52 import 'package:plugin/plugin.dart'; | 51 import 'package:plugin/plugin.dart'; |
53 import 'package:yaml/yaml.dart'; | 52 import 'package:yaml/yaml.dart'; |
54 | 53 |
55 /// Shared IO sink for standard error reporting. | 54 /// Shared IO sink for standard error reporting. |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 void _processPlugins() { | 616 void _processPlugins() { |
618 List<Plugin> plugins = <Plugin>[]; | 617 List<Plugin> plugins = <Plugin>[]; |
619 plugins.addAll(AnalysisEngine.instance.requiredPlugins); | 618 plugins.addAll(AnalysisEngine.instance.requiredPlugins); |
620 plugins.add(AnalysisEngine.instance.commandLinePlugin); | 619 plugins.add(AnalysisEngine.instance.commandLinePlugin); |
621 plugins.add(AnalysisEngine.instance.optionsPlugin); | 620 plugins.add(AnalysisEngine.instance.optionsPlugin); |
622 plugins.add(linterPlugin); | 621 plugins.add(linterPlugin); |
623 plugins.addAll(_userDefinedPlugins); | 622 plugins.addAll(_userDefinedPlugins); |
624 | 623 |
625 ExtensionManager manager = new ExtensionManager(); | 624 ExtensionManager manager = new ExtensionManager(); |
626 manager.processPlugins(plugins); | 625 manager.processPlugins(plugins); |
627 | |
628 linter.registerLintRules(); | |
629 } | 626 } |
630 | 627 |
631 /// Analyze a single source. | 628 /// Analyze a single source. |
632 ErrorSeverity _runAnalyzer(Source source, CommandLineOptions options) { | 629 ErrorSeverity _runAnalyzer(Source source, CommandLineOptions options) { |
633 int startTime = currentTimeMillis(); | 630 int startTime = currentTimeMillis(); |
634 AnalyzerImpl analyzer = | 631 AnalyzerImpl analyzer = |
635 new AnalyzerImpl(_context, source, options, stats, startTime); | 632 new AnalyzerImpl(_context, source, options, stats, startTime); |
636 var errorSeverity = analyzer.analyzeSync(); | 633 var errorSeverity = analyzer.analyzeSync(); |
637 if (errorSeverity == ErrorSeverity.ERROR) { | 634 if (errorSeverity == ErrorSeverity.ERROR) { |
638 io.exitCode = errorSeverity.ordinal; | 635 io.exitCode = errorSeverity.ordinal; |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 for (var package in packages) { | 878 for (var package in packages) { |
882 var packageName = path.basename(package.path); | 879 var packageName = path.basename(package.path); |
883 var realPath = package.resolveSymbolicLinksSync(); | 880 var realPath = package.resolveSymbolicLinksSync(); |
884 result[packageName] = [ | 881 result[packageName] = [ |
885 PhysicalResourceProvider.INSTANCE.getFolder(realPath) | 882 PhysicalResourceProvider.INSTANCE.getFolder(realPath) |
886 ]; | 883 ]; |
887 } | 884 } |
888 return result; | 885 return result; |
889 } | 886 } |
890 } | 887 } |
OLD | NEW |