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

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

Issue 2514533002: update ContextManager to support analysis option include directive (Closed)
Patch Set: merge 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/analysis_server/test/context_manager_test.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 083874b29b6299b21bb0a127055fa23690171949..147dd0d28b262f6d6a03a8752f800502a2856dc6 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -477,10 +477,6 @@ class ContextManagerImpl implements ContextManager {
*/
final PubPackageMapProvider _packageMapProvider;
- /// Provider of analysis options.
- AnalysisOptionsProvider analysisOptionsProvider =
- new AnalysisOptionsProvider();
-
/**
* A list of the globs used to determine which files should be analyzed.
*/
@@ -685,9 +681,19 @@ class ContextManagerImpl implements ContextManager {
* 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.
*/
- Map<String, Object> readOptions(Folder folder) {
+ Map<String, Object> readOptions(Folder folder, Packages packages) {
try {
- return analysisOptionsProvider.getOptions(folder, crawlUp: true);
+ Map<String, List<Folder>> packageMap =
+ new ContextBuilder(resourceProvider, null, null)
+ .convertPackagesToMap(packages);
+ List<UriResolver> resolvers = <UriResolver>[
+ new ResourceUriResolver(resourceProvider),
+ new PackageMapUriResolver(resourceProvider, packageMap),
+ ];
+ SourceFactory sourceFactory =
+ new SourceFactory(resolvers, packages, resourceProvider);
+ return new AnalysisOptionsProvider(sourceFactory)
+ .getOptions(folder, crawlUp: true);
} catch (_) {
// Parse errors are reported by GenerateOptionsErrorsTask.
}
@@ -916,7 +922,8 @@ class ContextManagerImpl implements ContextManager {
if (AnalysisEngine.isAnalysisOptionsFileName(path, pathContext)) {
var analysisContext = info.context;
if (analysisContext is context.AnalysisContextImpl) {
- Map<String, Object> options = readOptions(info.folder);
+ Map<String, Object> options =
+ readOptions(info.folder, info.disposition.packages);
processOptionsForContext(info, options,
optionsRemoved: changeType == ChangeType.REMOVE);
analysisContext.sourceFactory = _createSourceFactory(
@@ -1069,7 +1076,8 @@ class ContextManagerImpl implements ContextManager {
ContextInfo info = new ContextInfo(this, parent, folder, packagespecFile,
normalizedPackageRoots[folder.path], disposition);
- Map<String, Object> optionMap = readOptions(info.folder);
+ Map<String, Object> optionMap =
+ readOptions(info.folder, disposition.packages);
AnalysisOptions options =
new AnalysisOptionsImpl.from(defaultContextOptions);
applyToAnalysisOptions(options, optionMap);
« no previous file with comments | « no previous file | pkg/analysis_server/test/context_manager_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698