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

Unified Diff: pkg/analysis_server/lib/src/server/driver.dart

Issue 1686613002: Use different SDKs based on option settings (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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
Index: pkg/analysis_server/lib/src/server/driver.dart
diff --git a/pkg/analysis_server/lib/src/server/driver.dart b/pkg/analysis_server/lib/src/server/driver.dart
index 2cdb25194d5e61fcace13cdbf960193ab242c6fc..4f9e4720a8bf01dff66709b77bcd9ea160471179 100644
--- a/pkg/analysis_server/lib/src/server/driver.dart
+++ b/pkg/analysis_server/lib/src/server/driver.dart
@@ -375,14 +375,20 @@ class Driver implements ServerStarter {
_initIncrementalLogger(results[INCREMENTAL_RESOLUTION_LOG]);
- DartSdk defaultSdk;
+ JavaFile defaultSdkDirectory;
if (results[SDK_OPTION] != null) {
- defaultSdk = new DirectoryBasedDartSdk(new JavaFile(results[SDK_OPTION]));
+ defaultSdkDirectory = new JavaFile(results[SDK_OPTION]);
} else {
- // No path to the SDK provided; use DirectoryBasedDartSdk.defaultSdk,
- // which will make a guess.
- defaultSdk = DirectoryBasedDartSdk.defaultSdk;
+ // No path to the SDK was provided.
+ // Use DirectoryBasedDartSdk.defaultSdkDirectory, which will make a guess.
+ defaultSdkDirectory = DirectoryBasedDartSdk.defaultSdkDirectory;
}
+ SdkCreator defaultSdkCreator =
+ () => new DirectoryBasedDartSdk(defaultSdkDirectory);
+ // TODO(brianwilkerson) It would be nice to avoid creating an SDK that
+ // cannot be re-used, but the SDK is needed to create a package map provider
+ // in the case where we need to run `pub` in order to get the package map.
+ DirectoryBasedDartSdk defaultSdk = defaultSdkCreator();
//
// Initialize the instrumentation service.
//
@@ -420,8 +426,14 @@ class Driver implements ServerStarter {
//
// Create the sockets and start listening for requests.
//
- socketServer = new SocketServer(analysisServerOptions, defaultSdk, service,
- serverPlugin, packageResolverProvider, embeddedUriResolverProvider);
+ socketServer = new SocketServer(
+ analysisServerOptions,
+ defaultSdkCreator,
+ defaultSdk,
+ service,
+ serverPlugin,
+ packageResolverProvider,
+ embeddedUriResolverProvider);
httpServer = new HttpAnalysisServer(socketServer);
stdioServer = new StdioAnalysisServer(socketServer);
socketServer.userDefinedPlugins = _userDefinedPlugins;

Powered by Google App Engine
This is Rietveld 408576698