| 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'; | 9 import 'dart:io'; | 
| 10 | 10 | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
| 28 import 'package:analyzer/src/services/lint.dart'; | 28 import 'package:analyzer/src/services/lint.dart'; | 
| 29 import 'package:analyzer/src/task/options.dart'; | 29 import 'package:analyzer/src/task/options.dart'; | 
| 30 import 'package:analyzer_cli/src/analyzer_impl.dart'; | 30 import 'package:analyzer_cli/src/analyzer_impl.dart'; | 
| 31 import 'package:analyzer_cli/src/options.dart'; | 31 import 'package:analyzer_cli/src/options.dart'; | 
| 32 import 'package:linter/src/plugin/linter_plugin.dart'; | 32 import 'package:linter/src/plugin/linter_plugin.dart'; | 
| 33 import 'package:package_config/discovery.dart' as pkgDiscovery; | 33 import 'package:package_config/discovery.dart' as pkgDiscovery; | 
| 34 import 'package:package_config/packages.dart' show Packages; | 34 import 'package:package_config/packages.dart' show Packages; | 
| 35 import 'package:package_config/packages_file.dart' as pkgfile show parse; | 35 import 'package:package_config/packages_file.dart' as pkgfile show parse; | 
| 36 import 'package:package_config/src/packages_impl.dart' show MapPackages; | 36 import 'package:package_config/src/packages_impl.dart' show MapPackages; | 
| 37 import 'package:path/path.dart' as path; | 37 import 'package:path/path.dart' as path; | 
|  | 38 import 'package:plugin/manager.dart'; | 
| 38 import 'package:plugin/plugin.dart'; | 39 import 'package:plugin/plugin.dart'; | 
| 39 import 'package:yaml/yaml.dart'; | 40 import 'package:yaml/yaml.dart'; | 
| 40 | 41 | 
| 41 /// The maximum number of sources for which AST structures should be kept in the | 42 /// The maximum number of sources for which AST structures should be kept in the | 
| 42 /// cache. | 43 /// cache. | 
| 43 const int _maxCacheSize = 512; | 44 const int _maxCacheSize = 512; | 
| 44 | 45 | 
| 45 /// Shared IO sink for standard error reporting. | 46 /// Shared IO sink for standard error reporting. | 
| 46 /// | 47 /// | 
| 47 /// *Visible for testing.* | 48 /// *Visible for testing.* | 
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 493       if (optionMap != null) { | 494       if (optionMap != null) { | 
| 494         configureContextOptions(context, optionMap); | 495         configureContextOptions(context, optionMap); | 
| 495       } | 496       } | 
| 496     } on Exception catch (e) { | 497     } on Exception catch (e) { | 
| 497       optionsProcessors.forEach((OptionsProcessor p) => p.onError(e)); | 498       optionsProcessors.forEach((OptionsProcessor p) => p.onError(e)); | 
| 498     } | 499     } | 
| 499   } | 500   } | 
| 500 | 501 | 
| 501   void _processPlugins() { | 502   void _processPlugins() { | 
| 502     List<Plugin> plugins = <Plugin>[]; | 503     List<Plugin> plugins = <Plugin>[]; | 
|  | 504     plugins.addAll(AnalysisEngine.instance.requiredPlugins); | 
|  | 505     plugins.add(AnalysisEngine.instance.commandLinePlugin); | 
|  | 506     plugins.add(AnalysisEngine.instance.optionsPlugin); | 
| 503     plugins.add(linterPlugin); | 507     plugins.add(linterPlugin); | 
| 504     plugins.addAll(_userDefinedPlugins); | 508     plugins.addAll(_userDefinedPlugins); | 
| 505     AnalysisEngine.instance.userDefinedPlugins = plugins; |  | 
| 506 | 509 | 
| 507     // This ensures that AE extension manager processes plugins. | 510     ExtensionManager manager = new ExtensionManager(); | 
| 508     AnalysisEngine.instance.taskManager; | 511     manager.processPlugins(plugins); | 
| 509   } | 512   } | 
| 510 | 513 | 
| 511   /// Analyze a single source. | 514   /// Analyze a single source. | 
| 512   ErrorSeverity _runAnalyzer(Source source, CommandLineOptions options) { | 515   ErrorSeverity _runAnalyzer(Source source, CommandLineOptions options) { | 
| 513     int startTime = currentTimeMillis(); | 516     int startTime = currentTimeMillis(); | 
| 514     AnalyzerImpl analyzer = | 517     AnalyzerImpl analyzer = | 
| 515         new AnalyzerImpl(_context, source, options, startTime); | 518         new AnalyzerImpl(_context, source, options, startTime); | 
| 516     var errorSeverity = analyzer.analyzeSync(); | 519     var errorSeverity = analyzer.analyzeSync(); | 
| 517     if (errorSeverity == ErrorSeverity.ERROR) { | 520     if (errorSeverity == ErrorSeverity.ERROR) { | 
| 518       exitCode = errorSeverity.ordinal; | 521       exitCode = errorSeverity.ordinal; | 
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 632     for (var package in packages) { | 635     for (var package in packages) { | 
| 633       var packageName = path.basename(package.path); | 636       var packageName = path.basename(package.path); | 
| 634       var realPath = package.resolveSymbolicLinksSync(); | 637       var realPath = package.resolveSymbolicLinksSync(); | 
| 635       result[packageName] = [ | 638       result[packageName] = [ | 
| 636         PhysicalResourceProvider.INSTANCE.getFolder(realPath) | 639         PhysicalResourceProvider.INSTANCE.getFolder(realPath) | 
| 637       ]; | 640       ]; | 
| 638     } | 641     } | 
| 639     return result; | 642     return result; | 
| 640   } | 643   } | 
| 641 } | 644 } | 
| OLD | NEW | 
|---|