| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 * The name of the option used to set the identifier for the client. | 199 * The name of the option used to set the identifier for the client. |
| 200 */ | 200 */ |
| 201 static const String CLIENT_ID = "client-id"; | 201 static const String CLIENT_ID = "client-id"; |
| 202 | 202 |
| 203 /** | 203 /** |
| 204 * The name of the option used to set the version for the client. | 204 * The name of the option used to set the version for the client. |
| 205 */ | 205 */ |
| 206 static const String CLIENT_VERSION = "client-version"; | 206 static const String CLIENT_VERSION = "client-version"; |
| 207 | 207 |
| 208 /** | 208 /** |
| 209 * The name of the option used to disable the use of the new task model. |
| 210 */ |
| 211 static const String DISABLE_NEW_TASK_MODEL = "disable-new-task-model"; |
| 212 |
| 213 /** |
| 209 * The name of the option used to enable incremental resolution of API | 214 * The name of the option used to enable incremental resolution of API |
| 210 * changes. | 215 * changes. |
| 211 */ | 216 */ |
| 212 static const String ENABLE_INCREMENTAL_RESOLUTION_API = | 217 static const String ENABLE_INCREMENTAL_RESOLUTION_API = |
| 213 "enable-incremental-resolution-api"; | 218 "enable-incremental-resolution-api"; |
| 214 | 219 |
| 215 /** | 220 /** |
| 216 * The name of the option used to enable instrumentation. | 221 * The name of the option used to enable instrumentation. |
| 217 */ | 222 */ |
| 218 static const String ENABLE_INSTRUMENTATION_OPTION = "enable-instrumentation"; | 223 static const String ENABLE_INSTRUMENTATION_OPTION = "enable-instrumentation"; |
| 219 | 224 |
| 220 /** | 225 /** |
| 221 * The name of the option used to enable the use of the new task model. | |
| 222 */ | |
| 223 static const String ENABLE_NEW_TASK_MODEL = "enable-new-task-model"; | |
| 224 | |
| 225 /** | |
| 226 * The name of the option used to set the file read mode. | 226 * The name of the option used to set the file read mode. |
| 227 */ | 227 */ |
| 228 static const String FILE_READ_MODE = "file-read-mode"; | 228 static const String FILE_READ_MODE = "file-read-mode"; |
| 229 | 229 |
| 230 /** | 230 /** |
| 231 * The name of the option used to print usage information. | 231 * The name of the option used to print usage information. |
| 232 */ | 232 */ |
| 233 static const String HELP_OPTION = "help"; | 233 static const String HELP_OPTION = "help"; |
| 234 | 234 |
| 235 /** | 235 /** |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 } | 388 } |
| 389 } | 389 } |
| 390 InstrumentationService service = | 390 InstrumentationService service = |
| 391 new InstrumentationService(instrumentationServer); | 391 new InstrumentationService(instrumentationServer); |
| 392 service.logVersion(_readUuid(service), results[CLIENT_ID], | 392 service.logVersion(_readUuid(service), results[CLIENT_ID], |
| 393 results[CLIENT_VERSION], AnalysisServer.VERSION, defaultSdk.sdkVersion); | 393 results[CLIENT_VERSION], AnalysisServer.VERSION, defaultSdk.sdkVersion); |
| 394 AnalysisEngine.instance.instrumentationService = service; | 394 AnalysisEngine.instance.instrumentationService = service; |
| 395 // | 395 // |
| 396 // Enable the new task model, if appropriate. | 396 // Enable the new task model, if appropriate. |
| 397 // | 397 // |
| 398 if (results[ENABLE_NEW_TASK_MODEL]) { | 398 AnalysisEngine.instance.useTaskModel = !results[DISABLE_NEW_TASK_MODEL]; |
| 399 AnalysisEngine.instance.useTaskModel = true; | |
| 400 } | |
| 401 // | 399 // |
| 402 // Process all of the plugins so that extensions are registered. | 400 // Process all of the plugins so that extensions are registered. |
| 403 // | 401 // |
| 404 ServerPlugin serverPlugin = new ServerPlugin(); | 402 ServerPlugin serverPlugin = new ServerPlugin(); |
| 405 List<Plugin> plugins = <Plugin>[]; | 403 List<Plugin> plugins = <Plugin>[]; |
| 406 plugins.add(AnalysisEngine.instance.enginePlugin); | 404 plugins.add(AnalysisEngine.instance.enginePlugin); |
| 407 plugins.add(serverPlugin); | 405 plugins.add(serverPlugin); |
| 408 plugins.addAll(_userDefinedPlugins); | 406 plugins.addAll(_userDefinedPlugins); |
| 409 ExtensionManager manager = new ExtensionManager(); | 407 ExtensionManager manager = new ExtensionManager(); |
| 410 manager.processPlugins(plugins); | 408 manager.processPlugins(plugins); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 | 461 |
| 464 /** | 462 /** |
| 465 * Create and return the parser used to parse the command-line arguments. | 463 * Create and return the parser used to parse the command-line arguments. |
| 466 */ | 464 */ |
| 467 CommandLineParser _createArgParser() { | 465 CommandLineParser _createArgParser() { |
| 468 CommandLineParser parser = | 466 CommandLineParser parser = |
| 469 new CommandLineParser(alwaysIgnoreUnrecognized: true); | 467 new CommandLineParser(alwaysIgnoreUnrecognized: true); |
| 470 parser.addOption(CLIENT_ID, | 468 parser.addOption(CLIENT_ID, |
| 471 help: "an identifier used to identify the client"); | 469 help: "an identifier used to identify the client"); |
| 472 parser.addOption(CLIENT_VERSION, help: "the version of the client"); | 470 parser.addOption(CLIENT_VERSION, help: "the version of the client"); |
| 471 parser.addFlag(DISABLE_NEW_TASK_MODEL, |
| 472 help: "disable the use of the new task model", |
| 473 defaultsTo: false, |
| 474 hide: true, |
| 475 negatable: false); |
| 473 parser.addFlag(ENABLE_INCREMENTAL_RESOLUTION_API, | 476 parser.addFlag(ENABLE_INCREMENTAL_RESOLUTION_API, |
| 474 help: "enable using incremental resolution for API changes", | 477 help: "enable using incremental resolution for API changes", |
| 475 defaultsTo: false, | 478 defaultsTo: false, |
| 476 negatable: false); | 479 negatable: false); |
| 477 parser.addFlag(ENABLE_INSTRUMENTATION_OPTION, | 480 parser.addFlag(ENABLE_INSTRUMENTATION_OPTION, |
| 478 help: "enable sending instrumentation information to a server", | 481 help: "enable sending instrumentation information to a server", |
| 479 defaultsTo: false, | 482 defaultsTo: false, |
| 480 negatable: false); | 483 negatable: false); |
| 481 parser.addFlag(ENABLE_NEW_TASK_MODEL, | |
| 482 help: "enable the use of the new task model", | |
| 483 defaultsTo: false, | |
| 484 hide: true, | |
| 485 negatable: false); | |
| 486 parser.addFlag(HELP_OPTION, | 484 parser.addFlag(HELP_OPTION, |
| 487 help: "print this help message without starting a server", | 485 help: "print this help message without starting a server", |
| 488 defaultsTo: false, | 486 defaultsTo: false, |
| 489 negatable: false); | 487 negatable: false); |
| 490 parser.addOption(INCREMENTAL_RESOLUTION_LOG, | 488 parser.addOption(INCREMENTAL_RESOLUTION_LOG, |
| 491 help: "the description of the incremental resolution log"); | 489 help: "the description of the incremental resolution log"); |
| 492 parser.addFlag(INCREMENTAL_RESOLUTION_VALIDATION, | 490 parser.addFlag(INCREMENTAL_RESOLUTION_VALIDATION, |
| 493 help: "enable validation of incremental resolution results (slow)", | 491 help: "enable validation of incremental resolution results (slow)", |
| 494 defaultsTo: false, | 492 defaultsTo: false, |
| 495 negatable: false); | 493 negatable: false); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 uuidFile.parent.createSync(recursive: true); | 563 uuidFile.parent.createSync(recursive: true); |
| 566 uuidFile.writeAsStringSync(uuid); | 564 uuidFile.writeAsStringSync(uuid); |
| 567 } catch (exception, stackTrace) { | 565 } catch (exception, stackTrace) { |
| 568 service.logPriorityException(exception, stackTrace); | 566 service.logPriorityException(exception, stackTrace); |
| 569 // Slightly alter the uuid to indicate it was not persisted | 567 // Slightly alter the uuid to indicate it was not persisted |
| 570 uuid = 'temp-$uuid'; | 568 uuid = 'temp-$uuid'; |
| 571 } | 569 } |
| 572 return uuid; | 570 return uuid; |
| 573 } | 571 } |
| 574 } | 572 } |
| OLD | NEW |