Chromium Code Reviews| 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 16 matching lines...) Expand all Loading... | |
| 27 */ | 27 */ |
| 28 static const BINARY_NAME = "server"; | 28 static const BINARY_NAME = "server"; |
| 29 | 29 |
| 30 /** | 30 /** |
| 31 * The name of the option used to enable incremental resolution. | 31 * The name of the option used to enable incremental resolution. |
| 32 */ | 32 */ |
| 33 static const String ENABLE_INCREMENTAL_RESOLUTION = | 33 static const String ENABLE_INCREMENTAL_RESOLUTION = |
| 34 "enable-incremental-resolution"; | 34 "enable-incremental-resolution"; |
| 35 | 35 |
| 36 /** | 36 /** |
| 37 * The name of the option used to describe the incremental resolution logger. | |
| 38 */ | |
| 39 static const String INCREMENTAL_RESOLUTION_LOG = "incremental-resolution-log"; | |
| 40 | |
| 41 /** | |
| 37 * The name of the option used to enable instrumentation. | 42 * The name of the option used to enable instrumentation. |
| 38 */ | 43 */ |
| 39 static const String ENABLE_INSTRUMENTATION_OPTION = "enable-instrumentation"; | 44 static const String ENABLE_INSTRUMENTATION_OPTION = "enable-instrumentation"; |
| 40 | 45 |
| 41 /** | 46 /** |
| 42 * The name of the option used to print usage information. | 47 * The name of the option used to print usage information. |
| 43 */ | 48 */ |
| 44 static const String HELP_OPTION = "help"; | 49 static const String HELP_OPTION = "help"; |
| 45 | 50 |
| 46 /** | 51 /** |
| 47 * The name of the option used to specify the log file to which | 52 * The name of the option used to specify the log file to which |
| 48 * instrumentation data is to be written. | 53 * instrumentation data is to be written. |
| 49 */ | 54 */ |
| 50 static const String INSTRUMENTATION_LOG_FILE_OPTION = | 55 static const String INSTRUMENTATION_LOG_FILE_OPTION = |
| 51 "instrumentation-log-file"; | 56 "instrumentation-log-file"; |
| 52 | 57 |
| 53 /** | 58 /** |
| 54 * The name of the option used to specify if [print] should print to the | 59 * The name of the option used to specify if [print] should print to the |
| 55 * console instead of being intercepted. | 60 * console instead of being intercepted. |
| 56 */ | 61 */ |
| 57 static const String INTERNAL_PRINT_TO_CONSOLE = | 62 static const String INTERNAL_PRINT_TO_CONSOLE = "internal-print-to-console"; |
| 58 "internal-print-to-console"; | |
| 59 | 63 |
| 60 /** | 64 /** |
| 61 * The name of the option used to specify the port to which the server will | 65 * The name of the option used to specify the port to which the server will |
| 62 * connect. | 66 * connect. |
| 63 */ | 67 */ |
| 64 static const String PORT_OPTION = "port"; | 68 static const String PORT_OPTION = "port"; |
| 65 | 69 |
| 66 /** | 70 /** |
| 67 * The path to the SDK. | 71 * The path to the SDK. |
| 68 * TODO(paulberry): get rid of this once the 'analysis.updateSdks' request is | 72 * TODO(paulberry): get rid of this once the 'analysis.updateSdks' request is |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 96 ENABLE_INSTRUMENTATION_OPTION, | 100 ENABLE_INSTRUMENTATION_OPTION, |
| 97 help: "enable sending instrumentation information to a server", | 101 help: "enable sending instrumentation information to a server", |
| 98 defaultsTo: false, | 102 defaultsTo: false, |
| 99 negatable: false); | 103 negatable: false); |
| 100 parser.addFlag( | 104 parser.addFlag( |
| 101 HELP_OPTION, | 105 HELP_OPTION, |
| 102 help: "print this help message without starting a server", | 106 help: "print this help message without starting a server", |
| 103 defaultsTo: false, | 107 defaultsTo: false, |
| 104 negatable: false); | 108 negatable: false); |
| 105 parser.addOption( | 109 parser.addOption( |
| 110 INCREMENTAL_RESOLUTION_LOG, | |
| 111 help: "the description of the incremental resolition log"); | |
|
Brian Wilkerson
2014/12/03 15:05:17
"resolition" --> "resolution"
| |
| 112 parser.addOption( | |
| 106 INSTRUMENTATION_LOG_FILE_OPTION, | 113 INSTRUMENTATION_LOG_FILE_OPTION, |
| 107 help: "[path] the file to which instrumentation data will be logged"); | 114 help: "[path] the file to which instrumentation data will be logged"); |
| 108 parser.addFlag( | 115 parser.addFlag( |
| 109 INTERNAL_PRINT_TO_CONSOLE, | 116 INTERNAL_PRINT_TO_CONSOLE, |
| 110 help: "enable sending `print` output to the console", | 117 help: "enable sending `print` output to the console", |
| 111 defaultsTo: false, | 118 defaultsTo: false, |
| 112 negatable: false); | 119 negatable: false); |
| 113 parser.addOption( | 120 parser.addOption( |
| 114 PORT_OPTION, | 121 PORT_OPTION, |
| 115 help: "[port] the port on which the server will listen"); | 122 help: "[port] the port on which the server will listen"); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 print(''); | 154 print(''); |
| 148 _printUsage(parser); | 155 _printUsage(parser); |
| 149 exitCode = 1; | 156 exitCode = 1; |
| 150 return; | 157 return; |
| 151 } | 158 } |
| 152 } | 159 } |
| 153 | 160 |
| 154 AnalysisServerOptions analysisServerOptions = new AnalysisServerOptions(); | 161 AnalysisServerOptions analysisServerOptions = new AnalysisServerOptions(); |
| 155 analysisServerOptions.enableIncrementalResolution = | 162 analysisServerOptions.enableIncrementalResolution = |
| 156 results[ENABLE_INCREMENTAL_RESOLUTION]; | 163 results[ENABLE_INCREMENTAL_RESOLUTION]; |
| 164 analysisServerOptions.incrementalResolutionLog = | |
| 165 results[INCREMENTAL_RESOLUTION_LOG]; | |
| 166 print(results[INCREMENTAL_RESOLUTION_LOG]); | |
| 157 | 167 |
| 158 DartSdk defaultSdk; | 168 DartSdk defaultSdk; |
| 159 if (results[SDK_OPTION] != null) { | 169 if (results[SDK_OPTION] != null) { |
| 160 defaultSdk = new DirectoryBasedDartSdk(new JavaFile(results[SDK_OPTION])); | 170 defaultSdk = new DirectoryBasedDartSdk(new JavaFile(results[SDK_OPTION])); |
| 161 } else { | 171 } else { |
| 162 // No path to the SDK provided; use DirectoryBasedDartSdk.defaultSdk, | 172 // No path to the SDK provided; use DirectoryBasedDartSdk.defaultSdk, |
| 163 // which will make a guess. | 173 // which will make a guess. |
| 164 defaultSdk = DirectoryBasedDartSdk.defaultSdk; | 174 defaultSdk = DirectoryBasedDartSdk.defaultSdk; |
| 165 } | 175 } |
| 166 | 176 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 208 /** | 218 /** |
| 209 * Print information about how to use the server. | 219 * Print information about how to use the server. |
| 210 */ | 220 */ |
| 211 void _printUsage(ArgParser parser) { | 221 void _printUsage(ArgParser parser) { |
| 212 print('Usage: $BINARY_NAME [flags]'); | 222 print('Usage: $BINARY_NAME [flags]'); |
| 213 print(''); | 223 print(''); |
| 214 print('Supported flags are:'); | 224 print('Supported flags are:'); |
| 215 print(parser.usage); | 225 print(parser.usage); |
| 216 } | 226 } |
| 217 } | 227 } |
| OLD | NEW |