OLD | NEW |
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 driver; | 5 library driver; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 import 'dart:math'; | 9 import 'dart:math'; |
10 | 10 |
11 import 'package:analysis_server/src/analysis_server.dart'; | 11 import 'package:analysis_server/src/analysis_server.dart'; |
12 import 'package:analysis_server/src/plugin/linter_plugin.dart'; | 12 import 'package:analysis_server/src/plugin/linter_plugin.dart'; |
13 import 'package:analysis_server/src/plugin/server_plugin.dart'; | 13 import 'package:analysis_server/src/plugin/server_plugin.dart'; |
14 import 'package:analysis_server/src/provisional/completion/dart/completion_plugi
n.dart'; | 14 import 'package:analysis_server/src/provisional/completion/dart/completion_plugi
n.dart'; |
15 import 'package:analysis_server/src/server/http_server.dart'; | 15 import 'package:analysis_server/src/server/http_server.dart'; |
16 import 'package:analysis_server/src/server/stdio_server.dart'; | 16 import 'package:analysis_server/src/server/stdio_server.dart'; |
17 import 'package:analysis_server/src/socket_server.dart'; | 17 import 'package:analysis_server/src/socket_server.dart'; |
18 import 'package:analysis_server/starter.dart'; | 18 import 'package:analysis_server/starter.dart'; |
19 import 'package:analyzer/file_system/physical_file_system.dart'; | 19 import 'package:analyzer/file_system/physical_file_system.dart'; |
20 import 'package:analyzer/instrumentation/file_instrumentation.dart'; | 20 import 'package:analyzer/instrumentation/file_instrumentation.dart'; |
21 import 'package:analyzer/instrumentation/instrumentation.dart'; | 21 import 'package:analyzer/instrumentation/instrumentation.dart'; |
| 22 import 'package:analyzer/plugin/embedded_resolver_provider.dart'; |
22 import 'package:analyzer/plugin/resolver_provider.dart'; | 23 import 'package:analyzer/plugin/resolver_provider.dart'; |
23 import 'package:analyzer/src/generated/engine.dart'; | 24 import 'package:analyzer/src/generated/engine.dart'; |
24 import 'package:analyzer/src/generated/incremental_logger.dart'; | 25 import 'package:analyzer/src/generated/incremental_logger.dart'; |
25 import 'package:analyzer/src/generated/java_io.dart'; | 26 import 'package:analyzer/src/generated/java_io.dart'; |
26 import 'package:analyzer/src/generated/sdk.dart'; | 27 import 'package:analyzer/src/generated/sdk.dart'; |
27 import 'package:analyzer/src/generated/sdk_io.dart'; | 28 import 'package:analyzer/src/generated/sdk_io.dart'; |
28 import 'package:args/args.dart'; | 29 import 'package:args/args.dart'; |
29 import 'package:linter/src/plugin/linter_plugin.dart'; | 30 import 'package:linter/src/plugin/linter_plugin.dart'; |
30 import 'package:plugin/manager.dart'; | 31 import 'package:plugin/manager.dart'; |
31 import 'package:plugin/plugin.dart'; | 32 import 'package:plugin/plugin.dart'; |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 * operational. | 291 * operational. |
291 */ | 292 */ |
292 static const String SDK_OPTION = "sdk"; | 293 static const String SDK_OPTION = "sdk"; |
293 | 294 |
294 /** | 295 /** |
295 * The instrumentation server that is to be used by the analysis server. | 296 * The instrumentation server that is to be used by the analysis server. |
296 */ | 297 */ |
297 InstrumentationServer instrumentationServer; | 298 InstrumentationServer instrumentationServer; |
298 | 299 |
299 /** | 300 /** |
| 301 * The embedded library URI resolver provider used to override the way |
| 302 * embedded library URI's are resolved in some contexts. |
| 303 */ |
| 304 EmbeddedResolverProvider embeddedUriResolverProvider; |
| 305 |
| 306 /** |
300 * The package resolver provider used to override the way package URI's are | 307 * The package resolver provider used to override the way package URI's are |
301 * resolved in some contexts. | 308 * resolved in some contexts. |
302 */ | 309 */ |
303 ResolverProvider packageResolverProvider; | 310 ResolverProvider packageResolverProvider; |
304 | 311 |
305 /** | 312 /** |
306 * The plugins that are defined outside the analysis_server package. | 313 * The plugins that are defined outside the analysis_server package. |
307 */ | 314 */ |
308 List<Plugin> _userDefinedPlugins = <Plugin>[]; | 315 List<Plugin> _userDefinedPlugins = <Plugin>[]; |
309 | 316 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 plugins.add(linterServerPlugin); | 414 plugins.add(linterServerPlugin); |
408 plugins.add(dartCompletionPlugin); | 415 plugins.add(dartCompletionPlugin); |
409 plugins.addAll(_userDefinedPlugins); | 416 plugins.addAll(_userDefinedPlugins); |
410 | 417 |
411 ExtensionManager manager = new ExtensionManager(); | 418 ExtensionManager manager = new ExtensionManager(); |
412 manager.processPlugins(plugins); | 419 manager.processPlugins(plugins); |
413 // | 420 // |
414 // Create the sockets and start listening for requests. | 421 // Create the sockets and start listening for requests. |
415 // | 422 // |
416 socketServer = new SocketServer(analysisServerOptions, defaultSdk, service, | 423 socketServer = new SocketServer(analysisServerOptions, defaultSdk, service, |
417 serverPlugin, packageResolverProvider); | 424 serverPlugin, packageResolverProvider, embeddedUriResolverProvider); |
418 httpServer = new HttpAnalysisServer(socketServer); | 425 httpServer = new HttpAnalysisServer(socketServer); |
419 stdioServer = new StdioAnalysisServer(socketServer); | 426 stdioServer = new StdioAnalysisServer(socketServer); |
420 socketServer.userDefinedPlugins = _userDefinedPlugins; | 427 socketServer.userDefinedPlugins = _userDefinedPlugins; |
421 | 428 |
422 if (serve_http) { | 429 if (serve_http) { |
423 httpServer.serveHttp(port); | 430 httpServer.serveHttp(port); |
424 } | 431 } |
425 | 432 |
426 _captureExceptions(service, () { | 433 _captureExceptions(service, () { |
427 stdioServer.serveStdio().then((_) async { | 434 stdioServer.serveStdio().then((_) async { |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 */ | 586 */ |
580 static void _rollLogFiles(String path, int numOld) { | 587 static void _rollLogFiles(String path, int numOld) { |
581 for (int i = numOld - 1; i >= 0; i--) { | 588 for (int i = numOld - 1; i >= 0; i--) { |
582 try { | 589 try { |
583 String oldPath = i == 0 ? path : '$path.$i'; | 590 String oldPath = i == 0 ? path : '$path.$i'; |
584 new File(oldPath).renameSync('$path.${i+1}'); | 591 new File(oldPath).renameSync('$path.${i+1}'); |
585 } catch (e) {} | 592 } catch (e) {} |
586 } | 593 } |
587 } | 594 } |
588 } | 595 } |
OLD | NEW |