| 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 | 9 |
| 10 import 'package:analysis_server/http_server.dart'; | 10 import 'package:analysis_server/http_server.dart'; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 */ | 68 */ |
| 69 static const String ENABLE_INCREMENTAL_RESOLUTION_API = | 69 static const String ENABLE_INCREMENTAL_RESOLUTION_API = |
| 70 "enable-incremental-resolution-api"; | 70 "enable-incremental-resolution-api"; |
| 71 | 71 |
| 72 /** | 72 /** |
| 73 * The name of the option used to describe the incremental resolution logger. | 73 * The name of the option used to describe the incremental resolution logger. |
| 74 */ | 74 */ |
| 75 static const String INCREMENTAL_RESOLUTION_LOG = "incremental-resolution-log"; | 75 static const String INCREMENTAL_RESOLUTION_LOG = "incremental-resolution-log"; |
| 76 | 76 |
| 77 /** | 77 /** |
| 78 * The name of the option used to enable validation of incremental resolution |
| 79 * results. |
| 80 */ |
| 81 static const String INCREMENTAL_RESOLUTION_VALIDATION = |
| 82 "incremental-resolution-validation"; |
| 83 |
| 84 /** |
| 78 * The name of the option used to enable instrumentation. | 85 * The name of the option used to enable instrumentation. |
| 79 */ | 86 */ |
| 80 static const String ENABLE_INSTRUMENTATION_OPTION = "enable-instrumentation"; | 87 static const String ENABLE_INSTRUMENTATION_OPTION = "enable-instrumentation"; |
| 81 | 88 |
| 82 /** | 89 /** |
| 83 * The name of the option used to print usage information. | 90 * The name of the option used to print usage information. |
| 84 */ | 91 */ |
| 85 static const String HELP_OPTION = "help"; | 92 static const String HELP_OPTION = "help"; |
| 86 | 93 |
| 87 /** | 94 /** |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 help: "enable sending instrumentation information to a server", | 145 help: "enable sending instrumentation information to a server", |
| 139 defaultsTo: false, | 146 defaultsTo: false, |
| 140 negatable: false); | 147 negatable: false); |
| 141 parser.addFlag( | 148 parser.addFlag( |
| 142 HELP_OPTION, | 149 HELP_OPTION, |
| 143 help: "print this help message without starting a server", | 150 help: "print this help message without starting a server", |
| 144 defaultsTo: false, | 151 defaultsTo: false, |
| 145 negatable: false); | 152 negatable: false); |
| 146 parser.addOption( | 153 parser.addOption( |
| 147 INCREMENTAL_RESOLUTION_LOG, | 154 INCREMENTAL_RESOLUTION_LOG, |
| 148 help: "the description of the incremental resolotion log"); | 155 help: "the description of the incremental resolution log"); |
| 156 parser.addFlag( |
| 157 INCREMENTAL_RESOLUTION_VALIDATION, |
| 158 help: "enable validation of incremental resolution results (slow)", |
| 159 defaultsTo: false, |
| 160 negatable: false); |
| 149 parser.addFlag( | 161 parser.addFlag( |
| 150 INTERNAL_PRINT_TO_CONSOLE, | 162 INTERNAL_PRINT_TO_CONSOLE, |
| 151 help: "enable sending `print` output to the console", | 163 help: "enable sending `print` output to the console", |
| 152 defaultsTo: false, | 164 defaultsTo: false, |
| 153 negatable: false); | 165 negatable: false); |
| 154 parser.addOption( | 166 parser.addOption( |
| 155 PORT_OPTION, | 167 PORT_OPTION, |
| 156 help: "[port] the port on which the server will listen"); | 168 help: "[port] the port on which the server will listen"); |
| 157 parser.addOption(SDK_OPTION, help: "[path] the path to the sdk"); | 169 parser.addOption(SDK_OPTION, help: "[path] the path to the sdk"); |
| 158 parser.addFlag( | 170 parser.addFlag( |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 print(''); | 209 print(''); |
| 198 _printUsage(parser); | 210 _printUsage(parser); |
| 199 exitCode = 1; | 211 exitCode = 1; |
| 200 return; | 212 return; |
| 201 } | 213 } |
| 202 } | 214 } |
| 203 | 215 |
| 204 AnalysisServerOptions analysisServerOptions = new AnalysisServerOptions(); | 216 AnalysisServerOptions analysisServerOptions = new AnalysisServerOptions(); |
| 205 analysisServerOptions.enableIncrementalResolutionApi = | 217 analysisServerOptions.enableIncrementalResolutionApi = |
| 206 results[ENABLE_INCREMENTAL_RESOLUTION_API]; | 218 results[ENABLE_INCREMENTAL_RESOLUTION_API]; |
| 219 analysisServerOptions.enableIncrementalResolutionValidation = |
| 220 results[INCREMENTAL_RESOLUTION_VALIDATION]; |
| 207 | 221 |
| 208 _initIncrementalLogger(results[INCREMENTAL_RESOLUTION_LOG]); | 222 _initIncrementalLogger(results[INCREMENTAL_RESOLUTION_LOG]); |
| 209 | 223 |
| 210 DartSdk defaultSdk; | 224 DartSdk defaultSdk; |
| 211 if (results[SDK_OPTION] != null) { | 225 if (results[SDK_OPTION] != null) { |
| 212 defaultSdk = new DirectoryBasedDartSdk(new JavaFile(results[SDK_OPTION])); | 226 defaultSdk = new DirectoryBasedDartSdk(new JavaFile(results[SDK_OPTION])); |
| 213 } else { | 227 } else { |
| 214 // No path to the SDK provided; use DirectoryBasedDartSdk.defaultSdk, | 228 // No path to the SDK provided; use DirectoryBasedDartSdk.defaultSdk, |
| 215 // which will make a guess. | 229 // which will make a guess. |
| 216 defaultSdk = DirectoryBasedDartSdk.defaultSdk; | 230 defaultSdk = DirectoryBasedDartSdk.defaultSdk; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 /** | 286 /** |
| 273 * Print information about how to use the server. | 287 * Print information about how to use the server. |
| 274 */ | 288 */ |
| 275 void _printUsage(ArgParser parser) { | 289 void _printUsage(ArgParser parser) { |
| 276 print('Usage: $BINARY_NAME [flags]'); | 290 print('Usage: $BINARY_NAME [flags]'); |
| 277 print(''); | 291 print(''); |
| 278 print('Supported flags are:'); | 292 print('Supported flags are:'); |
| 279 print(parser.usage); | 293 print(parser.usage); |
| 280 } | 294 } |
| 281 } | 295 } |
| OLD | NEW |