Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Unified Diff: pkg/analysis_server/lib/src/server/driver.dart

Issue 795833005: Server clean-up (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/lib/http_server.dart ('k') | pkg/analysis_server/lib/src/server/http_server.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/server/driver.dart
diff --git a/pkg/analysis_server/lib/driver.dart b/pkg/analysis_server/lib/src/server/driver.dart
similarity index 94%
rename from pkg/analysis_server/lib/driver.dart
rename to pkg/analysis_server/lib/src/server/driver.dart
index 9018541abb828b538d3754162a5a4ba4aeea942b..18e1cefbfea50b235d80af8edb3d74624887d65c 100644
--- a/pkg/analysis_server/lib/driver.dart
+++ b/pkg/analysis_server/lib/src/server/driver.dart
@@ -7,13 +7,14 @@ library driver;
import 'dart:async';
import 'dart:io';
-import 'package:analysis_server/http_server.dart';
import 'package:analysis_server/plugin/plugin.dart';
import 'package:analysis_server/src/analysis_server.dart';
import 'package:analysis_server/src/plugin/plugin_impl.dart';
import 'package:analysis_server/src/plugin/server_plugin.dart';
+import 'package:analysis_server/src/server/http_server.dart';
+import 'package:analysis_server/src/server/stdio_server.dart';
import 'package:analysis_server/src/socket_server.dart';
-import 'package:analysis_server/stdio_server.dart';
+import 'package:analysis_server/starter.dart';
import 'package:analyzer/instrumentation/instrumentation.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/incremental_logger.dart';
@@ -54,7 +55,7 @@ void _initIncrementalLogger(String spec) {
* server application. It is responsible for parsing command line options
* and starting the HTTP and/or stdio servers.
*/
-class Driver {
+class Driver implements ServerStarter {
/**
* The name of the application that is used to start a server.
*/
@@ -144,53 +145,11 @@ class Driver {
}
/**
- * Use the given command-line arguments to start this server.
+ * Use the given command-line [arguments] to start this server.
*/
- void start(List<String> args) {
- ArgParser parser = new ArgParser();
- parser.addOption(
- CLIENT_ID,
- help: "an identifier used to identify the client");
- parser.addFlag(
- ENABLE_INCREMENTAL_RESOLUTION_API,
- help: "enable using incremental resolution for API changes",
- defaultsTo: false,
- negatable: false);
- parser.addFlag(
- ENABLE_INSTRUMENTATION_OPTION,
- help: "enable sending instrumentation information to a server",
- defaultsTo: false,
- negatable: false);
- parser.addFlag(
- HELP_OPTION,
- help: "print this help message without starting a server",
- defaultsTo: false,
- negatable: false);
- parser.addOption(
- INCREMENTAL_RESOLUTION_LOG,
- help: "the description of the incremental resolution log");
- parser.addFlag(
- INCREMENTAL_RESOLUTION_VALIDATION,
- help: "enable validation of incremental resolution results (slow)",
- defaultsTo: false,
- negatable: false);
- parser.addFlag(
- INTERNAL_PRINT_TO_CONSOLE,
- help: "enable sending `print` output to the console",
- defaultsTo: false,
- negatable: false);
- parser.addOption(
- PORT_OPTION,
- help: "[port] the port on which the server will listen");
- parser.addOption(SDK_OPTION, help: "[path] the path to the sdk");
- parser.addFlag(
- NO_ERROR_NOTIFICATION,
- help:
- "disable sending all analysis error notifications to the server (not yet implemented)",
- defaultsTo: false,
- negatable: false);
-
- ArgResults results = parser.parse(args);
+ void start(List<String> arguments) {
+ ArgParser parser = _createArgParser();
+ ArgResults results = parser.parse(arguments);
if (results[HELP_OPTION]) {
_printUsage(parser);
return;
@@ -310,6 +269,56 @@ class Driver {
}
/**
+ * Create and return the parser used to parse the command-line arguments.
+ */
+ ArgParser _createArgParser() {
+ ArgParser parser = new ArgParser();
+ parser.addOption(
+ CLIENT_ID,
+ help: "an identifier used to identify the client");
+ parser.addFlag(
+ ENABLE_INCREMENTAL_RESOLUTION_API,
+ help: "enable using incremental resolution for API changes",
+ defaultsTo: false,
+ negatable: false);
+ parser.addFlag(
+ ENABLE_INSTRUMENTATION_OPTION,
+ help: "enable sending instrumentation information to a server",
+ defaultsTo: false,
+ negatable: false);
+ parser.addFlag(
+ HELP_OPTION,
+ help: "print this help message without starting a server",
+ defaultsTo: false,
+ negatable: false);
+ parser.addOption(
+ INCREMENTAL_RESOLUTION_LOG,
+ help: "the description of the incremental resolution log");
+ parser.addFlag(
+ INCREMENTAL_RESOLUTION_VALIDATION,
+ help: "enable validation of incremental resolution results (slow)",
+ defaultsTo: false,
+ negatable: false);
+ parser.addFlag(
+ INTERNAL_PRINT_TO_CONSOLE,
+ help: "enable sending `print` output to the console",
+ defaultsTo: false,
+ negatable: false);
+ parser.addOption(
+ PORT_OPTION,
+ help: "[port] the port on which the server will listen");
+ parser.addOption(SDK_OPTION, help: "[path] the path to the sdk");
+ parser.addFlag(
+ NO_ERROR_NOTIFICATION,
+ help:
+ "disable sending all analysis error notifications to the server (not yet implemented)",
+ defaultsTo: false,
+ negatable: false);
+
+ return parser;
+ }
+
+ /**
* Print information about how to use the server.
*/
void _printUsage(ArgParser parser) {
« no previous file with comments | « pkg/analysis_server/lib/http_server.dart ('k') | pkg/analysis_server/lib/src/server/http_server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698