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

Side by Side Diff: pkg/analysis_server/lib/src/analysis_server.dart

Issue 394923004: As a temporary measure, allow SDK to be specified on analysis server cmd line. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analysis.server; 5 library analysis.server;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analyzer/file_system/file_system.dart'; 10 import 'package:analyzer/file_system/file_system.dart';
11 import 'package:analysis_server/src/analysis_logger.dart'; 11 import 'package:analysis_server/src/analysis_logger.dart';
12 import 'package:analysis_server/src/channel.dart'; 12 import 'package:analysis_server/src/channel.dart';
13 import 'package:analysis_server/src/constants.dart'; 13 import 'package:analysis_server/src/constants.dart';
14 import 'package:analysis_server/src/context_directory_manager.dart'; 14 import 'package:analysis_server/src/context_directory_manager.dart';
15 import 'package:analysis_server/src/domain_analysis.dart'; 15 import 'package:analysis_server/src/domain_analysis.dart';
16 import 'package:analysis_server/src/operation/operation_analysis.dart'; 16 import 'package:analysis_server/src/operation/operation_analysis.dart';
17 import 'package:analysis_server/src/operation/operation.dart'; 17 import 'package:analysis_server/src/operation/operation.dart';
18 import 'package:analysis_server/src/operation/operation_queue.dart'; 18 import 'package:analysis_server/src/operation/operation_queue.dart';
19 import 'package:analysis_server/src/package_map_provider.dart'; 19 import 'package:analysis_server/src/package_map_provider.dart';
20 import 'package:analysis_server/src/package_uri_resolver.dart'; 20 import 'package:analysis_server/src/package_uri_resolver.dart';
21 import 'package:analysis_server/src/protocol.dart'; 21 import 'package:analysis_server/src/protocol.dart';
22 import 'package:analyzer/src/generated/ast.dart'; 22 import 'package:analyzer/src/generated/ast.dart';
23 import 'package:analyzer/src/generated/engine.dart'; 23 import 'package:analyzer/src/generated/engine.dart';
24 import 'package:analyzer/src/generated/error.dart'; 24 import 'package:analyzer/src/generated/error.dart';
25 import 'package:analyzer/src/generated/source.dart'; 25 import 'package:analyzer/src/generated/source.dart';
26 import 'package:analyzer/src/generated/sdk.dart'; 26 import 'package:analyzer/src/generated/sdk.dart';
27 import 'package:analyzer/src/generated/sdk_io.dart';
28 import 'package:analyzer/src/generated/source_io.dart'; 27 import 'package:analyzer/src/generated/source_io.dart';
29 import 'package:analyzer/src/generated/java_engine.dart'; 28 import 'package:analyzer/src/generated/java_engine.dart';
30 import 'package:analysis_services/index/index.dart'; 29 import 'package:analysis_services/index/index.dart';
31 import 'package:analysis_services/search/search_engine.dart'; 30 import 'package:analysis_services/search/search_engine.dart';
32 import 'package:analyzer/src/generated/element.dart'; 31 import 'package:analyzer/src/generated/element.dart';
33 32
34 33
35 /**
36 * An instance of [DirectoryBasedDartSdk] that is shared between
37 * [AnalysisServer] instances to improve performance.
38 */
39 final DirectoryBasedDartSdk SHARED_SDK = DirectoryBasedDartSdk.defaultSdk;
40
41 class AnalysisServerContextDirectoryManager extends ContextDirectoryManager { 34 class AnalysisServerContextDirectoryManager extends ContextDirectoryManager {
42 final AnalysisServer analysisServer; 35 final AnalysisServer analysisServer;
43 36
44 /** 37 /**
45 * The default options used to create new analysis contexts. 38 * The default options used to create new analysis contexts.
46 */ 39 */
47 AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl(); 40 AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl();
48 41
49 AnalysisServerContextDirectoryManager( 42 AnalysisServerContextDirectoryManager(
50 this.analysisServer, ResourceProvider resourceProvider, 43 this.analysisServer, ResourceProvider resourceProvider,
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 129
137 /** 130 /**
138 * A list of the request handlers used to handle the requests sent to this 131 * A list of the request handlers used to handle the requests sent to this
139 * server. 132 * server.
140 */ 133 */
141 List<RequestHandler> handlers; 134 List<RequestHandler> handlers;
142 135
143 /** 136 /**
144 * The current default [DartSdk]. 137 * The current default [DartSdk].
145 */ 138 */
146 DartSdk defaultSdk = SHARED_SDK; 139 final DartSdk defaultSdk;
147 140
148 /** 141 /**
149 * A table mapping [Folder]s to the [AnalysisContext]s associated with them. 142 * A table mapping [Folder]s to the [AnalysisContext]s associated with them.
150 */ 143 */
151 final Map<Folder, AnalysisContext> folderMap = 144 final Map<Folder, AnalysisContext> folderMap =
152 new HashMap<Folder, AnalysisContext>(); 145 new HashMap<Folder, AnalysisContext>();
153 146
154 /** 147 /**
155 * A queue of the operations to perform in this server. 148 * A queue of the operations to perform in this server.
156 * 149 *
(...skipping 24 matching lines...) Expand all
181 /** 174 /**
182 * Initialize a newly created server to receive requests from and send 175 * Initialize a newly created server to receive requests from and send
183 * responses to the given [channel]. 176 * responses to the given [channel].
184 * 177 *
185 * If [rethrowExceptions] is true, then any exceptions thrown by analysis are 178 * If [rethrowExceptions] is true, then any exceptions thrown by analysis are
186 * propagated up the call stack. The default is true to allow analysis 179 * propagated up the call stack. The default is true to allow analysis
187 * exceptions to show up in unit tests, but it should be set to false when 180 * exceptions to show up in unit tests, but it should be set to false when
188 * running a full analysis server. 181 * running a full analysis server.
189 */ 182 */
190 AnalysisServer(this.channel, ResourceProvider resourceProvider, 183 AnalysisServer(this.channel, ResourceProvider resourceProvider,
191 PackageMapProvider packageMapProvider, this.index, 184 PackageMapProvider packageMapProvider, this.index, this.defaultSdk,
192 {this.rethrowExceptions: true}) { 185 {this.rethrowExceptions: true}) {
193 searchEngine = createSearchEngine(index); 186 searchEngine = createSearchEngine(index);
194 operationQueue = new ServerOperationQueue(this); 187 operationQueue = new ServerOperationQueue(this);
195 contextDirectoryManager = new AnalysisServerContextDirectoryManager( 188 contextDirectoryManager = new AnalysisServerContextDirectoryManager(
196 this, resourceProvider, packageMapProvider); 189 this, resourceProvider, packageMapProvider);
197 AnalysisEngine.instance.logger = new AnalysisLogger(); 190 AnalysisEngine.instance.logger = new AnalysisLogger();
198 running = true; 191 running = true;
199 Notification notification = new Notification(SERVER_CONNECTED); 192 Notification notification = new Notification(SERVER_CONNECTED);
200 channel.sendNotification(notification); 193 channel.sendNotification(notification);
201 channel.listen(handleRequest, onDone: done, onError: error); 194 channel.listen(handleRequest, onDone: done, onError: error);
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 /** 657 /**
665 * An enumeration of the services provided by the server domain. 658 * An enumeration of the services provided by the server domain.
666 */ 659 */
667 class ServerService extends Enum2<ServerService> { 660 class ServerService extends Enum2<ServerService> {
668 static const ServerService STATUS = const ServerService('STATUS', 0); 661 static const ServerService STATUS = const ServerService('STATUS', 0);
669 662
670 static const List<ServerService> VALUES = const [STATUS]; 663 static const List<ServerService> VALUES = const [STATUS];
671 664
672 const ServerService(String name, int ordinal) : super(name, ordinal); 665 const ServerService(String name, int ordinal) : super(name, ordinal);
673 } 666 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/driver.dart ('k') | pkg/analysis_server/lib/src/package_map_provider.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698