| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 context.directory.manager; | 5 library context.directory.manager; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:convert'; | 9 import 'dart:convert'; |
| 10 import 'dart:core'; | 10 import 'dart:core'; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 import 'package:analyzer/src/dart/sdk/sdk.dart'; | 27 import 'package:analyzer/src/dart/sdk/sdk.dart'; |
| 28 import 'package:analyzer/src/generated/engine.dart'; | 28 import 'package:analyzer/src/generated/engine.dart'; |
| 29 import 'package:analyzer/src/generated/java_io.dart'; | 29 import 'package:analyzer/src/generated/java_io.dart'; |
| 30 import 'package:analyzer/src/generated/sdk.dart'; | 30 import 'package:analyzer/src/generated/sdk.dart'; |
| 31 import 'package:analyzer/src/generated/source.dart'; | 31 import 'package:analyzer/src/generated/source.dart'; |
| 32 import 'package:analyzer/src/generated/source_io.dart'; | 32 import 'package:analyzer/src/generated/source_io.dart'; |
| 33 import 'package:analyzer/src/task/options.dart'; | 33 import 'package:analyzer/src/task/options.dart'; |
| 34 import 'package:analyzer/src/util/absolute_path.dart'; | 34 import 'package:analyzer/src/util/absolute_path.dart'; |
| 35 import 'package:analyzer/src/util/glob.dart'; | 35 import 'package:analyzer/src/util/glob.dart'; |
| 36 import 'package:analyzer/src/util/yaml.dart'; | 36 import 'package:analyzer/src/util/yaml.dart'; |
| 37 import 'package:linter/src/config.dart'; |
| 38 import 'package:linter/src/linter.dart'; |
| 39 import 'package:linter/src/rules.dart'; |
| 37 import 'package:package_config/packages.dart'; | 40 import 'package:package_config/packages.dart'; |
| 38 import 'package:package_config/packages_file.dart' as pkgfile show parse; | 41 import 'package:package_config/packages_file.dart' as pkgfile show parse; |
| 39 import 'package:package_config/src/packages_impl.dart' show MapPackages; | 42 import 'package:package_config/src/packages_impl.dart' show MapPackages; |
| 40 import 'package:path/path.dart' as pathos; | 43 import 'package:path/path.dart' as pathos; |
| 41 import 'package:watcher/watcher.dart'; | 44 import 'package:watcher/watcher.dart'; |
| 42 import 'package:yaml/yaml.dart'; | 45 import 'package:yaml/yaml.dart'; |
| 43 | 46 |
| 44 /** | 47 /** |
| 45 * Information tracked by the [ContextManager] for each context. | 48 * Information tracked by the [ContextManager] for each context. |
| 46 */ | 49 */ |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 } | 679 } |
| 677 | 680 |
| 678 /** | 681 /** |
| 679 * Process [options] for the given context [info]. | 682 * Process [options] for the given context [info]. |
| 680 */ | 683 */ |
| 681 void processOptionsForDriver(ContextInfo info, Map<String, Object> options, | 684 void processOptionsForDriver(ContextInfo info, Map<String, Object> options, |
| 682 {bool optionsRemoved: false}) { | 685 {bool optionsRemoved: false}) { |
| 683 if (options == null && !optionsRemoved) { | 686 if (options == null && !optionsRemoved) { |
| 684 return; | 687 return; |
| 685 } | 688 } |
| 686 AnalysisOptions analysisOptions = info.analysisDriver.analysisOptions; | 689 AnalysisOptionsImpl analysisOptions = info.analysisDriver.analysisOptions; |
| 687 | 690 |
| 688 // In case options files are removed, revert to defaults. | 691 // In case options files are removed, revert to defaults. |
| 689 if (optionsRemoved) { | 692 if (optionsRemoved) { |
| 690 // Start with defaults. | 693 // Start with defaults. |
| 691 analysisOptions.resetToDefaults(); | 694 analysisOptions.resetToDefaults(); |
| 692 | 695 |
| 693 // Apply inherited options. | 696 // Apply inherited options. |
| 694 options = _toStringMap(_getEmbeddedOptions(info)); | 697 options = _toStringMap(_getEmbeddedOptions(info)); |
| 695 if (options != null) { | 698 if (options != null) { |
| 696 applyToAnalysisOptions(analysisOptions, options); | 699 applyToAnalysisOptions(analysisOptions, options); |
| 697 } | 700 } |
| 698 } else { | 701 } else { |
| 699 // Check for embedded options. | 702 // Check for embedded options. |
| 700 Map embeddedOptions = _getEmbeddedOptions(info); | 703 Map embeddedOptions = _getEmbeddedOptions(info); |
| 701 if (embeddedOptions != null) { | 704 if (embeddedOptions != null) { |
| 702 options = _toStringMap(new Merger().merge(embeddedOptions, options)); | 705 options = _toStringMap(new Merger().merge(embeddedOptions, options)); |
| 703 } | 706 } |
| 704 } | 707 } |
| 705 | 708 |
| 706 // TODO(brianwilkerson) Figure out what to do here. | 709 var lintOptions = options['linter']; |
| 707 // // Notify options processors. | 710 if (lintOptions != null) { |
| 708 // AnalysisEngine.instance.optionsPlugin.optionsProcessors | 711 LintConfig config = new LintConfig.parseMap(lintOptions); |
| 709 // .forEach((OptionsProcessor p) { | 712 Iterable<LintRule> lintRules = ruleRegistry.enabled(config); |
| 710 // try { | 713 if (lintRules.isNotEmpty) { |
| 711 // p.optionsProcessed(info.context, options); | 714 analysisOptions.lint = true; |
| 712 // } catch (e, stacktrace) { | 715 analysisOptions.lintRules = lintRules.toList(); |
| 713 // AnalysisEngine.instance.logger.logError( | 716 } |
| 714 // 'Error processing analysis options', | 717 } |
| 715 // new CaughtException(e, stacktrace)); | |
| 716 // } | |
| 717 // }); | |
| 718 | 718 |
| 719 applyToAnalysisOptions(analysisOptions, options); | 719 applyToAnalysisOptions(analysisOptions, options); |
| 720 | 720 |
| 721 // Nothing more to do. | 721 // Nothing more to do. |
| 722 if (options == null) { | 722 if (options == null) { |
| 723 return; | 723 return; |
| 724 } | 724 } |
| 725 | 725 |
| 726 var analyzer = options[AnalyzerOptions.analyzer]; | 726 var analyzer = options[AnalyzerOptions.analyzer]; |
| 727 if (analyzer is Map) { | 727 if (analyzer is Map) { |
| (...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1926 } | 1926 } |
| 1927 return _embedderLocator; | 1927 return _embedderLocator; |
| 1928 } | 1928 } |
| 1929 | 1929 |
| 1930 @override | 1930 @override |
| 1931 SdkExtensionFinder getSdkExtensionFinder(ResourceProvider resourceProvider) { | 1931 SdkExtensionFinder getSdkExtensionFinder(ResourceProvider resourceProvider) { |
| 1932 return _sdkExtensionFinder ??= | 1932 return _sdkExtensionFinder ??= |
| 1933 new SdkExtensionFinder(buildPackageMap(resourceProvider)); | 1933 new SdkExtensionFinder(buildPackageMap(resourceProvider)); |
| 1934 } | 1934 } |
| 1935 } | 1935 } |
| OLD | NEW |