| 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 |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 analysisServerOptions.enableIncrementalResolutionValidation = | 368 analysisServerOptions.enableIncrementalResolutionValidation = |
| 369 results[INCREMENTAL_RESOLUTION_VALIDATION]; | 369 results[INCREMENTAL_RESOLUTION_VALIDATION]; |
| 370 analysisServerOptions.noErrorNotification = results[NO_ERROR_NOTIFICATION]; | 370 analysisServerOptions.noErrorNotification = results[NO_ERROR_NOTIFICATION]; |
| 371 analysisServerOptions.noIndex = results[NO_INDEX]; | 371 analysisServerOptions.noIndex = results[NO_INDEX]; |
| 372 analysisServerOptions.useAnalysisHighlight2 = | 372 analysisServerOptions.useAnalysisHighlight2 = |
| 373 results[USE_ANALISYS_HIGHLIGHT2]; | 373 results[USE_ANALISYS_HIGHLIGHT2]; |
| 374 analysisServerOptions.fileReadMode = results[FILE_READ_MODE]; | 374 analysisServerOptions.fileReadMode = results[FILE_READ_MODE]; |
| 375 | 375 |
| 376 _initIncrementalLogger(results[INCREMENTAL_RESOLUTION_LOG]); | 376 _initIncrementalLogger(results[INCREMENTAL_RESOLUTION_LOG]); |
| 377 | 377 |
| 378 // |
| 379 // Process all of the plugins so that extensions are registered. |
| 380 // |
| 381 ServerPlugin serverPlugin = new ServerPlugin(); |
| 382 List<Plugin> plugins = <Plugin>[]; |
| 383 plugins.addAll(AnalysisEngine.instance.requiredPlugins); |
| 384 plugins.add(AnalysisEngine.instance.commandLinePlugin); |
| 385 plugins.add(AnalysisEngine.instance.optionsPlugin); |
| 386 plugins.add(serverPlugin); |
| 387 plugins.add(linterPlugin); |
| 388 plugins.add(linterServerPlugin); |
| 389 plugins.add(dartCompletionPlugin); |
| 390 plugins.addAll(_userDefinedPlugins); |
| 391 ExtensionManager manager = new ExtensionManager(); |
| 392 manager.processPlugins(plugins); |
| 393 |
| 378 JavaFile defaultSdkDirectory; | 394 JavaFile defaultSdkDirectory; |
| 379 if (results[SDK_OPTION] != null) { | 395 if (results[SDK_OPTION] != null) { |
| 380 defaultSdkDirectory = new JavaFile(results[SDK_OPTION]); | 396 defaultSdkDirectory = new JavaFile(results[SDK_OPTION]); |
| 381 } else { | 397 } else { |
| 382 // No path to the SDK was provided. | 398 // No path to the SDK was provided. |
| 383 // Use DirectoryBasedDartSdk.defaultSdkDirectory, which will make a guess. | 399 // Use DirectoryBasedDartSdk.defaultSdkDirectory, which will make a guess. |
| 384 defaultSdkDirectory = DirectoryBasedDartSdk.defaultSdkDirectory; | 400 defaultSdkDirectory = DirectoryBasedDartSdk.defaultSdkDirectory; |
| 385 } | 401 } |
| 386 SdkCreator defaultSdkCreator = | 402 SdkCreator defaultSdkCreator = |
| 387 () => new DirectoryBasedDartSdk(defaultSdkDirectory); | 403 () => new DirectoryBasedDartSdk(defaultSdkDirectory); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 401 ? new MulticastInstrumentationServer( | 417 ? new MulticastInstrumentationServer( |
| 402 [instrumentationServer, fileBasedServer]) | 418 [instrumentationServer, fileBasedServer]) |
| 403 : fileBasedServer; | 419 : fileBasedServer; |
| 404 } | 420 } |
| 405 InstrumentationService service = | 421 InstrumentationService service = |
| 406 new InstrumentationService(instrumentationServer); | 422 new InstrumentationService(instrumentationServer); |
| 407 service.logVersion(_readUuid(service), results[CLIENT_ID], | 423 service.logVersion(_readUuid(service), results[CLIENT_ID], |
| 408 results[CLIENT_VERSION], AnalysisServer.VERSION, defaultSdk.sdkVersion); | 424 results[CLIENT_VERSION], AnalysisServer.VERSION, defaultSdk.sdkVersion); |
| 409 AnalysisEngine.instance.instrumentationService = service; | 425 AnalysisEngine.instance.instrumentationService = service; |
| 410 // | 426 // |
| 411 // Process all of the plugins so that extensions are registered. | |
| 412 // | |
| 413 ServerPlugin serverPlugin = new ServerPlugin(); | |
| 414 List<Plugin> plugins = <Plugin>[]; | |
| 415 plugins.addAll(AnalysisEngine.instance.requiredPlugins); | |
| 416 plugins.add(AnalysisEngine.instance.commandLinePlugin); | |
| 417 plugins.add(AnalysisEngine.instance.optionsPlugin); | |
| 418 plugins.add(serverPlugin); | |
| 419 plugins.add(linterPlugin); | |
| 420 plugins.add(linterServerPlugin); | |
| 421 plugins.add(dartCompletionPlugin); | |
| 422 plugins.addAll(_userDefinedPlugins); | |
| 423 | |
| 424 ExtensionManager manager = new ExtensionManager(); | |
| 425 manager.processPlugins(plugins); | |
| 426 // | |
| 427 // Create the sockets and start listening for requests. | 427 // Create the sockets and start listening for requests. |
| 428 // | 428 // |
| 429 socketServer = new SocketServer( | 429 socketServer = new SocketServer( |
| 430 analysisServerOptions, | 430 analysisServerOptions, |
| 431 defaultSdkCreator, | 431 defaultSdkCreator, |
| 432 defaultSdk, | 432 defaultSdk, |
| 433 service, | 433 service, |
| 434 serverPlugin, | 434 serverPlugin, |
| 435 packageResolverProvider, | 435 packageResolverProvider, |
| 436 embeddedUriResolverProvider); | 436 embeddedUriResolverProvider); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 */ | 598 */ |
| 599 static void _rollLogFiles(String path, int numOld) { | 599 static void _rollLogFiles(String path, int numOld) { |
| 600 for (int i = numOld - 1; i >= 0; i--) { | 600 for (int i = numOld - 1; i >= 0; i--) { |
| 601 try { | 601 try { |
| 602 String oldPath = i == 0 ? path : '$path.$i'; | 602 String oldPath = i == 0 ? path : '$path.$i'; |
| 603 new File(oldPath).renameSync('$path.${i+1}'); | 603 new File(oldPath).renameSync('$path.${i+1}'); |
| 604 } catch (e) {} | 604 } catch (e) {} |
| 605 } | 605 } |
| 606 } | 606 } |
| 607 } | 607 } |
| OLD | NEW |