Unverified Commit 1affb423 authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

Remove the diagnostic server from flutter_tools (#12771)

parent 2e97ee40
...@@ -378,15 +378,12 @@ class AndroidDevice extends Device { ...@@ -378,15 +378,12 @@ class AndroidDevice extends Device {
printTrace('$this startApp'); printTrace('$this startApp');
ProtocolDiscovery observatoryDiscovery; ProtocolDiscovery observatoryDiscovery;
ProtocolDiscovery diagnosticDiscovery;
if (debuggingOptions.debuggingEnabled) { if (debuggingOptions.debuggingEnabled) {
// TODO(devoncarew): Remember the forwarding information (so we can later remove the // TODO(devoncarew): Remember the forwarding information (so we can later remove the
// port forwarding or set it up again when adb fails on us). // port forwarding or set it up again when adb fails on us).
observatoryDiscovery = new ProtocolDiscovery.observatory( observatoryDiscovery = new ProtocolDiscovery.observatory(
getLogReader(), portForwarder: portForwarder, hostPort: debuggingOptions.observatoryPort); getLogReader(), portForwarder: portForwarder, hostPort: debuggingOptions.observatoryPort);
diagnosticDiscovery = new ProtocolDiscovery.diagnosticService(
getLogReader(), portForwarder: portForwarder, hostPort: debuggingOptions.diagnosticPort);
} }
List<String> cmd; List<String> cmd;
...@@ -430,33 +427,20 @@ class AndroidDevice extends Device { ...@@ -430,33 +427,20 @@ class AndroidDevice extends Device {
// device has printed "Observatory is listening on...". // device has printed "Observatory is listening on...".
printTrace('Waiting for observatory port to be available...'); printTrace('Waiting for observatory port to be available...');
// TODO(danrubel) Waiting for observatory and diagnostic services // TODO(danrubel) Waiting for observatory services can be made common across all devices.
// can be made common across all devices.
try { try {
Uri observatoryUri, diagnosticUri; Uri observatoryUri;
if (debuggingOptions.buildInfo.isDebug) { if (debuggingOptions.buildInfo.isDebug || debuggingOptions.buildInfo.isProfile) {
final List<Uri> deviceUris = await Future.wait(
<Future<Uri>>[observatoryDiscovery.uri, diagnosticDiscovery.uri]
);
observatoryUri = deviceUris[0];
diagnosticUri = deviceUris[1];
} else if (debuggingOptions.buildInfo.isProfile) {
observatoryUri = await observatoryDiscovery.uri; observatoryUri = await observatoryDiscovery.uri;
} }
return new LaunchResult.succeeded( return new LaunchResult.succeeded(observatoryUri: observatoryUri);
observatoryUri: observatoryUri,
diagnosticUri: diagnosticUri,
);
} catch (error) { } catch (error) {
printError('Error waiting for a debug connection: $error'); printError('Error waiting for a debug connection: $error');
return new LaunchResult.failed(); return new LaunchResult.failed();
} finally { } finally {
await waitGroup<Null>(<Future<Null>>[ await observatoryDiscovery.cancel();
observatoryDiscovery.cancel(),
diagnosticDiscovery.cancel(),
]);
} }
} }
...@@ -519,7 +503,7 @@ class AndroidDevice extends Device { ...@@ -519,7 +503,7 @@ class AndroidDevice extends Device {
final Match match = discoverExp.firstMatch(line); final Match match = discoverExp.firstMatch(line);
if (match != null) { if (match != null) {
final Map<String, dynamic> app = JSON.decode(match.group(1)); final Map<String, dynamic> app = JSON.decode(match.group(1));
result.add(new DiscoveredApp(app['id'], app['observatoryPort'], app['diagnosticPort'])); result.add(new DiscoveredApp(app['id'], app['observatoryPort']));
} }
}); });
......
...@@ -6,7 +6,6 @@ import 'file_system.dart'; ...@@ -6,7 +6,6 @@ import 'file_system.dart';
import 'platform.dart'; import 'platform.dart';
const int kDefaultObservatoryPort = 8100; const int kDefaultObservatoryPort = 8100;
const int kDefaultDiagnosticPort = 8101;
/// Return the absolute path of the user's home directory /// Return the absolute path of the user's home directory
String get homeDirPath { String get homeDirPath {
......
...@@ -30,11 +30,11 @@ abstract class PortScanner { ...@@ -30,11 +30,11 @@ abstract class PortScanner {
/// If [defaultPort] is available, this will return it. Otherwise, it will /// If [defaultPort] is available, this will return it. Otherwise, it will
/// search for an avaiable port close to [defaultPort]. If it cannot find one, /// search for an avaiable port close to [defaultPort]. If it cannot find one,
/// it will return any available port. /// it will return any available port.
Future<int> findPreferredPort(int defaultPort, { int searchStep: 2 }) async { Future<int> findPreferredPort(int defaultPort) async {
int iterationCount = 0; int iterationCount = 0;
while (iterationCount < _kMaxSearchIterations) { while (iterationCount < _kMaxSearchIterations) {
final int port = defaultPort + iterationCount * searchStep; final int port = defaultPort + iterationCount;
if (await isPortAvailable(port)) if (await isPortAvailable(port))
return port; return port;
iterationCount++; iterationCount++;
......
...@@ -508,7 +508,6 @@ class AppDomain extends Domain { ...@@ -508,7 +508,6 @@ class AppDomain extends Domain {
return <String, dynamic>{ return <String, dynamic>{
'id': app.id, 'id': app.id,
'observatoryDevicePort': app.observatoryPort, 'observatoryDevicePort': app.observatoryPort,
'diagnosticDevicePort': app.diagnosticPort,
}; };
}).toList(); }).toList();
} }
......
...@@ -268,7 +268,6 @@ Future<LaunchResult> _startApp(DriveCommand command) async { ...@@ -268,7 +268,6 @@ Future<LaunchResult> _startApp(DriveCommand command) async {
command.getBuildInfo(), command.getBuildInfo(),
startPaused: true, startPaused: true,
observatoryPort: command.observatoryPort, observatoryPort: command.observatoryPort,
diagnosticPort: command.diagnosticPort,
), ),
platformArgs: platformArgs, platformArgs: platformArgs,
usesTerminalUi: false, usesTerminalUi: false,
......
...@@ -44,11 +44,6 @@ abstract class RunCommandBase extends FlutterCommand { ...@@ -44,11 +44,6 @@ abstract class RunCommandBase extends FlutterCommand {
'Specifying port 0 will find a random free port.\n' 'Specifying port 0 will find a random free port.\n'
'Defaults to the first available port after $kDefaultObservatoryPort.' 'Defaults to the first available port after $kDefaultObservatoryPort.'
); );
argParser.addOption('diagnostic-port',
help: 'Listen to the given port for a diagnostic connection.\n'
'Specifying port 0 will find a random free port.\n'
'Defaults to the first available port after $kDefaultDiagnosticPort.'
);
} }
int get observatoryPort { int get observatoryPort {
...@@ -61,17 +56,6 @@ abstract class RunCommandBase extends FlutterCommand { ...@@ -61,17 +56,6 @@ abstract class RunCommandBase extends FlutterCommand {
} }
return null; return null;
} }
int get diagnosticPort {
if (argResults['diagnostic-port'] != null) {
try {
return int.parse(argResults['diagnostic-port']);
} catch (error) {
throwToolExit('Invalid port for `--diagnostic-port`: $error');
}
}
return null;
}
} }
class RunCommand extends RunCommandBase { class RunCommand extends RunCommandBase {
...@@ -244,7 +228,6 @@ class RunCommand extends RunCommandBase { ...@@ -244,7 +228,6 @@ class RunCommand extends RunCommandBase {
enableSoftwareRendering: argResults['enable-software-rendering'], enableSoftwareRendering: argResults['enable-software-rendering'],
traceSkia: argResults['trace-skia'], traceSkia: argResults['trace-skia'],
observatoryPort: observatoryPort, observatoryPort: observatoryPort,
diagnosticPort: diagnosticPort,
); );
} }
} }
......
...@@ -3,20 +3,18 @@ ...@@ -3,20 +3,18 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async'; import 'dart:async';
import 'dart:convert';
import 'package:http/http.dart' as http;
import '../base/common.dart'; import '../base/common.dart';
import '../base/file_system.dart'; import '../base/file_system.dart';
import '../base/io.dart' hide IOSink;
import '../base/utils.dart'; import '../base/utils.dart';
import '../device.dart'; import '../device.dart';
import '../globals.dart'; import '../globals.dart';
import '../runner/flutter_command.dart'; import '../runner/flutter_command.dart';
import '../vmservice.dart';
const String _kOut = 'out'; const String _kOut = 'out';
const String _kSkia = 'skia'; const String _kSkia = 'skia';
const String _kSkiaServe = 'skiaserve';
class ScreenshotCommand extends FlutterCommand { class ScreenshotCommand extends FlutterCommand {
ScreenshotCommand() { ScreenshotCommand() {
...@@ -29,14 +27,9 @@ class ScreenshotCommand extends FlutterCommand { ...@@ -29,14 +27,9 @@ class ScreenshotCommand extends FlutterCommand {
_kSkia, _kSkia,
valueHelp: 'port', valueHelp: 'port',
help: 'Retrieve the last frame rendered by a Flutter app as a Skia picture\n' help: 'Retrieve the last frame rendered by a Flutter app as a Skia picture\n'
'using the specified diagnostic server port.\n' 'using the specified observatory port.\n'
'To find the diagnostic server port number, use "flutter run --verbose"\n' 'To find the observatory port number, use "flutter run --verbose"\n'
'and look for "Diagnostic server listening on" in the output.' 'and look for "Forwarded host port ... for Observatory" in the output.'
);
argParser.addOption(
_kSkiaServe,
valueHelp: 'url',
help: 'Post the picture to a skiaserve debugger at this URL.',
); );
} }
...@@ -53,18 +46,11 @@ class ScreenshotCommand extends FlutterCommand { ...@@ -53,18 +46,11 @@ class ScreenshotCommand extends FlutterCommand {
@override @override
Future<Null> verifyThenRunCommand() async { Future<Null> verifyThenRunCommand() async {
if (argResults[_kSkia] != null) { device = await findTargetDevice();
if (argResults[_kOut] != null && argResults[_kSkiaServe] != null) if (device == null)
throwToolExit('Cannot specify both --$_kOut and --$_kSkiaServe'); throwToolExit('Must have a connected device');
} else { if (!device.supportsScreenshot && argResults[_kSkia] == null)
if (argResults[_kSkiaServe] != null) throwToolExit('Screenshot not supported for ${device.name}.');
throwToolExit('Must specify --$_kSkia with --$_kSkiaServe');
device = await findTargetDevice();
if (device == null)
throwToolExit('Must specify --$_kSkia or have a connected device');
if (!device.supportsScreenshot && argResults[_kSkia] == null)
throwToolExit('Screenshot not supported for ${device.name}.');
}
return super.verifyThenRunCommand(); return super.verifyThenRunCommand();
} }
...@@ -92,47 +78,20 @@ class ScreenshotCommand extends FlutterCommand { ...@@ -92,47 +78,20 @@ class ScreenshotCommand extends FlutterCommand {
} }
Future<Null> runSkia(File outputFile) async { Future<Null> runSkia(File outputFile) async {
final Uri skpUri = new Uri(scheme: 'http', host: '127.0.0.1', final Uri observatoryUri = new Uri(scheme: 'http', host: '127.0.0.1',
port: int.parse(argResults[_kSkia]), port: int.parse(argResults[_kSkia]));
path: '/skp'); final VMService vmService = VMService.connect(observatoryUri);
final Map<String, dynamic> skp = await vmService.vm.invokeRpcRaw('_flutter.screenshotSkp');
const String errorHelpText =
'Be sure the --$_kSkia= option specifies the diagnostic server port, not the observatory port.\n' outputFile ??= getUniqueFile(fs.currentDirectory, 'flutter', 'skp');
'To find the diagnostic server port number, use "flutter run --verbose"\n' final IOSink sink = outputFile.openWrite();
'and look for "Diagnostic server listening on" in the output.'; sink.add(BASE64.decode(skp['skp']));
await sink.close();
http.StreamedResponse skpResponse; await showOutputFileInfo(outputFile);
try { if (await outputFile.length() < 1000) {
skpResponse = await new http.Request('GET', skpUri).send(); final String content = await outputFile.readAsString();
} on SocketException catch (e) { if (content.startsWith('{"jsonrpc":"2.0", "error"'))
throwToolExit('Skia screenshot failed: $skpUri\n$e\n\n$errorHelpText'); throwToolExit('\nIt appears the output file contains an error message, not valid skia output.');
}
if (skpResponse.statusCode != HttpStatus.OK) {
final String error = await skpResponse.stream.toStringStream().join();
throwToolExit('Error: $error\n\n$errorHelpText');
}
if (argResults[_kSkiaServe] != null) {
final Uri skiaserveUri = Uri.parse(argResults[_kSkiaServe]);
final Uri postUri = new Uri.http(skiaserveUri.authority, '/new');
final http.MultipartRequest postRequest = new http.MultipartRequest('POST', postUri);
postRequest.files.add(new http.MultipartFile(
'file', skpResponse.stream, skpResponse.contentLength));
final http.StreamedResponse postResponse = await postRequest.send();
if (postResponse.statusCode != HttpStatus.OK)
throwToolExit('Failed to post Skia picture to skiaserve.\n\n$errorHelpText');
} else {
outputFile ??= getUniqueFile(fs.currentDirectory, 'flutter', 'skp');
final IOSink sink = outputFile.openWrite();
await sink.addStream(skpResponse.stream);
await sink.close();
await showOutputFileInfo(outputFile);
if (await outputFile.length() < 1000) {
final String content = await outputFile.readAsString();
if (content.startsWith('{"jsonrpc":"2.0", "error"'))
throwToolExit('\nIt appears the output file contains an error message, not valid skia output.\n\n$errorHelpText');
}
} }
} }
......
...@@ -320,7 +320,6 @@ class DebuggingOptions { ...@@ -320,7 +320,6 @@ class DebuggingOptions {
this.traceSkia: false, this.traceSkia: false,
this.useTestFonts: false, this.useTestFonts: false,
this.observatoryPort, this.observatoryPort,
this.diagnosticPort
}) : debuggingEnabled = true; }) : debuggingEnabled = true;
DebuggingOptions.disabled(this.buildInfo) : DebuggingOptions.disabled(this.buildInfo) :
...@@ -329,8 +328,7 @@ class DebuggingOptions { ...@@ -329,8 +328,7 @@ class DebuggingOptions {
startPaused = false, startPaused = false,
enableSoftwareRendering = false, enableSoftwareRendering = false,
traceSkia = false, traceSkia = false,
observatoryPort = null, observatoryPort = null;
diagnosticPort = null;
final bool debuggingEnabled; final bool debuggingEnabled;
...@@ -340,7 +338,6 @@ class DebuggingOptions { ...@@ -340,7 +338,6 @@ class DebuggingOptions {
final bool traceSkia; final bool traceSkia;
final bool useTestFonts; final bool useTestFonts;
final int observatoryPort; final int observatoryPort;
final int diagnosticPort;
bool get hasObservatoryPort => observatoryPort != null; bool get hasObservatoryPort => observatoryPort != null;
...@@ -351,35 +348,22 @@ class DebuggingOptions { ...@@ -351,35 +348,22 @@ class DebuggingOptions {
return new Future<int>.value(observatoryPort); return new Future<int>.value(observatoryPort);
return portScanner.findPreferredPort(observatoryPort ?? kDefaultObservatoryPort); return portScanner.findPreferredPort(observatoryPort ?? kDefaultObservatoryPort);
} }
bool get hasDiagnosticPort => diagnosticPort != null;
/// Return the user specified diagnostic port. If that isn't available,
/// return [kDefaultDiagnosticPort], or a port close to that one.
Future<int> findBestDiagnosticPort() {
if (hasDiagnosticPort)
return new Future<int>.value(diagnosticPort);
return portScanner.findPreferredPort(diagnosticPort ?? kDefaultDiagnosticPort);
}
} }
class LaunchResult { class LaunchResult {
LaunchResult.succeeded({ this.observatoryUri, this.diagnosticUri }) : started = true; LaunchResult.succeeded({ this.observatoryUri }) : started = true;
LaunchResult.failed() : started = false, observatoryUri = null, diagnosticUri = null; LaunchResult.failed() : started = false, observatoryUri = null;
bool get hasObservatory => observatoryUri != null; bool get hasObservatory => observatoryUri != null;
final bool started; final bool started;
final Uri observatoryUri; final Uri observatoryUri;
final Uri diagnosticUri;
@override @override
String toString() { String toString() {
final StringBuffer buf = new StringBuffer('started=$started'); final StringBuffer buf = new StringBuffer('started=$started');
if (observatoryUri != null) if (observatoryUri != null)
buf.write(', observatory=$observatoryUri'); buf.write(', observatory=$observatoryUri');
if (diagnosticUri != null)
buf.write(', diagnostic=$diagnosticUri');
return buf.toString(); return buf.toString();
} }
} }
...@@ -427,8 +411,7 @@ abstract class DeviceLogReader { ...@@ -427,8 +411,7 @@ abstract class DeviceLogReader {
/// Describes an app running on the device. /// Describes an app running on the device.
class DiscoveredApp { class DiscoveredApp {
DiscoveredApp(this.id, this.observatoryPort, this.diagnosticPort); DiscoveredApp(this.id, this.observatoryPort);
final String id; final String id;
final int observatoryPort; final int observatoryPort;
final int diagnosticPort;
} }
...@@ -238,51 +238,37 @@ class IOSDevice extends Device { ...@@ -238,51 +238,37 @@ class IOSDevice extends Device {
int installationResult = -1; int installationResult = -1;
Uri localObservatoryUri; Uri localObservatoryUri;
Uri localDiagnosticUri;
if (!debuggingOptions.debuggingEnabled) { if (!debuggingOptions.debuggingEnabled) {
// If debugging is not enabled, just launch the application and continue. // If debugging is not enabled, just launch the application and continue.
printTrace('Debugging is not enabled'); printTrace('Debugging is not enabled');
installationResult = await runCommandAndStreamOutput(launchCommand, trace: true); installationResult = await runCommandAndStreamOutput(launchCommand, trace: true);
} else { } else {
// Debugging is enabled, look for the observatory and diagnostic server // Debugging is enabled, look for the observatory server port post launch.
// ports post launch. printTrace('Debugging is enabled, connecting to observatory');
printTrace('Debugging is enabled, connecting to observatory and the diagnostic server');
// TODO(danrubel): The Android device class does something similar to this code below. // TODO(danrubel): The Android device class does something similar to this code below.
// The various Device subclasses should be refactored and common code moved into the superclass. // The various Device subclasses should be refactored and common code moved into the superclass.
final ProtocolDiscovery observatoryDiscovery = new ProtocolDiscovery.observatory( final ProtocolDiscovery observatoryDiscovery = new ProtocolDiscovery.observatory(
getLogReader(app: app), portForwarder: portForwarder, hostPort: debuggingOptions.observatoryPort); getLogReader(app: app), portForwarder: portForwarder, hostPort: debuggingOptions.observatoryPort);
final ProtocolDiscovery diagnosticDiscovery = new ProtocolDiscovery.diagnosticService(
getLogReader(app: app), portForwarder: portForwarder, hostPort: debuggingOptions.diagnosticPort);
final Future<Uri> forwardObservatoryUri = observatoryDiscovery.uri; final Future<Uri> forwardObservatoryUri = observatoryDiscovery.uri;
Future<Uri> forwardDiagnosticUri;
if (debuggingOptions.buildInfo.isDebug) {
forwardDiagnosticUri = diagnosticDiscovery.uri;
} else {
forwardDiagnosticUri = new Future<Uri>.value(null);
}
final Future<int> launch = runCommandAndStreamOutput(launchCommand, trace: true); final Future<int> launch = runCommandAndStreamOutput(launchCommand, trace: true);
final List<Uri> uris = await launch.then<List<Uri>>((int result) async { localObservatoryUri = await launch.then<Uri>((int result) async {
installationResult = result; installationResult = result;
if (result != 0) { if (result != 0) {
printTrace('Failed to launch the application on device.'); printTrace('Failed to launch the application on device.');
return <Uri>[null, null]; return null;
} }
printTrace('Application launched on the device. Attempting to forward ports.'); printTrace('Application launched on the device. Attempting to forward ports.');
return await Future.wait(<Future<Uri>>[forwardObservatoryUri, forwardDiagnosticUri]); return await forwardObservatoryUri;
}).whenComplete(() { }).whenComplete(() {
observatoryDiscovery.cancel(); observatoryDiscovery.cancel();
diagnosticDiscovery.cancel();
}); });
localObservatoryUri = uris[0];
localDiagnosticUri = uris[1];
} }
if (installationResult != 0) { if (installationResult != 0) {
...@@ -293,7 +279,7 @@ class IOSDevice extends Device { ...@@ -293,7 +279,7 @@ class IOSDevice extends Device {
return new LaunchResult.failed(); return new LaunchResult.failed();
} }
return new LaunchResult.succeeded(observatoryUri: localObservatoryUri, diagnosticUri: localDiagnosticUri); return new LaunchResult.succeeded(observatoryUri: localObservatoryUri);
} }
@override @override
......
...@@ -351,8 +351,6 @@ class IOSSimulator extends Device { ...@@ -351,8 +351,6 @@ class IOSSimulator extends Device {
final int observatoryPort = await debuggingOptions.findBestObservatoryPort(); final int observatoryPort = await debuggingOptions.findBestObservatoryPort();
args.add('--observatory-port=$observatoryPort'); args.add('--observatory-port=$observatoryPort');
final int diagnosticPort = await debuggingOptions.findBestDiagnosticPort();
args.add('--diagnostic-port=$diagnosticPort');
} }
ProtocolDiscovery observatoryDiscovery; ProtocolDiscovery observatoryDiscovery;
......
...@@ -38,20 +38,6 @@ class ProtocolDiscovery { ...@@ -38,20 +38,6 @@ class ProtocolDiscovery {
); );
} }
factory ProtocolDiscovery.diagnosticService(
DeviceLogReader logReader, {
DevicePortForwarder portForwarder,
int hostPort,
}) {
const String kDiagnosticService = 'Diagnostic server';
return new ProtocolDiscovery._(
logReader, kDiagnosticService,
portForwarder: portForwarder,
hostPort: hostPort,
defaultHostPort: kDefaultDiagnosticPort,
);
}
final DeviceLogReader logReader; final DeviceLogReader logReader;
final String serviceName; final String serviceName;
final DevicePortForwarder portForwarder; final DevicePortForwarder portForwarder;
......
...@@ -217,8 +217,7 @@ class FlutterDevice { ...@@ -217,8 +217,7 @@ class FlutterDevice {
if (_loggingSubscription != null) if (_loggingSubscription != null)
return; return;
_loggingSubscription = device.getLogReader(app: package).logLines.listen((String line) { _loggingSubscription = device.getLogReader(app: package).logLines.listen((String line) {
if (!line.contains('Observatory listening on http') && if (!line.contains('Observatory listening on http'))
!line.contains('Diagnostic server listening on http'))
printStatus(line); printStatus(line);
}); });
} }
......
...@@ -49,7 +49,7 @@ final Map<InternetAddressType, InternetAddress> _kHosts = <InternetAddressType, ...@@ -49,7 +49,7 @@ final Map<InternetAddressType, InternetAddress> _kHosts = <InternetAddressType,
/// ///
/// On systems where each [_FlutterPlatform] is only used to run one test suite /// On systems where each [_FlutterPlatform] is only used to run one test suite
/// (that is, one Dart file with a `*_test.dart` file name and a single `void /// (that is, one Dart file with a `*_test.dart` file name and a single `void
/// main()`), you can set an observatory port and a diagnostic port explicitly. /// main()`), you can set an observatory port explicitly.
void installHook({ void installHook({
@required String shellPath, @required String shellPath,
TestWatcher watcher, TestWatcher watcher,
...@@ -57,10 +57,9 @@ void installHook({ ...@@ -57,10 +57,9 @@ void installHook({
bool machine: false, bool machine: false,
bool startPaused: false, bool startPaused: false,
int observatoryPort, int observatoryPort,
int diagnosticPort,
InternetAddressType serverType: InternetAddressType.IP_V4, InternetAddressType serverType: InternetAddressType.IP_V4,
}) { }) {
if (startPaused || observatoryPort != null || diagnosticPort != null) if (startPaused || observatoryPort != null)
assert(enableObservatory); assert(enableObservatory);
hack.registerPlatformPlugin( hack.registerPlatformPlugin(
<TestPlatform>[TestPlatform.vm], <TestPlatform>[TestPlatform.vm],
...@@ -71,7 +70,6 @@ void installHook({ ...@@ -71,7 +70,6 @@ void installHook({
enableObservatory: enableObservatory, enableObservatory: enableObservatory,
startPaused: startPaused, startPaused: startPaused,
explicitObservatoryPort: observatoryPort, explicitObservatoryPort: observatoryPort,
explicitDiagnosticPort: diagnosticPort,
host: _kHosts[serverType], host: _kHosts[serverType],
), ),
); );
...@@ -89,7 +87,6 @@ class _FlutterPlatform extends PlatformPlugin { ...@@ -89,7 +87,6 @@ class _FlutterPlatform extends PlatformPlugin {
this.machine, this.machine,
this.startPaused, this.startPaused,
this.explicitObservatoryPort, this.explicitObservatoryPort,
this.explicitDiagnosticPort,
this.host, this.host,
}) { }) {
assert(shellPath != null); assert(shellPath != null);
...@@ -101,7 +98,6 @@ class _FlutterPlatform extends PlatformPlugin { ...@@ -101,7 +98,6 @@ class _FlutterPlatform extends PlatformPlugin {
final bool machine; final bool machine;
final bool startPaused; final bool startPaused;
final int explicitObservatoryPort; final int explicitObservatoryPort;
final int explicitDiagnosticPort;
final InternetAddress host; final InternetAddress host;
// Each time loadChannel() is called, we spin up a local WebSocket server, // Each time loadChannel() is called, we spin up a local WebSocket server,
...@@ -116,9 +112,9 @@ class _FlutterPlatform extends PlatformPlugin { ...@@ -116,9 +112,9 @@ class _FlutterPlatform extends PlatformPlugin {
@override @override
StreamChannel<dynamic> loadChannel(String testPath, TestPlatform platform) { StreamChannel<dynamic> loadChannel(String testPath, TestPlatform platform) {
// Fail if there will be a port conflict. // Fail if there will be a port conflict.
if (explicitObservatoryPort != null || explicitDiagnosticPort != null) { if (explicitObservatoryPort != null) {
if (_testCount > 0) if (_testCount > 0)
throwToolExit('installHook() was called with an observatory port, a diagnostic port, both, or debugger mode enabled, but then more than one test suite was run.'); throwToolExit('installHook() was called with an observatory port or debugger mode enabled, but then more than one test suite was run.');
} }
final int ourTestCount = _testCount; final int ourTestCount = _testCount;
_testCount += 1; _testCount += 1;
...@@ -205,7 +201,6 @@ class _FlutterPlatform extends PlatformPlugin { ...@@ -205,7 +201,6 @@ class _FlutterPlatform extends PlatformPlugin {
enableObservatory: enableObservatory, enableObservatory: enableObservatory,
startPaused: startPaused, startPaused: startPaused,
observatoryPort: explicitObservatoryPort, observatoryPort: explicitObservatoryPort,
diagnosticPort: explicitDiagnosticPort,
); );
subprocessActive = true; subprocessActive = true;
finalizers.add(() async { finalizers.add(() async {
...@@ -473,7 +468,6 @@ void main() { ...@@ -473,7 +468,6 @@ void main() {
bool enableObservatory: false, bool enableObservatory: false,
bool startPaused: false, bool startPaused: false,
int observatoryPort, int observatoryPort,
int diagnosticPort,
}) { }) {
assert(executable != null); // Please provide the path to the shell in the SKY_SHELL environment variable. assert(executable != null); // Please provide the path to the shell in the SKY_SHELL environment variable.
assert(!startPaused || enableObservatory); assert(!startPaused || enableObservatory);
...@@ -490,12 +484,10 @@ void main() { ...@@ -490,12 +484,10 @@ void main() {
// the obvious simplification to this code and remove this entire feature. // the obvious simplification to this code and remove this entire feature.
if (observatoryPort != null) if (observatoryPort != null)
command.add('--observatory-port=$observatoryPort'); command.add('--observatory-port=$observatoryPort');
if (diagnosticPort != null)
command.add('--diagnostic-port=$diagnosticPort');
if (startPaused) if (startPaused)
command.add('--start-paused'); command.add('--start-paused');
} else { } else {
command.addAll(<String>['--disable-observatory', '--disable-diagnostic']); command.add('--disable-observatory');
} }
if (host.type == InternetAddressType.IP_V6) if (host.type == InternetAddressType.IP_V6)
command.add('--ipv6'); command.add('--ipv6');
...@@ -521,7 +513,6 @@ void main() { ...@@ -521,7 +513,6 @@ void main() {
void reportObservatoryUri(Uri uri), void reportObservatoryUri(Uri uri),
}) { }) {
final String observatoryString = 'Observatory listening on '; final String observatoryString = 'Observatory listening on ';
final String diagnosticServerString = 'Diagnostic server listening on ';
for (Stream<List<int>> stream in for (Stream<List<int>> stream in
<Stream<List<int>>>[process.stderr, process.stdout]) { <Stream<List<int>>>[process.stderr, process.stdout]) {
...@@ -544,8 +535,6 @@ void main() { ...@@ -544,8 +535,6 @@ void main() {
} catch (error) { } catch (error) {
printError('Could not parse shell observatory port message: $error'); printError('Could not parse shell observatory port message: $error');
} }
} else if (line.startsWith(diagnosticServerString)) {
printTrace('Shell: $line');
} else if (line != null) { } else if (line != null) {
printStatus('Shell: $line'); printStatus('Shell: $line');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment