Remove references to Observatory (#118577)
Observatory is being deprecated for Dart 3.0 so it should no longer be referenced in tooling messaging / flags. See https://github.com/dart-lang/sdk/issues/50233
This commit is contained in:
@@ -139,8 +139,8 @@ abstract class FlutterCommand extends Command<void> {
|
||||
/// Will be `null` until the top-most command has begun execution.
|
||||
static FlutterCommand? get current => context.get<FlutterCommand>();
|
||||
|
||||
/// The option name for a custom observatory port.
|
||||
static const String observatoryPortOption = 'observatory-port';
|
||||
/// The option name for a custom VM Service port.
|
||||
static const String vmServicePortOption = 'vm-service-port';
|
||||
|
||||
/// The option name for a custom DevTools server address.
|
||||
static const String kDevToolsServerAddress = 'devtools-server-address';
|
||||
@@ -379,14 +379,15 @@ abstract class FlutterCommand extends Command<void> {
|
||||
);
|
||||
}
|
||||
|
||||
/// Adds options for connecting to the Dart VM observatory port.
|
||||
/// Adds options for connecting to the Dart VM Service port.
|
||||
void usesPortOptions({ required bool verboseHelp }) {
|
||||
argParser.addOption(observatoryPortOption,
|
||||
argParser.addOption(vmServicePortOption,
|
||||
aliases: const <String>['observatory-port'],
|
||||
help: '(deprecated; use host-vmservice-port instead) '
|
||||
'Listen to the given port for an observatory debugger connection.\n'
|
||||
'Listen to the given port for a Dart VM Service connection.\n'
|
||||
'Specifying port 0 (the default) will find a random free port.\n '
|
||||
'if the Dart Development Service (DDS) is enabled, this will not be the port '
|
||||
'of the Observatory instance advertised on the command line.',
|
||||
'of the VmService instance advertised on the command line.',
|
||||
hide: !verboseHelp,
|
||||
);
|
||||
argParser.addOption('device-vmservice-port',
|
||||
@@ -490,19 +491,19 @@ abstract class FlutterCommand extends Command<void> {
|
||||
return ddsEnabled;
|
||||
}();
|
||||
|
||||
bool get _hostVmServicePortProvided => (argResults?.wasParsed('observatory-port') ?? false)
|
||||
bool get _hostVmServicePortProvided => (argResults?.wasParsed('vm-service-port') ?? false)
|
||||
|| (argResults?.wasParsed('host-vmservice-port') ?? false);
|
||||
|
||||
int _tryParseHostVmservicePort() {
|
||||
final String? observatoryPort = stringArgDeprecated('observatory-port');
|
||||
final String? vmServicePort = stringArgDeprecated('vm-service-port');
|
||||
final String? hostPort = stringArgDeprecated('host-vmservice-port');
|
||||
if (observatoryPort == null && hostPort == null) {
|
||||
throwToolExit('Invalid port for `--observatory-port/--host-vmservice-port`');
|
||||
if (vmServicePort == null && hostPort == null) {
|
||||
throwToolExit('Invalid port for `--vm-service-port/--host-vmservice-port`');
|
||||
}
|
||||
try {
|
||||
return int.parse((observatoryPort ?? hostPort)!);
|
||||
return int.parse((vmServicePort ?? hostPort)!);
|
||||
} on FormatException catch (error) {
|
||||
throwToolExit('Invalid port for `--observatory-port/--host-vmservice-port`: $error');
|
||||
throwToolExit('Invalid port for `--vm-service-port/--host-vmservice-port`: $error');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -528,10 +529,10 @@ abstract class FlutterCommand extends Command<void> {
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Gets the vmservice port provided to in the 'observatory-port' or
|
||||
/// Gets the vmservice port provided to in the 'vm-service-port' or
|
||||
/// 'host-vmservice-port option.
|
||||
///
|
||||
/// Only one of "host-vmservice-port" and "observatory-port" may be
|
||||
/// Only one of "host-vmservice-port" and "vm-service-port" may be
|
||||
/// specified.
|
||||
///
|
||||
/// If no port is set, returns null.
|
||||
@@ -539,9 +540,9 @@ abstract class FlutterCommand extends Command<void> {
|
||||
if (!_usesPortOption || !_hostVmServicePortProvided) {
|
||||
return null;
|
||||
}
|
||||
if ((argResults?.wasParsed('observatory-port') ?? false)
|
||||
if ((argResults?.wasParsed('vm-service-port') ?? false)
|
||||
&& (argResults?.wasParsed('host-vmservice-port') ?? false)) {
|
||||
throwToolExit('Only one of "--observatory-port" and '
|
||||
throwToolExit('Only one of "--vm-service-port" and '
|
||||
'"--host-vmservice-port" may be specified.');
|
||||
}
|
||||
// If DDS is enabled and no explicit DDS port is provided, use the
|
||||
|
||||
Reference in New Issue
Block a user