Files
sdk/pkg/test_runner/bin/http_server.dart
T
Robert Nystrom c1b56a9ea0 Catch the test_runner codebase up to somewhat modern practices.
- Run dartfmt --fix. This converts JavaDoc comments to "///", removes
  "new" and extraneous "const", and a couple of other things.
- Fix SCREAMING_CAPS constants to lowerCamelCase.
- Use collection literals where possible.
- Use UI-as-code in a couple of places where it seemed obvious.
- Use "var" for more local variables.
- Use "const" instead of "final" when possible.
- Make members private when possible. Deleted a few that then became
  obviously unused.
- ".length > 0" -> ".isNotEmpty".

There are no meaningful changes.

Change-Id: Ic6c5a74b2af9b3ebcbe881dbed69f65488bdef09
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105880
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2019-06-15 01:02:50 +00:00

54 lines
2.1 KiB
Dart

// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:test_runner/src/configuration.dart';
import 'package:test_runner/src/testing_servers.dart';
import 'package:test_runner/src/utils.dart';
import 'package:test_runner/src/vendored_pkg/args/args.dart';
void main(List<String> arguments) {
var parser = ArgParser();
parser.addOption('port',
abbr: 'p',
help: 'The main server port we wish to respond to requests.',
defaultsTo: '0');
parser.addOption('crossOriginPort',
abbr: 'c',
help: 'A different port that accepts request from the main server port.',
defaultsTo: '0');
parser.addFlag('help',
abbr: 'h', negatable: false, help: 'Print this usage information.');
parser.addOption('build-directory', help: 'The build directory to use.');
parser.addOption('package-root', help: 'The package root to use.');
parser.addOption('packages', help: 'The package spec file to use.');
parser.addOption('network',
help: 'The network interface to use.', defaultsTo: '0.0.0.0');
parser.addFlag('csp',
help: 'Use Content Security Policy restrictions.', defaultsTo: false);
parser.addOption('runtime',
help: 'The runtime we are using (for csp flags).', defaultsTo: 'none');
var args = parser.parse(arguments);
if (args['help'] as bool) {
print(parser.getUsage());
} else {
var servers = TestingServers(
args['build-directory'] as String,
args['csp'] as bool,
Runtime.find(args['runtime'] as String),
null,
args['package-root'] as String,
args['packages'] as String);
var port = int.parse(args['port'] as String);
var crossOriginPort = int.parse(args['crossOriginPort'] as String);
servers
.startServers(args['network'] as String,
port: port, crossOriginPort: crossOriginPort)
.then((_) {
DebugLogger.info('Server listening on port ${servers.port}');
DebugLogger.info('Server listening on port ${servers.crossOriginPort}');
});
}
}