Index: pkg/analyzer/lib/source/analysis_options_provider.dart |
diff --git a/pkg/analyzer/lib/source/analysis_options_provider.dart b/pkg/analyzer/lib/source/analysis_options_provider.dart |
index 808c8353301b80cd4f71b208f34dd16ef53fc598..90cf8a123bb284ed942cd722844ce81f153db382 100644 |
--- a/pkg/analyzer/lib/source/analysis_options_provider.dart |
+++ b/pkg/analyzer/lib/source/analysis_options_provider.dart |
@@ -10,6 +10,7 @@ import 'package:analyzer/file_system/file_system.dart'; |
import 'package:analyzer/src/generated/engine.dart'; |
import 'package:analyzer/src/generated/source.dart'; |
import 'package:analyzer/src/source/source_resource.dart'; |
+import 'package:analyzer/src/task/options.dart'; |
import 'package:analyzer/src/util/yaml.dart'; |
import 'package:source_span/source_span.dart'; |
import 'package:yaml/yaml.dart'; |
@@ -25,6 +26,8 @@ class AnalysisOptionsProvider { |
/// Provide the options found in either |
/// [root]/[AnalysisEngine.ANALYSIS_OPTIONS_FILE] or |
/// [root]/[AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE]. |
+ /// Recursively merge options referenced by an include directive |
+ /// and remove the include directive from the resulting options map. |
/// Return an empty options map if the file does not exist. |
Map<String, YamlNode> getOptions(Folder root, {bool crawlUp: false}) { |
Resource resource; |
@@ -42,17 +45,21 @@ class AnalysisOptionsProvider { |
} |
/// Provide the options found in [file]. |
+ /// Recursively merge options referenced by an include directive |
+ /// and remove the include directive from the resulting options map. |
/// Return an empty options map if the file does not exist. |
Map<String, YamlNode> getOptionsFromFile(File file) { |
return getOptionsFromSource(new FileSource(file)); |
} |
/// Provide the options found in [source]. |
+ /// Recursively merge options referenced by an include directive |
+ /// and remove the include directive from the resulting options map. |
/// Return an empty options map if the file does not exist. |
Map<String, YamlNode> getOptionsFromSource(Source source) { |
Map<String, YamlNode> options = |
getOptionsFromString(_readAnalysisOptions(source)); |
- YamlNode node = options.remove('include'); |
+ YamlNode node = options.remove(AnalyzerOptions.include); |
if (sourceFactory != null && node is YamlScalar) { |
var path = node.value; |
if (path is String) { |
@@ -64,6 +71,8 @@ class AnalysisOptionsProvider { |
} |
/// Provide the options found in [optionsSource]. |
+ /// An include directive, if present, will be left as-is, |
+ /// and the referenced options will NOT be merged into the result. |
/// Return an empty options map if the source is null. |
Map<String, YamlNode> getOptionsFromString(String optionsSource) { |
Map<String, YamlNode> options = <String, YamlNode>{}; |