Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1414)

Unified Diff: pkg/analysis_server/lib/src/context_manager.dart

Issue 2536303002: Exclude files from analysis when using AnalysisDriver (Closed)
Patch Set: clean-up Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/context_manager.dart
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index 47293f77fc3495ed38ceb73bf80087051a42f55d..19737b8cabaac87494304f16e50c82438035c5a3 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -676,6 +676,65 @@ class ContextManagerImpl implements ContextManager {
}
/**
+ * Process [options] for the given context [info].
+ */
+ void processOptionsForDriver(ContextInfo info, Map<String, Object> options,
+ {bool optionsRemoved: false}) {
+ if (options == null && !optionsRemoved) {
+ return;
+ }
+ AnalysisOptions analysisOptions = info.analysisDriver.analysisOptions;
+
+ // In case options files are removed, revert to defaults.
+ if (optionsRemoved) {
+ // Start with defaults.
+ analysisOptions.resetToDefaults();
+
+ // Apply inherited options.
+ options = _toStringMap(_getEmbeddedOptions(info));
+ if (options != null) {
+ applyToAnalysisOptions(analysisOptions, options);
+ }
+ } else {
+ // Check for embedded options.
+ Map embeddedOptions = _getEmbeddedOptions(info);
+ if (embeddedOptions != null) {
+ options = _toStringMap(new Merger().merge(embeddedOptions, options));
+ }
+ }
+
+ // TODO(brianwilkerson) Figure out what to do here.
+// // Notify options processors.
+// AnalysisEngine.instance.optionsPlugin.optionsProcessors
+// .forEach((OptionsProcessor p) {
+// try {
+// p.optionsProcessed(info.context, options);
+// } catch (e, stacktrace) {
+// AnalysisEngine.instance.logger.logError(
+// 'Error processing analysis options',
+// new CaughtException(e, stacktrace));
+// }
+// });
+
+ applyToAnalysisOptions(analysisOptions, options);
+
+ // Nothing more to do.
+ if (options == null) {
+ return;
+ }
+
+ var analyzer = options[AnalyzerOptions.analyzer];
+ if (analyzer is Map) {
+ // Set ignore patterns.
+ YamlList exclude = analyzer[AnalyzerOptions.exclude];
+ List<String> excludeList = toStringList(exclude);
+ if (excludeList != null) {
+ setIgnorePatternsForContext(info, excludeList);
+ }
+ }
+ }
+
+ /**
* Return the options from the analysis options file in the given [folder]
* if exists, or in one of the parent folders, or `null` if no analysis
* options file is found or if the contents of the file are not valid YAML.
@@ -1105,7 +1164,7 @@ class ContextManagerImpl implements ContextManager {
}
if (enableNewAnalysisDriver) {
- // TODO(scheglov) implement for the new analysis driver
+ processOptionsForDriver(info, optionMap);
} else {
processOptionsForContext(info, optionMap);
}
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698