| 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 */ | 55 */ |
| 56 static const BINARY_NAME = "server"; | 56 static const BINARY_NAME = "server"; |
| 57 | 57 |
| 58 /** | 58 /** |
| 59 * The name of the option used to enable incremental resolution. | 59 * The name of the option used to enable incremental resolution. |
| 60 */ | 60 */ |
| 61 static const String ENABLE_INCREMENTAL_RESOLUTION = | 61 static const String ENABLE_INCREMENTAL_RESOLUTION = |
| 62 "enable-incremental-resolution"; | 62 "enable-incremental-resolution"; |
| 63 | 63 |
| 64 /** | 64 /** |
| 65 * The name of the option used to enable incremental resolution of API |
| 66 * changes. |
| 67 */ |
| 68 static const String ENABLE_INCREMENTAL_RESOLUTION_API = |
| 69 "enable-incremental-resolution-api"; |
| 70 |
| 71 /** |
| 65 * 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. |
| 66 */ | 73 */ |
| 67 static const String INCREMENTAL_RESOLUTION_LOG = "incremental-resolution-log"; | 74 static const String INCREMENTAL_RESOLUTION_LOG = "incremental-resolution-log"; |
| 68 | 75 |
| 69 /** | 76 /** |
| 70 * The name of the option used to enable instrumentation. | 77 * The name of the option used to enable instrumentation. |
| 71 */ | 78 */ |
| 72 static const String ENABLE_INSTRUMENTATION_OPTION = "enable-instrumentation"; | 79 static const String ENABLE_INSTRUMENTATION_OPTION = "enable-instrumentation"; |
| 73 | 80 |
| 74 /** | 81 /** |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 * Use the given command-line arguments to start this server. | 125 * Use the given command-line arguments to start this server. |
| 119 */ | 126 */ |
| 120 void start(List<String> args) { | 127 void start(List<String> args) { |
| 121 ArgParser parser = new ArgParser(); | 128 ArgParser parser = new ArgParser(); |
| 122 parser.addFlag( | 129 parser.addFlag( |
| 123 ENABLE_INCREMENTAL_RESOLUTION, | 130 ENABLE_INCREMENTAL_RESOLUTION, |
| 124 help: "enable using incremental resolution", | 131 help: "enable using incremental resolution", |
| 125 defaultsTo: false, | 132 defaultsTo: false, |
| 126 negatable: false); | 133 negatable: false); |
| 127 parser.addFlag( | 134 parser.addFlag( |
| 135 ENABLE_INCREMENTAL_RESOLUTION_API, |
| 136 help: "enable using incremental resolution for API changes", |
| 137 defaultsTo: false, |
| 138 negatable: false); |
| 139 parser.addFlag( |
| 128 ENABLE_INSTRUMENTATION_OPTION, | 140 ENABLE_INSTRUMENTATION_OPTION, |
| 129 help: "enable sending instrumentation information to a server", | 141 help: "enable sending instrumentation information to a server", |
| 130 defaultsTo: false, | 142 defaultsTo: false, |
| 131 negatable: false); | 143 negatable: false); |
| 132 parser.addFlag( | 144 parser.addFlag( |
| 133 HELP_OPTION, | 145 HELP_OPTION, |
| 134 help: "print this help message without starting a server", | 146 help: "print this help message without starting a server", |
| 135 defaultsTo: false, | 147 defaultsTo: false, |
| 136 negatable: false); | 148 negatable: false); |
| 137 parser.addOption( | 149 parser.addOption( |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 print(''); | 194 print(''); |
| 183 _printUsage(parser); | 195 _printUsage(parser); |
| 184 exitCode = 1; | 196 exitCode = 1; |
| 185 return; | 197 return; |
| 186 } | 198 } |
| 187 } | 199 } |
| 188 | 200 |
| 189 AnalysisServerOptions analysisServerOptions = new AnalysisServerOptions(); | 201 AnalysisServerOptions analysisServerOptions = new AnalysisServerOptions(); |
| 190 analysisServerOptions.enableIncrementalResolution = | 202 analysisServerOptions.enableIncrementalResolution = |
| 191 results[ENABLE_INCREMENTAL_RESOLUTION]; | 203 results[ENABLE_INCREMENTAL_RESOLUTION]; |
| 204 analysisServerOptions.enableIncrementalResolutionApi = |
| 205 results[ENABLE_INCREMENTAL_RESOLUTION_API]; |
| 192 | 206 |
| 193 _initIncrementalLogger(results[INCREMENTAL_RESOLUTION_LOG]); | 207 _initIncrementalLogger(results[INCREMENTAL_RESOLUTION_LOG]); |
| 194 | 208 |
| 195 DartSdk defaultSdk; | 209 DartSdk defaultSdk; |
| 196 if (results[SDK_OPTION] != null) { | 210 if (results[SDK_OPTION] != null) { |
| 197 defaultSdk = new DirectoryBasedDartSdk(new JavaFile(results[SDK_OPTION])); | 211 defaultSdk = new DirectoryBasedDartSdk(new JavaFile(results[SDK_OPTION])); |
| 198 } else { | 212 } else { |
| 199 // No path to the SDK provided; use DirectoryBasedDartSdk.defaultSdk, | 213 // No path to the SDK provided; use DirectoryBasedDartSdk.defaultSdk, |
| 200 // which will make a guess. | 214 // which will make a guess. |
| 201 defaultSdk = DirectoryBasedDartSdk.defaultSdk; | 215 defaultSdk = DirectoryBasedDartSdk.defaultSdk; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 /** | 259 /** |
| 246 * Print information about how to use the server. | 260 * Print information about how to use the server. |
| 247 */ | 261 */ |
| 248 void _printUsage(ArgParser parser) { | 262 void _printUsage(ArgParser parser) { |
| 249 print('Usage: $BINARY_NAME [flags]'); | 263 print('Usage: $BINARY_NAME [flags]'); |
| 250 print(''); | 264 print(''); |
| 251 print('Supported flags are:'); | 265 print('Supported flags are:'); |
| 252 print(parser.usage); | 266 print(parser.usage); |
| 253 } | 267 } |
| 254 } | 268 } |
| OLD | NEW |