| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 * The name of the application that is used to start a server. | 55 * The name of the application that is used to start a server. |
| 56 */ | 56 */ |
| 57 static const BINARY_NAME = "server"; | 57 static const BINARY_NAME = "server"; |
| 58 | 58 |
| 59 /** | 59 /** |
| 60 * The name of the option used to set the identifier for the client. | 60 * The name of the option used to set the identifier for the client. |
| 61 */ | 61 */ |
| 62 static const String CLIENT_ID = "client-id"; | 62 static const String CLIENT_ID = "client-id"; |
| 63 | 63 |
| 64 /** | 64 /** |
| 65 * The name of the option used to enable incremental resolution. | |
| 66 */ | |
| 67 static const String ENABLE_INCREMENTAL_RESOLUTION = | |
| 68 "enable-incremental-resolution"; | |
| 69 | |
| 70 /** | |
| 71 * The name of the option used to enable incremental resolution of API | 65 * The name of the option used to enable incremental resolution of API |
| 72 * changes. | 66 * changes. |
| 73 */ | 67 */ |
| 74 static const String ENABLE_INCREMENTAL_RESOLUTION_API = | 68 static const String ENABLE_INCREMENTAL_RESOLUTION_API = |
| 75 "enable-incremental-resolution-api"; | 69 "enable-incremental-resolution-api"; |
| 76 | 70 |
| 77 /** | 71 /** |
| 78 * The name of the option used to describe the incremental resolution logger. | 72 * The name of the option used to describe the incremental resolution logger. |
| 79 */ | 73 */ |
| 80 static const String INCREMENTAL_RESOLUTION_LOG = "incremental-resolution-log"; | 74 static const String INCREMENTAL_RESOLUTION_LOG = "incremental-resolution-log"; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 Driver(); | 121 Driver(); |
| 128 /** | 122 /** |
| 129 * Use the given command-line arguments to start this server. | 123 * Use the given command-line arguments to start this server. |
| 130 */ | 124 */ |
| 131 void start(List<String> args) { | 125 void start(List<String> args) { |
| 132 ArgParser parser = new ArgParser(); | 126 ArgParser parser = new ArgParser(); |
| 133 parser.addOption( | 127 parser.addOption( |
| 134 CLIENT_ID, | 128 CLIENT_ID, |
| 135 help: "an identifier used to identify the client"); | 129 help: "an identifier used to identify the client"); |
| 136 parser.addFlag( | 130 parser.addFlag( |
| 137 ENABLE_INCREMENTAL_RESOLUTION, | |
| 138 help: "enable using incremental resolution", | |
| 139 defaultsTo: false, | |
| 140 negatable: false); | |
| 141 parser.addFlag( | |
| 142 ENABLE_INCREMENTAL_RESOLUTION_API, | 131 ENABLE_INCREMENTAL_RESOLUTION_API, |
| 143 help: "enable using incremental resolution for API changes", | 132 help: "enable using incremental resolution for API changes", |
| 144 defaultsTo: false, | 133 defaultsTo: false, |
| 145 negatable: false); | 134 negatable: false); |
| 146 parser.addFlag( | 135 parser.addFlag( |
| 147 ENABLE_INSTRUMENTATION_OPTION, | 136 ENABLE_INSTRUMENTATION_OPTION, |
| 148 help: "enable sending instrumentation information to a server", | 137 help: "enable sending instrumentation information to a server", |
| 149 defaultsTo: false, | 138 defaultsTo: false, |
| 150 negatable: false); | 139 negatable: false); |
| 151 parser.addFlag( | 140 parser.addFlag( |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 } on FormatException { | 194 } on FormatException { |
| 206 print('Invalid port number: ${results[PORT_OPTION]}'); | 195 print('Invalid port number: ${results[PORT_OPTION]}'); |
| 207 print(''); | 196 print(''); |
| 208 _printUsage(parser); | 197 _printUsage(parser); |
| 209 exitCode = 1; | 198 exitCode = 1; |
| 210 return; | 199 return; |
| 211 } | 200 } |
| 212 } | 201 } |
| 213 | 202 |
| 214 AnalysisServerOptions analysisServerOptions = new AnalysisServerOptions(); | 203 AnalysisServerOptions analysisServerOptions = new AnalysisServerOptions(); |
| 215 analysisServerOptions.enableIncrementalResolution = | |
| 216 results[ENABLE_INCREMENTAL_RESOLUTION]; | |
| 217 analysisServerOptions.enableIncrementalResolutionApi = | 204 analysisServerOptions.enableIncrementalResolutionApi = |
| 218 results[ENABLE_INCREMENTAL_RESOLUTION_API]; | 205 results[ENABLE_INCREMENTAL_RESOLUTION_API]; |
| 219 | 206 |
| 220 _initIncrementalLogger(results[INCREMENTAL_RESOLUTION_LOG]); | 207 _initIncrementalLogger(results[INCREMENTAL_RESOLUTION_LOG]); |
| 221 | 208 |
| 222 DartSdk defaultSdk; | 209 DartSdk defaultSdk; |
| 223 if (results[SDK_OPTION] != null) { | 210 if (results[SDK_OPTION] != null) { |
| 224 defaultSdk = new DirectoryBasedDartSdk(new JavaFile(results[SDK_OPTION])); | 211 defaultSdk = new DirectoryBasedDartSdk(new JavaFile(results[SDK_OPTION])); |
| 225 } else { | 212 } else { |
| 226 // No path to the SDK provided; use DirectoryBasedDartSdk.defaultSdk, | 213 // No path to the SDK provided; use DirectoryBasedDartSdk.defaultSdk, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 /** | 263 /** |
| 277 * Print information about how to use the server. | 264 * Print information about how to use the server. |
| 278 */ | 265 */ |
| 279 void _printUsage(ArgParser parser) { | 266 void _printUsage(ArgParser parser) { |
| 280 print('Usage: $BINARY_NAME [flags]'); | 267 print('Usage: $BINARY_NAME [flags]'); |
| 281 print(''); | 268 print(''); |
| 282 print('Supported flags are:'); | 269 print('Supported flags are:'); |
| 283 print(parser.usage); | 270 print(parser.usage); |
| 284 } | 271 } |
| 285 } | 272 } |
| OLD | NEW |