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

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

Issue 2107793002: Generalize DartSdkManager to support embedder SDKs (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 months 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 | « pkg/analysis_server/lib/src/analysis_server.dart ('k') | pkg/analysis_server/lib/src/server/driver.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 785ccfea2fc3924a21fbc647c9c5a83e28734fdc..585da4628b77350130670db2dd01b158c96cf6a5 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -1157,15 +1157,29 @@ class ContextManagerImpl implements ContextManager {
EmbedderYamlLocator locator =
disposition.getEmbedderLocator(resourceProvider);
- EmbedderSdk sdk = new EmbedderSdk(locator.embedderYamls);
- if (sdk.libraryMap.size() == 0) {
- // The embedder uri resolver has no mappings. Use the default Dart SDK
- // uri resolver.
+ Map<Folder, YamlMap> embedderYamls = locator.embedderYamls;
+ EmbedderSdk embedderSdk = new EmbedderSdk(embedderYamls);
+ if (embedderSdk.libraryMap.size() == 0) {
+ // There was no embedder file, or the file was empty, so used the default
+ // SDK.
resolvers.add(new DartUriResolver(sdkManager.getSdkForOptions(options)));
} else {
- // The embedder uri resolver has mappings, use it instead of the default
- // Dart SDK uri resolver.
- resolvers.add(new DartUriResolver(sdk));
+ // The embedder file defines an alternate SDK, so use it.
+ List<String> paths = <String>[];
+ for (Folder folder in embedderYamls.keys) {
+ paths.add(folder
+ .getChildAssumingFile(EmbedderYamlLocator.EMBEDDER_FILE_NAME)
+ .path);
+ }
+ DartSdk dartSdk =
+ sdkManager.getSdk(new SdkDescription(paths, options), () {
+ embedderSdk.analysisOptions = options;
+ // TODO(brianwilkerson) Enable summary use after we have decided where
+ // summary files for embedder files will live.
+ embedderSdk.useSummary = false;
+ return embedderSdk;
+ });
+ resolvers.add(new DartUriResolver(dartSdk));
}
resolvers.addAll(packageUriResolvers);
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_server.dart ('k') | pkg/analysis_server/lib/src/server/driver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698