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

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

Issue 2415413003: Remove unused method and field from DartSdkManager (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | pkg/analysis_server/test/analysis_abstract.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 if (results[SDK_OPTION] != null) { 415 if (results[SDK_OPTION] != null) {
416 defaultSdkPath = results[SDK_OPTION]; 416 defaultSdkPath = results[SDK_OPTION];
417 } else { 417 } else {
418 // No path to the SDK was provided. 418 // No path to the SDK was provided.
419 // Use DirectoryBasedDartSdk.defaultSdkDirectory, which will make a guess. 419 // Use DirectoryBasedDartSdk.defaultSdkDirectory, which will make a guess.
420 defaultSdkPath = FolderBasedDartSdk 420 defaultSdkPath = FolderBasedDartSdk
421 .defaultSdkDirectory(PhysicalResourceProvider.INSTANCE) 421 .defaultSdkDirectory(PhysicalResourceProvider.INSTANCE)
422 .path; 422 .path;
423 } 423 }
424 bool useSummaries = analysisServerOptions.fileReadMode == 'as-is'; 424 bool useSummaries = analysisServerOptions.fileReadMode == 'as-is';
425 SdkCreator defaultSdkCreator = (AnalysisOptions options) {
426 PhysicalResourceProvider resourceProvider =
427 PhysicalResourceProvider.INSTANCE;
428 FolderBasedDartSdk sdk = new FolderBasedDartSdk(
429 resourceProvider, resourceProvider.getFolder(defaultSdkPath));
430 sdk.analysisOptions = options;
431 sdk.useSummary = useSummaries;
432 return sdk;
433 };
434 // TODO(brianwilkerson) It would be nice to avoid creating an SDK that 425 // TODO(brianwilkerson) It would be nice to avoid creating an SDK that
435 // cannot be re-used, but the SDK is needed to create a package map provider 426 // cannot be re-used, but the SDK is needed to create a package map provider
436 // in the case where we need to run `pub` in order to get the package map. 427 // in the case where we need to run `pub` in order to get the package map.
437 DartSdk defaultSdk = defaultSdkCreator(null); 428 DartSdk defaultSdk = _createDefaultSdk(defaultSdkPath, useSummaries);
438 // 429 //
439 // Initialize the instrumentation service. 430 // Initialize the instrumentation service.
440 // 431 //
441 String logFilePath = results[INSTRUMENTATION_LOG_FILE]; 432 String logFilePath = results[INSTRUMENTATION_LOG_FILE];
442 if (logFilePath != null) { 433 if (logFilePath != null) {
443 _rollLogFiles(logFilePath, 5); 434 _rollLogFiles(logFilePath, 5);
444 FileInstrumentationServer fileBasedServer = 435 FileInstrumentationServer fileBasedServer =
445 new FileInstrumentationServer(logFilePath); 436 new FileInstrumentationServer(logFilePath);
446 instrumentationServer = instrumentationServer != null 437 instrumentationServer = instrumentationServer != null
447 ? new MulticastInstrumentationServer( 438 ? new MulticastInstrumentationServer(
448 [instrumentationServer, fileBasedServer]) 439 [instrumentationServer, fileBasedServer])
449 : fileBasedServer; 440 : fileBasedServer;
450 } 441 }
451 InstrumentationService service = 442 InstrumentationService service =
452 new InstrumentationService(instrumentationServer); 443 new InstrumentationService(instrumentationServer);
453 service.logVersion(_readUuid(service), results[CLIENT_ID], 444 service.logVersion(_readUuid(service), results[CLIENT_ID],
454 results[CLIENT_VERSION], AnalysisServer.VERSION, defaultSdk.sdkVersion); 445 results[CLIENT_VERSION], AnalysisServer.VERSION, defaultSdk.sdkVersion);
455 AnalysisEngine.instance.instrumentationService = service; 446 AnalysisEngine.instance.instrumentationService = service;
456 // 447 //
457 // Create the sockets and start listening for requests. 448 // Create the sockets and start listening for requests.
458 // 449 //
459 socketServer = new SocketServer( 450 socketServer = new SocketServer(
460 analysisServerOptions, 451 analysisServerOptions,
461 new DartSdkManager(defaultSdkPath, useSummaries, defaultSdkCreator), 452 new DartSdkManager(defaultSdkPath, useSummaries),
462 defaultSdk, 453 defaultSdk,
463 service, 454 service,
464 serverPlugin, 455 serverPlugin,
465 fileResolverProvider, 456 fileResolverProvider,
466 packageResolverProvider, 457 packageResolverProvider,
467 useSingleContextManager); 458 useSingleContextManager);
468 httpServer = new HttpAnalysisServer(socketServer); 459 httpServer = new HttpAnalysisServer(socketServer);
469 stdioServer = new StdioAnalysisServer(socketServer); 460 stdioServer = new StdioAnalysisServer(socketServer);
470 socketServer.userDefinedPlugins = _userDefinedPlugins; 461 socketServer.userDefinedPlugins = _userDefinedPlugins;
471 462
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 allowedHelp: { 570 allowedHelp: {
580 "as-is": "file contents are read as-is, no file changes occur", 571 "as-is": "file contents are read as-is, no file changes occur",
581 "normalize-eol-always": 572 "normalize-eol-always":
582 r'file contents normalize the end of line characters to the single character new line `\n`' 573 r'file contents normalize the end of line characters to the single character new line `\n`'
583 }, 574 },
584 defaultsTo: "as-is"); 575 defaultsTo: "as-is");
585 576
586 return parser; 577 return parser;
587 } 578 }
588 579
580 DartSdk _createDefaultSdk(String defaultSdkPath, bool useSummaries) {
581 PhysicalResourceProvider resourceProvider =
582 PhysicalResourceProvider.INSTANCE;
583 FolderBasedDartSdk sdk = new FolderBasedDartSdk(
584 resourceProvider, resourceProvider.getFolder(defaultSdkPath));
585 sdk.useSummary = useSummaries;
586 return sdk;
587 }
588
589 /** 589 /**
590 * Print information about how to use the server. 590 * Print information about how to use the server.
591 */ 591 */
592 void _printUsage(ArgParser parser) { 592 void _printUsage(ArgParser parser) {
593 print('Usage: $BINARY_NAME [flags]'); 593 print('Usage: $BINARY_NAME [flags]');
594 print(''); 594 print('');
595 print('Supported flags are:'); 595 print('Supported flags are:');
596 print(parser.usage); 596 print(parser.usage);
597 } 597 }
598 598
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 */ 637 */
638 static void _rollLogFiles(String path, int numOld) { 638 static void _rollLogFiles(String path, int numOld) {
639 for (int i = numOld - 1; i >= 0; i--) { 639 for (int i = numOld - 1; i >= 0; i--) {
640 try { 640 try {
641 String oldPath = i == 0 ? path : '$path.$i'; 641 String oldPath = i == 0 ? path : '$path.$i';
642 new File(oldPath).renameSync('$path.${i+1}'); 642 new File(oldPath).renameSync('$path.${i+1}');
643 } catch (e) {} 643 } catch (e) {}
644 } 644 }
645 } 645 }
646 } 646 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/analysis_abstract.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698