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); |