| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 * The name of the option used to set the identifier for the client. | 202 * The name of the option used to set the identifier for the client. |
| 203 */ | 203 */ |
| 204 static const String CLIENT_ID = "client-id"; | 204 static const String CLIENT_ID = "client-id"; |
| 205 | 205 |
| 206 /** | 206 /** |
| 207 * The name of the option used to set the version for the client. | 207 * The name of the option used to set the version for the client. |
| 208 */ | 208 */ |
| 209 static const String CLIENT_VERSION = "client-version"; | 209 static const String CLIENT_VERSION = "client-version"; |
| 210 | 210 |
| 211 /** | 211 /** |
| 212 * The name of the option used to disable the use of the new task model. | |
| 213 */ | |
| 214 static const String DISABLE_NEW_TASK_MODEL = "disable-new-task-model"; | |
| 215 | |
| 216 /** | |
| 217 * The name of the option used to enable incremental resolution of API | 212 * The name of the option used to enable incremental resolution of API |
| 218 * changes. | 213 * changes. |
| 219 */ | 214 */ |
| 220 static const String ENABLE_INCREMENTAL_RESOLUTION_API = | 215 static const String ENABLE_INCREMENTAL_RESOLUTION_API = |
| 221 "enable-incremental-resolution-api"; | 216 "enable-incremental-resolution-api"; |
| 222 | 217 |
| 223 /** | 218 /** |
| 224 * The name of the option used to enable instrumentation. | 219 * The name of the option used to enable instrumentation. |
| 225 */ | 220 */ |
| 226 static const String ENABLE_INSTRUMENTATION_OPTION = "enable-instrumentation"; | 221 static const String ENABLE_INSTRUMENTATION_OPTION = "enable-instrumentation"; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 ? new MulticastInstrumentationServer( | 387 ? new MulticastInstrumentationServer( |
| 393 [instrumentationServer, fileBasedServer]) | 388 [instrumentationServer, fileBasedServer]) |
| 394 : fileBasedServer; | 389 : fileBasedServer; |
| 395 } | 390 } |
| 396 InstrumentationService service = | 391 InstrumentationService service = |
| 397 new InstrumentationService(instrumentationServer); | 392 new InstrumentationService(instrumentationServer); |
| 398 service.logVersion(_readUuid(service), results[CLIENT_ID], | 393 service.logVersion(_readUuid(service), results[CLIENT_ID], |
| 399 results[CLIENT_VERSION], AnalysisServer.VERSION, defaultSdk.sdkVersion); | 394 results[CLIENT_VERSION], AnalysisServer.VERSION, defaultSdk.sdkVersion); |
| 400 AnalysisEngine.instance.instrumentationService = service; | 395 AnalysisEngine.instance.instrumentationService = service; |
| 401 // | 396 // |
| 402 // Enable the new task model, if appropriate. | |
| 403 // | |
| 404 AnalysisEngine.instance.useTaskModel = !results[DISABLE_NEW_TASK_MODEL]; | |
| 405 // | |
| 406 // Process all of the plugins so that extensions are registered. | 397 // Process all of the plugins so that extensions are registered. |
| 407 // | 398 // |
| 408 ServerPlugin serverPlugin = new ServerPlugin(); | 399 ServerPlugin serverPlugin = new ServerPlugin(); |
| 409 List<Plugin> plugins = <Plugin>[]; | 400 List<Plugin> plugins = <Plugin>[]; |
| 410 plugins.addAll(AnalysisEngine.instance.requiredPlugins); | 401 plugins.addAll(AnalysisEngine.instance.requiredPlugins); |
| 411 plugins.add(AnalysisEngine.instance.commandLinePlugin); | 402 plugins.add(AnalysisEngine.instance.commandLinePlugin); |
| 412 plugins.add(AnalysisEngine.instance.optionsPlugin); | 403 plugins.add(AnalysisEngine.instance.optionsPlugin); |
| 413 plugins.add(serverPlugin); | 404 plugins.add(serverPlugin); |
| 414 plugins.add(linterPlugin); | 405 plugins.add(linterPlugin); |
| 415 plugins.add(linterServerPlugin); | 406 plugins.add(linterServerPlugin); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 | 465 |
| 475 /** | 466 /** |
| 476 * Create and return the parser used to parse the command-line arguments. | 467 * Create and return the parser used to parse the command-line arguments. |
| 477 */ | 468 */ |
| 478 CommandLineParser _createArgParser() { | 469 CommandLineParser _createArgParser() { |
| 479 CommandLineParser parser = | 470 CommandLineParser parser = |
| 480 new CommandLineParser(alwaysIgnoreUnrecognized: true); | 471 new CommandLineParser(alwaysIgnoreUnrecognized: true); |
| 481 parser.addOption(CLIENT_ID, | 472 parser.addOption(CLIENT_ID, |
| 482 help: "an identifier used to identify the client"); | 473 help: "an identifier used to identify the client"); |
| 483 parser.addOption(CLIENT_VERSION, help: "the version of the client"); | 474 parser.addOption(CLIENT_VERSION, help: "the version of the client"); |
| 484 parser.addFlag(DISABLE_NEW_TASK_MODEL, | |
| 485 help: "disable the use of the new task model", | |
| 486 defaultsTo: false, | |
| 487 hide: true, | |
| 488 negatable: false); | |
| 489 parser.addFlag(ENABLE_INCREMENTAL_RESOLUTION_API, | 475 parser.addFlag(ENABLE_INCREMENTAL_RESOLUTION_API, |
| 490 help: "enable using incremental resolution for API changes", | 476 help: "enable using incremental resolution for API changes", |
| 491 defaultsTo: false, | 477 defaultsTo: false, |
| 492 negatable: false); | 478 negatable: false); |
| 493 parser.addFlag(ENABLE_INSTRUMENTATION_OPTION, | 479 parser.addFlag(ENABLE_INSTRUMENTATION_OPTION, |
| 494 help: "enable sending instrumentation information to a server", | 480 help: "enable sending instrumentation information to a server", |
| 495 defaultsTo: false, | 481 defaultsTo: false, |
| 496 negatable: false); | 482 negatable: false); |
| 497 parser.addFlag(HELP_OPTION, | 483 parser.addFlag(HELP_OPTION, |
| 498 help: "print this help message without starting a server", | 484 help: "print this help message without starting a server", |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 */ | 578 */ |
| 593 static void _rollLogFiles(String path, int numOld) { | 579 static void _rollLogFiles(String path, int numOld) { |
| 594 for (int i = numOld - 1; i >= 0; i--) { | 580 for (int i = numOld - 1; i >= 0; i--) { |
| 595 try { | 581 try { |
| 596 String oldPath = i == 0 ? path : '$path.$i'; | 582 String oldPath = i == 0 ? path : '$path.$i'; |
| 597 new File(oldPath).renameSync('$path.${i+1}'); | 583 new File(oldPath).renameSync('$path.${i+1}'); |
| 598 } catch (e) {} | 584 } catch (e) {} |
| 599 } | 585 } |
| 600 } | 586 } |
| 601 } | 587 } |
| OLD | NEW |