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

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

Issue 2742343006: Formalizing the hacks letting the angular analyzer plugin run for now. (Closed)
Patch Set: Rename variable not method Created 3 years, 9 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 | « pkg/analysis_server/lib/src/context_manager.dart ('k') | pkg/analysis_server/lib/starter.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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 341
342 /** 342 /**
343 * Set the [plugins] that are defined outside the analysis_server package. 343 * Set the [plugins] that are defined outside the analysis_server package.
344 */ 344 */
345 void set userDefinedPlugins(List<Plugin> plugins) { 345 void set userDefinedPlugins(List<Plugin> plugins) {
346 _userDefinedPlugins = plugins ?? <Plugin>[]; 346 _userDefinedPlugins = plugins ?? <Plugin>[];
347 } 347 }
348 348
349 /** 349 /**
350 * Use the given command-line [arguments] to start this server. 350 * Use the given command-line [arguments] to start this server.
351 *
352 * At least temporarily returns AnalysisServer so that consumers of the
353 * starter API can then use the server, this is done as a stopgap for the
354 * angular plugin until the official plugin API is finished.
351 */ 355 */
352 void start(List<String> arguments) { 356 AnalysisServer start(List<String> arguments) {
353 CommandLineParser parser = _createArgParser(); 357 CommandLineParser parser = _createArgParser();
354 ArgResults results = parser.parse(arguments, <String, String>{}); 358 ArgResults results = parser.parse(arguments, <String, String>{});
355 if (results[HELP_OPTION]) { 359 if (results[HELP_OPTION]) {
356 _printUsage(parser.parser); 360 _printUsage(parser.parser);
357 return; 361 return null;
358 } 362 }
359 363
360 // TODO (danrubel) Remove this workaround 364 // TODO (danrubel) Remove this workaround
361 // once the underlying VM and dart:io issue has been fixed. 365 // once the underlying VM and dart:io issue has been fixed.
362 if (results[INTERNAL_DELAY_FREQUENCY] != null) { 366 if (results[INTERNAL_DELAY_FREQUENCY] != null) {
363 AnalysisServer.performOperationDelayFrequency = 367 AnalysisServer.performOperationDelayFrequency =
364 int.parse(results[INTERNAL_DELAY_FREQUENCY], onError: (_) => 0); 368 int.parse(results[INTERNAL_DELAY_FREQUENCY], onError: (_) => 0);
365 } 369 }
366 370
367 int port; 371 int port;
368 bool serve_http = false; 372 bool serve_http = false;
369 if (results[PORT_OPTION] != null) { 373 if (results[PORT_OPTION] != null) {
370 try { 374 try {
371 port = int.parse(results[PORT_OPTION]); 375 port = int.parse(results[PORT_OPTION]);
372 serve_http = true; 376 serve_http = true;
373 } on FormatException { 377 } on FormatException {
374 print('Invalid port number: ${results[PORT_OPTION]}'); 378 print('Invalid port number: ${results[PORT_OPTION]}');
375 print(''); 379 print('');
376 _printUsage(parser.parser); 380 _printUsage(parser.parser);
377 exitCode = 1; 381 exitCode = 1;
378 return; 382 return null;
379 } 383 }
380 } 384 }
381 385
382 AnalysisServerOptions analysisServerOptions = new AnalysisServerOptions(); 386 AnalysisServerOptions analysisServerOptions = new AnalysisServerOptions();
383 analysisServerOptions.enableIncrementalResolutionApi = 387 analysisServerOptions.enableIncrementalResolutionApi =
384 results[ENABLE_INCREMENTAL_RESOLUTION_API]; 388 results[ENABLE_INCREMENTAL_RESOLUTION_API];
385 analysisServerOptions.enableIncrementalResolutionValidation = 389 analysisServerOptions.enableIncrementalResolutionValidation =
386 results[INCREMENTAL_RESOLUTION_VALIDATION]; 390 results[INCREMENTAL_RESOLUTION_VALIDATION];
387 analysisServerOptions.enableNewAnalysisDriver = 391 analysisServerOptions.enableNewAnalysisDriver =
388 !results[DISABLE_NEW_ANALYSIS_DRIVER]; 392 !results[DISABLE_NEW_ANALYSIS_DRIVER];
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 stdioServer.serveStdio().then((_) async { 481 stdioServer.serveStdio().then((_) async {
478 if (serve_http) { 482 if (serve_http) {
479 httpServer.close(); 483 httpServer.close();
480 } 484 }
481 await instrumentationService.shutdown(); 485 await instrumentationService.shutdown();
482 exit(0); 486 exit(0);
483 }); 487 });
484 }, 488 },
485 print: 489 print:
486 results[INTERNAL_PRINT_TO_CONSOLE] ? null : httpServer.recordPrint); 490 results[INTERNAL_PRINT_TO_CONSOLE] ? null : httpServer.recordPrint);
491
492 return socketServer.analysisServer;
487 } 493 }
488 494
489 /** 495 /**
490 * Execute the given [callback] within a zone that will capture any unhandled 496 * Execute the given [callback] within a zone that will capture any unhandled
491 * exceptions and both report them to the client and send them to the given 497 * exceptions and both report them to the client and send them to the given
492 * instrumentation [service]. If a [print] function is provided, then also 498 * instrumentation [service]. If a [print] function is provided, then also
493 * capture any data printed by the callback and redirect it to the function. 499 * capture any data printed by the callback and redirect it to the function.
494 */ 500 */
495 dynamic _captureExceptions(InstrumentationService service, dynamic callback(), 501 dynamic _captureExceptions(InstrumentationService service, dynamic callback(),
496 {void print(String line)}) { 502 {void print(String line)}) {
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 666
661 _DiagnosticServerImpl(); 667 _DiagnosticServerImpl();
662 668
663 Future startOnPort(int port) { 669 Future startOnPort(int port) {
664 return httpServer.serveHttp(port); 670 return httpServer.serveHttp(port);
665 } 671 }
666 672
667 @override 673 @override
668 Future<int> getServerPort() => httpServer.serveHttp(); 674 Future<int> getServerPort() => httpServer.serveHttp();
669 } 675 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/context_manager.dart ('k') | pkg/analysis_server/lib/starter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698