Use term wireless instead of network (#124232)
Rename variables, update comments, etc from `network` to `wireless` to keep it more uniform. Also, move non-overriden messages related to device selection into the file they're used. Part 7 in breakdown of https://github.com/flutter/flutter/pull/121262.
This commit is contained in:
parent
14e191fa75
commit
48bb3c0bc9
@ -263,24 +263,15 @@ class UserMessages {
|
|||||||
String get flutterNoDevelopmentDevice =>
|
String get flutterNoDevelopmentDevice =>
|
||||||
"Unable to locate a development device; please run 'flutter doctor' "
|
"Unable to locate a development device; please run 'flutter doctor' "
|
||||||
'for information about installing additional components.';
|
'for information about installing additional components.';
|
||||||
String flutterNoMatchingDevice(String deviceId) => 'No supported devices found with name or id '
|
|
||||||
"matching '$deviceId'.";
|
|
||||||
String get flutterNoDevicesFound => 'No devices found.';
|
|
||||||
String get flutterNoSupportedDevices => 'No supported devices connected.';
|
String get flutterNoSupportedDevices => 'No supported devices connected.';
|
||||||
String flutterMissPlatformProjects(List<String> unsupportedDevicesType) =>
|
String flutterMissPlatformProjects(List<String> unsupportedDevicesType) =>
|
||||||
'If you would like your app to run on ${unsupportedDevicesType.join(' or ')}, consider running `flutter create .` to generate projects for these platforms.';
|
'If you would like your app to run on ${unsupportedDevicesType.join(' or ')}, consider running `flutter create .` to generate projects for these platforms.';
|
||||||
String get flutterFoundButUnsupportedDevices => 'The following devices were found, but are not supported by this project:';
|
|
||||||
String flutterFoundSpecifiedDevices(int count, String deviceId) =>
|
|
||||||
'Found $count devices with name or id matching $deviceId:';
|
|
||||||
String flutterChooseDevice(int option, String name, String deviceId) => '[$option]: $name ($deviceId)';
|
|
||||||
String get flutterChooseOne => 'Please choose one (or "q" to quit)';
|
|
||||||
String get flutterSpecifyDeviceWithAllOption =>
|
String get flutterSpecifyDeviceWithAllOption =>
|
||||||
'More than one device connected; please specify a device with '
|
'More than one device connected; please specify a device with '
|
||||||
"the '-d <deviceId>' flag, or use '-d all' to act on all devices.";
|
"the '-d <deviceId>' flag, or use '-d all' to act on all devices.";
|
||||||
String get flutterSpecifyDevice =>
|
String get flutterSpecifyDevice =>
|
||||||
'More than one device connected; please specify a device with '
|
'More than one device connected; please specify a device with '
|
||||||
"the '-d <deviceId>' flag.";
|
"the '-d <deviceId>' flag.";
|
||||||
String get flutterNoConnectedDevices => 'No connected devices.';
|
|
||||||
String get flutterNoPubspec =>
|
String get flutterNoPubspec =>
|
||||||
'Error: No pubspec.yaml file found.\n'
|
'Error: No pubspec.yaml file found.\n'
|
||||||
'This command should be run from the root of your Flutter project.';
|
'This command should be run from the root of your Flutter project.';
|
||||||
|
@ -227,7 +227,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
|
|||||||
|
|
||||||
debugPort;
|
debugPort;
|
||||||
// Allow --ipv6 for iOS devices even if --debug-port and --debug-url
|
// Allow --ipv6 for iOS devices even if --debug-port and --debug-url
|
||||||
// are unknown
|
// are unknown.
|
||||||
if (!_isIOSDevice(targetDevice) &&
|
if (!_isIOSDevice(targetDevice) &&
|
||||||
debugPort == null &&
|
debugPort == null &&
|
||||||
debugUri == null &&
|
debugUri == null &&
|
||||||
@ -298,9 +298,9 @@ known, it can be explicitly provided to attach via the command-line, e.g.
|
|||||||
final String ipv6Loopback = InternetAddress.loopbackIPv6.address;
|
final String ipv6Loopback = InternetAddress.loopbackIPv6.address;
|
||||||
final String ipv4Loopback = InternetAddress.loopbackIPv4.address;
|
final String ipv4Loopback = InternetAddress.loopbackIPv4.address;
|
||||||
final String hostname = usesIpv6 ? ipv6Loopback : ipv4Loopback;
|
final String hostname = usesIpv6 ? ipv6Loopback : ipv4Loopback;
|
||||||
final bool isNetworkDevice = (device is IOSDevice) && device.isWirelesslyConnected;
|
final bool isWirelessIOSDevice = (device is IOSDevice) && device.isWirelesslyConnected;
|
||||||
|
|
||||||
if ((debugPort == null && debugUri == null) || isNetworkDevice) {
|
if ((debugPort == null && debugUri == null) || isWirelessIOSDevice) {
|
||||||
if (device is FuchsiaDevice) {
|
if (device is FuchsiaDevice) {
|
||||||
final String? module = stringArg('module');
|
final String? module = stringArg('module');
|
||||||
if (module == null) {
|
if (module == null) {
|
||||||
@ -323,10 +323,10 @@ known, it can be explicitly provided to attach via the command-line, e.g.
|
|||||||
// Protocol Discovery relies on logging. On iOS earlier than 13, logging is gathered using syslog.
|
// Protocol Discovery relies on logging. On iOS earlier than 13, logging is gathered using syslog.
|
||||||
// syslog is not available for iOS 13+. For iOS 13+, Protocol Discovery gathers logs from the VMService.
|
// syslog is not available for iOS 13+. For iOS 13+, Protocol Discovery gathers logs from the VMService.
|
||||||
// Since we don't have access to the VMService yet, Protocol Discovery cannot be used for iOS 13+.
|
// Since we don't have access to the VMService yet, Protocol Discovery cannot be used for iOS 13+.
|
||||||
// Also, network devices must be found using mDNS and cannot use Protocol Discovery.
|
// Also, wireless devices must be found using mDNS and cannot use Protocol Discovery.
|
||||||
final bool compatibleWithProtocolDiscovery = (device is IOSDevice) &&
|
final bool compatibleWithProtocolDiscovery = (device is IOSDevice) &&
|
||||||
device.majorSdkVersion < IOSDeviceLogReader.minimumUniversalLoggingSdkVersion &&
|
device.majorSdkVersion < IOSDeviceLogReader.minimumUniversalLoggingSdkVersion &&
|
||||||
!isNetworkDevice;
|
!isWirelessIOSDevice;
|
||||||
|
|
||||||
_logger.printStatus('Waiting for a connection from Flutter on ${device.name}...');
|
_logger.printStatus('Waiting for a connection from Flutter on ${device.name}...');
|
||||||
final Status discoveryStatus = _logger.startSpinner(
|
final Status discoveryStatus = _logger.startSpinner(
|
||||||
@ -357,7 +357,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
|
|||||||
appId,
|
appId,
|
||||||
device,
|
device,
|
||||||
usesIpv6: usesIpv6,
|
usesIpv6: usesIpv6,
|
||||||
isNetworkDevice: isNetworkDevice,
|
useDeviceIPAsHost: isWirelessIOSDevice,
|
||||||
deviceVmservicePort: devicePort,
|
deviceVmservicePort: devicePort,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -201,16 +201,16 @@ class DriveCommand extends RunCommandBase {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Network devices need `publish-port` to be enabled because it requires mDNS.
|
// Wireless iOS devices need `publish-port` to be enabled because it requires mDNS.
|
||||||
// If the flag wasn't provided as an actual argument and it's a network device,
|
// If the flag wasn't provided as an actual argument and it's a wireless device,
|
||||||
// change it to be enabled.
|
// change it to be enabled.
|
||||||
@override
|
@override
|
||||||
Future<bool> get disablePortPublication async {
|
Future<bool> get disablePortPublication async {
|
||||||
final ArgResults? localArgResults = argResults;
|
final ArgResults? localArgResults = argResults;
|
||||||
final Device? device = await targetedDevice;
|
final Device? device = await targetedDevice;
|
||||||
final bool isNetworkDevice = device is IOSDevice && device.isWirelesslyConnected;
|
final bool isWirelessIOSDevice = device is IOSDevice && device.isWirelesslyConnected;
|
||||||
if (isNetworkDevice && localArgResults != null && !localArgResults.wasParsed('publish-port')) {
|
if (isWirelessIOSDevice && localArgResults != null && !localArgResults.wasParsed('publish-port')) {
|
||||||
_logger.printTrace('Network device is being used. Changing `publish-port` to be enabled.');
|
_logger.printTrace('A wireless iOS device is being used. Changing `publish-port` to be enabled.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return !boolArg('publish-port');
|
return !boolArg('publish-port');
|
||||||
|
@ -427,7 +427,7 @@ class RunCommand extends RunCommandBase {
|
|||||||
bool isEmulator;
|
bool isEmulator;
|
||||||
bool anyAndroidDevices = false;
|
bool anyAndroidDevices = false;
|
||||||
bool anyIOSDevices = false;
|
bool anyIOSDevices = false;
|
||||||
bool anyIOSNetworkDevices = false;
|
bool anyWirelessIOSDevices = false;
|
||||||
|
|
||||||
if (devices == null || devices!.isEmpty) {
|
if (devices == null || devices!.isEmpty) {
|
||||||
deviceType = 'none';
|
deviceType = 'none';
|
||||||
@ -439,7 +439,7 @@ class RunCommand extends RunCommandBase {
|
|||||||
anyAndroidDevices = platform == TargetPlatform.android;
|
anyAndroidDevices = platform == TargetPlatform.android;
|
||||||
anyIOSDevices = platform == TargetPlatform.ios;
|
anyIOSDevices = platform == TargetPlatform.ios;
|
||||||
if (device is IOSDevice && device.isWirelesslyConnected) {
|
if (device is IOSDevice && device.isWirelesslyConnected) {
|
||||||
anyIOSNetworkDevices = true;
|
anyWirelessIOSDevices = true;
|
||||||
}
|
}
|
||||||
deviceType = getNameForTargetPlatform(platform);
|
deviceType = getNameForTargetPlatform(platform);
|
||||||
deviceOsVersion = await device.sdkNameAndVersion;
|
deviceOsVersion = await device.sdkNameAndVersion;
|
||||||
@ -453,7 +453,7 @@ class RunCommand extends RunCommandBase {
|
|||||||
anyAndroidDevices = anyAndroidDevices || (platform == TargetPlatform.android);
|
anyAndroidDevices = anyAndroidDevices || (platform == TargetPlatform.android);
|
||||||
anyIOSDevices = anyIOSDevices || (platform == TargetPlatform.ios);
|
anyIOSDevices = anyIOSDevices || (platform == TargetPlatform.ios);
|
||||||
if (device is IOSDevice && device.isWirelesslyConnected) {
|
if (device is IOSDevice && device.isWirelesslyConnected) {
|
||||||
anyIOSNetworkDevices = true;
|
anyWirelessIOSDevices = true;
|
||||||
}
|
}
|
||||||
if (anyAndroidDevices && anyIOSDevices) {
|
if (anyAndroidDevices && anyIOSDevices) {
|
||||||
break;
|
break;
|
||||||
@ -463,7 +463,7 @@ class RunCommand extends RunCommandBase {
|
|||||||
|
|
||||||
String? iOSInterfaceType;
|
String? iOSInterfaceType;
|
||||||
if (anyIOSDevices) {
|
if (anyIOSDevices) {
|
||||||
iOSInterfaceType = anyIOSNetworkDevices ? 'wireless' : 'usb';
|
iOSInterfaceType = anyWirelessIOSDevices ? 'wireless' : 'usb';
|
||||||
}
|
}
|
||||||
|
|
||||||
String? androidEmbeddingVersion;
|
String? androidEmbeddingVersion;
|
||||||
|
@ -496,7 +496,7 @@ class IOSDevice extends Device {
|
|||||||
deviceLogReader.debuggerStream = iosDeployDebugger;
|
deviceLogReader.debuggerStream = iosDeployDebugger;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Don't port foward if debugging with a network device.
|
// Don't port foward if debugging with a wireless device.
|
||||||
vmServiceDiscovery = ProtocolDiscovery.vmService(
|
vmServiceDiscovery = ProtocolDiscovery.vmService(
|
||||||
deviceLogReader,
|
deviceLogReader,
|
||||||
portForwarder: isWirelesslyConnected ? null : portForwarder,
|
portForwarder: isWirelesslyConnected ? null : portForwarder,
|
||||||
@ -576,7 +576,7 @@ class IOSDevice extends Device {
|
|||||||
this,
|
this,
|
||||||
usesIpv6: ipv6,
|
usesIpv6: ipv6,
|
||||||
deviceVmservicePort: serviceURL.port,
|
deviceVmservicePort: serviceURL.port,
|
||||||
isNetworkDevice: true,
|
useDeviceIPAsHost: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
mDNSLookupTimer.cancel();
|
mDNSLookupTimer.cancel();
|
||||||
|
@ -57,7 +57,7 @@ class MDnsVmServiceDiscovery {
|
|||||||
/// The [deviceVmservicePort] parameter may be used to specify which port
|
/// The [deviceVmservicePort] parameter may be used to specify which port
|
||||||
/// to find.
|
/// to find.
|
||||||
///
|
///
|
||||||
/// The [isNetworkDevice] parameter flags whether to get the device IP
|
/// The [useDeviceIPAsHost] parameter flags whether to get the device IP
|
||||||
/// and the [ipv6] parameter flags whether to get an iPv6 address
|
/// and the [ipv6] parameter flags whether to get an iPv6 address
|
||||||
/// (otherwise it will get iPv4).
|
/// (otherwise it will get iPv4).
|
||||||
///
|
///
|
||||||
@ -80,7 +80,7 @@ class MDnsVmServiceDiscovery {
|
|||||||
String? applicationId,
|
String? applicationId,
|
||||||
int? deviceVmservicePort,
|
int? deviceVmservicePort,
|
||||||
bool ipv6 = false,
|
bool ipv6 = false,
|
||||||
bool isNetworkDevice = false,
|
bool useDeviceIPAsHost = false,
|
||||||
Duration timeout = const Duration(minutes: 10),
|
Duration timeout = const Duration(minutes: 10),
|
||||||
}) async {
|
}) async {
|
||||||
// Poll for 5 seconds to see if there are already services running.
|
// Poll for 5 seconds to see if there are already services running.
|
||||||
@ -93,7 +93,7 @@ class MDnsVmServiceDiscovery {
|
|||||||
applicationId: applicationId,
|
applicationId: applicationId,
|
||||||
deviceVmservicePort: deviceVmservicePort,
|
deviceVmservicePort: deviceVmservicePort,
|
||||||
ipv6: ipv6,
|
ipv6: ipv6,
|
||||||
isNetworkDevice: isNetworkDevice,
|
useDeviceIPAsHost: useDeviceIPAsHost,
|
||||||
timeout: const Duration(seconds: 5),
|
timeout: const Duration(seconds: 5),
|
||||||
);
|
);
|
||||||
if (results.isEmpty) {
|
if (results.isEmpty) {
|
||||||
@ -102,7 +102,7 @@ class MDnsVmServiceDiscovery {
|
|||||||
applicationId: applicationId,
|
applicationId: applicationId,
|
||||||
deviceVmservicePort: deviceVmservicePort,
|
deviceVmservicePort: deviceVmservicePort,
|
||||||
ipv6: ipv6,
|
ipv6: ipv6,
|
||||||
isNetworkDevice: isNetworkDevice,
|
useDeviceIPAsHost: useDeviceIPAsHost,
|
||||||
timeout: timeout,
|
timeout: timeout,
|
||||||
);
|
);
|
||||||
} else if (results.length > 1) {
|
} else if (results.length > 1) {
|
||||||
@ -134,7 +134,7 @@ class MDnsVmServiceDiscovery {
|
|||||||
/// if multiple flutter apps are running on different devices, it will
|
/// if multiple flutter apps are running on different devices, it will
|
||||||
/// only match with the device running the desired app.
|
/// only match with the device running the desired app.
|
||||||
///
|
///
|
||||||
/// The [isNetworkDevice] parameter flags whether to get the device IP
|
/// The [useDeviceIPAsHost] parameter flags whether to get the device IP
|
||||||
/// and the [ipv6] parameter flags whether to get an iPv6 address
|
/// and the [ipv6] parameter flags whether to get an iPv6 address
|
||||||
/// (otherwise it will get iPv4).
|
/// (otherwise it will get iPv4).
|
||||||
///
|
///
|
||||||
@ -148,7 +148,7 @@ class MDnsVmServiceDiscovery {
|
|||||||
required String applicationId,
|
required String applicationId,
|
||||||
required int deviceVmservicePort,
|
required int deviceVmservicePort,
|
||||||
bool ipv6 = false,
|
bool ipv6 = false,
|
||||||
bool isNetworkDevice = false,
|
bool useDeviceIPAsHost = false,
|
||||||
Duration timeout = const Duration(minutes: 10),
|
Duration timeout = const Duration(minutes: 10),
|
||||||
}) async {
|
}) async {
|
||||||
// Query for a specific application and device port.
|
// Query for a specific application and device port.
|
||||||
@ -157,7 +157,7 @@ class MDnsVmServiceDiscovery {
|
|||||||
applicationId: applicationId,
|
applicationId: applicationId,
|
||||||
deviceVmservicePort: deviceVmservicePort,
|
deviceVmservicePort: deviceVmservicePort,
|
||||||
ipv6: ipv6,
|
ipv6: ipv6,
|
||||||
isNetworkDevice: isNetworkDevice,
|
useDeviceIPAsHost: useDeviceIPAsHost,
|
||||||
timeout: timeout,
|
timeout: timeout,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -171,7 +171,7 @@ class MDnsVmServiceDiscovery {
|
|||||||
String? applicationId,
|
String? applicationId,
|
||||||
int? deviceVmservicePort,
|
int? deviceVmservicePort,
|
||||||
bool ipv6 = false,
|
bool ipv6 = false,
|
||||||
bool isNetworkDevice = false,
|
bool useDeviceIPAsHost = false,
|
||||||
Duration timeout = const Duration(minutes: 10),
|
Duration timeout = const Duration(minutes: 10),
|
||||||
}) async {
|
}) async {
|
||||||
final List<MDnsVmServiceDiscoveryResult> results = await _pollingVmService(
|
final List<MDnsVmServiceDiscoveryResult> results = await _pollingVmService(
|
||||||
@ -179,7 +179,7 @@ class MDnsVmServiceDiscovery {
|
|||||||
applicationId: applicationId,
|
applicationId: applicationId,
|
||||||
deviceVmservicePort: deviceVmservicePort,
|
deviceVmservicePort: deviceVmservicePort,
|
||||||
ipv6: ipv6,
|
ipv6: ipv6,
|
||||||
isNetworkDevice: isNetworkDevice,
|
useDeviceIPAsHost: useDeviceIPAsHost,
|
||||||
timeout: timeout,
|
timeout: timeout,
|
||||||
quitOnFind: true,
|
quitOnFind: true,
|
||||||
);
|
);
|
||||||
@ -194,7 +194,7 @@ class MDnsVmServiceDiscovery {
|
|||||||
String? applicationId,
|
String? applicationId,
|
||||||
int? deviceVmservicePort,
|
int? deviceVmservicePort,
|
||||||
bool ipv6 = false,
|
bool ipv6 = false,
|
||||||
bool isNetworkDevice = false,
|
bool useDeviceIPAsHost = false,
|
||||||
required Duration timeout,
|
required Duration timeout,
|
||||||
bool quitOnFind = false,
|
bool quitOnFind = false,
|
||||||
}) async {
|
}) async {
|
||||||
@ -263,9 +263,9 @@ class MDnsVmServiceDiscovery {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the IP address of the service if using a network device.
|
// Get the IP address of the device if using the IP as the host.
|
||||||
InternetAddress? ipAddress;
|
InternetAddress? ipAddress;
|
||||||
if (isNetworkDevice) {
|
if (useDeviceIPAsHost) {
|
||||||
List<IPAddressResourceRecord> ipAddresses = await client
|
List<IPAddressResourceRecord> ipAddresses = await client
|
||||||
.lookup<IPAddressResourceRecord>(
|
.lookup<IPAddressResourceRecord>(
|
||||||
ipv6
|
ipv6
|
||||||
@ -351,6 +351,9 @@ class MDnsVmServiceDiscovery {
|
|||||||
/// Gets Dart VM Service Uri for `flutter attach`.
|
/// Gets Dart VM Service Uri for `flutter attach`.
|
||||||
/// Executes an mDNS query and waits until a Dart VM Service is found.
|
/// Executes an mDNS query and waits until a Dart VM Service is found.
|
||||||
///
|
///
|
||||||
|
/// When [useDeviceIPAsHost] is true, it will use the device's IP as the
|
||||||
|
/// host and will not forward the port.
|
||||||
|
///
|
||||||
/// Differs from `getVMServiceUriForLaunch` because it can search for any available Dart VM Service.
|
/// Differs from `getVMServiceUriForLaunch` because it can search for any available Dart VM Service.
|
||||||
/// Since [applicationId] and [deviceVmservicePort] are optional, it can either look for any service
|
/// Since [applicationId] and [deviceVmservicePort] are optional, it can either look for any service
|
||||||
/// or a specific service matching [applicationId]/[deviceVmservicePort].
|
/// or a specific service matching [applicationId]/[deviceVmservicePort].
|
||||||
@ -361,14 +364,14 @@ class MDnsVmServiceDiscovery {
|
|||||||
bool usesIpv6 = false,
|
bool usesIpv6 = false,
|
||||||
int? hostVmservicePort,
|
int? hostVmservicePort,
|
||||||
int? deviceVmservicePort,
|
int? deviceVmservicePort,
|
||||||
bool isNetworkDevice = false,
|
bool useDeviceIPAsHost = false,
|
||||||
Duration timeout = const Duration(minutes: 10),
|
Duration timeout = const Duration(minutes: 10),
|
||||||
}) async {
|
}) async {
|
||||||
final MDnsVmServiceDiscoveryResult? result = await queryForAttach(
|
final MDnsVmServiceDiscoveryResult? result = await queryForAttach(
|
||||||
applicationId: applicationId,
|
applicationId: applicationId,
|
||||||
deviceVmservicePort: deviceVmservicePort,
|
deviceVmservicePort: deviceVmservicePort,
|
||||||
ipv6: usesIpv6,
|
ipv6: usesIpv6,
|
||||||
isNetworkDevice: isNetworkDevice,
|
useDeviceIPAsHost: useDeviceIPAsHost,
|
||||||
timeout: timeout,
|
timeout: timeout,
|
||||||
);
|
);
|
||||||
return _handleResult(
|
return _handleResult(
|
||||||
@ -378,13 +381,16 @@ class MDnsVmServiceDiscovery {
|
|||||||
deviceVmservicePort: deviceVmservicePort,
|
deviceVmservicePort: deviceVmservicePort,
|
||||||
hostVmservicePort: hostVmservicePort,
|
hostVmservicePort: hostVmservicePort,
|
||||||
usesIpv6: usesIpv6,
|
usesIpv6: usesIpv6,
|
||||||
isNetworkDevice: isNetworkDevice
|
useDeviceIPAsHost: useDeviceIPAsHost
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets Dart VM Service Uri for `flutter run`.
|
/// Gets Dart VM Service Uri for `flutter run`.
|
||||||
/// Executes an mDNS query and waits until the Dart VM Service service is found.
|
/// Executes an mDNS query and waits until the Dart VM Service service is found.
|
||||||
///
|
///
|
||||||
|
/// When [useDeviceIPAsHost] is true, it will use the device's IP as the
|
||||||
|
/// host and will not forward the port.
|
||||||
|
///
|
||||||
/// Differs from `getVMServiceUriForAttach` because it only searches for a specific service.
|
/// Differs from `getVMServiceUriForAttach` because it only searches for a specific service.
|
||||||
/// This is enforced by [applicationId] and [deviceVmservicePort] being required.
|
/// This is enforced by [applicationId] and [deviceVmservicePort] being required.
|
||||||
Future<Uri?> getVMServiceUriForLaunch(
|
Future<Uri?> getVMServiceUriForLaunch(
|
||||||
@ -393,14 +399,14 @@ class MDnsVmServiceDiscovery {
|
|||||||
bool usesIpv6 = false,
|
bool usesIpv6 = false,
|
||||||
int? hostVmservicePort,
|
int? hostVmservicePort,
|
||||||
required int deviceVmservicePort,
|
required int deviceVmservicePort,
|
||||||
bool isNetworkDevice = false,
|
bool useDeviceIPAsHost = false,
|
||||||
Duration timeout = const Duration(minutes: 10),
|
Duration timeout = const Duration(minutes: 10),
|
||||||
}) async {
|
}) async {
|
||||||
final MDnsVmServiceDiscoveryResult? result = await queryForLaunch(
|
final MDnsVmServiceDiscoveryResult? result = await queryForLaunch(
|
||||||
applicationId: applicationId,
|
applicationId: applicationId,
|
||||||
deviceVmservicePort: deviceVmservicePort,
|
deviceVmservicePort: deviceVmservicePort,
|
||||||
ipv6: usesIpv6,
|
ipv6: usesIpv6,
|
||||||
isNetworkDevice: isNetworkDevice,
|
useDeviceIPAsHost: useDeviceIPAsHost,
|
||||||
timeout: timeout,
|
timeout: timeout,
|
||||||
);
|
);
|
||||||
return _handleResult(
|
return _handleResult(
|
||||||
@ -410,7 +416,7 @@ class MDnsVmServiceDiscovery {
|
|||||||
deviceVmservicePort: deviceVmservicePort,
|
deviceVmservicePort: deviceVmservicePort,
|
||||||
hostVmservicePort: hostVmservicePort,
|
hostVmservicePort: hostVmservicePort,
|
||||||
usesIpv6: usesIpv6,
|
usesIpv6: usesIpv6,
|
||||||
isNetworkDevice: isNetworkDevice
|
useDeviceIPAsHost: useDeviceIPAsHost
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,7 +427,7 @@ class MDnsVmServiceDiscovery {
|
|||||||
int? deviceVmservicePort,
|
int? deviceVmservicePort,
|
||||||
int? hostVmservicePort,
|
int? hostVmservicePort,
|
||||||
bool usesIpv6 = false,
|
bool usesIpv6 = false,
|
||||||
bool isNetworkDevice = false,
|
bool useDeviceIPAsHost = false,
|
||||||
}) async {
|
}) async {
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
await _checkForIPv4LinkLocal(device);
|
await _checkForIPv4LinkLocal(device);
|
||||||
@ -430,7 +436,7 @@ class MDnsVmServiceDiscovery {
|
|||||||
final String host;
|
final String host;
|
||||||
|
|
||||||
final InternetAddress? ipAddress = result.ipAddress;
|
final InternetAddress? ipAddress = result.ipAddress;
|
||||||
if (isNetworkDevice && ipAddress != null) {
|
if (useDeviceIPAsHost && ipAddress != null) {
|
||||||
host = ipAddress.address;
|
host = ipAddress.address;
|
||||||
} else {
|
} else {
|
||||||
host = usesIpv6
|
host = usesIpv6
|
||||||
@ -443,7 +449,7 @@ class MDnsVmServiceDiscovery {
|
|||||||
result.port,
|
result.port,
|
||||||
hostVmservicePort,
|
hostVmservicePort,
|
||||||
result.authCode,
|
result.authCode,
|
||||||
isNetworkDevice,
|
useDeviceIPAsHost,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -529,7 +535,7 @@ Future<Uri> buildVMServiceUri(
|
|||||||
int devicePort, [
|
int devicePort, [
|
||||||
int? hostVmservicePort,
|
int? hostVmservicePort,
|
||||||
String? authCode,
|
String? authCode,
|
||||||
bool isNetworkDevice = false,
|
bool useDeviceIPAsHost = false,
|
||||||
]) async {
|
]) async {
|
||||||
String path = '/';
|
String path = '/';
|
||||||
if (authCode != null) {
|
if (authCode != null) {
|
||||||
@ -543,8 +549,8 @@ Future<Uri> buildVMServiceUri(
|
|||||||
hostVmservicePort ??= 0;
|
hostVmservicePort ??= 0;
|
||||||
|
|
||||||
final int? actualHostPort;
|
final int? actualHostPort;
|
||||||
if (isNetworkDevice) {
|
if (useDeviceIPAsHost) {
|
||||||
// When debugging with a network device, port forwarding is not required
|
// When using the device's IP as the host, port forwarding is not required
|
||||||
// so just use the device's port.
|
// so just use the device's port.
|
||||||
actualHostPort = devicePort;
|
actualHostPort = devicePort;
|
||||||
} else {
|
} else {
|
||||||
|
@ -14,13 +14,21 @@ import '../globals.dart' as globals;
|
|||||||
import '../ios/devices.dart';
|
import '../ios/devices.dart';
|
||||||
|
|
||||||
const String _checkingForWirelessDevicesMessage = 'Checking for wireless devices...';
|
const String _checkingForWirelessDevicesMessage = 'Checking for wireless devices...';
|
||||||
|
const String _chooseOneMessage = 'Please choose one (or "q" to quit)';
|
||||||
const String _connectedDevicesMessage = 'Connected devices:';
|
const String _connectedDevicesMessage = 'Connected devices:';
|
||||||
const String _noAttachedCheckForWireless = 'No devices found yet. Checking for wireless devices...';
|
const String _foundButUnsupportedDevicesMessage = 'The following devices were found, but are not supported by this project:';
|
||||||
|
const String _noAttachedCheckForWirelessMessage = 'No devices found yet. Checking for wireless devices...';
|
||||||
|
const String _noDevicesFoundMessage = 'No devices found.';
|
||||||
const String _noWirelessDevicesFoundMessage = 'No wireless devices were found.';
|
const String _noWirelessDevicesFoundMessage = 'No wireless devices were found.';
|
||||||
const String _wirelesslyConnectedDevicesMessage = 'Wirelessly connected devices:';
|
const String _wirelesslyConnectedDevicesMessage = 'Wirelessly connected devices:';
|
||||||
|
|
||||||
String _foundMultipleSpecifiedDevices(String deviceId) =>
|
String _chooseDeviceOptionMessage(int option, String name, String deviceId) => '[$option]: $name ($deviceId)';
|
||||||
|
String _foundMultipleSpecifiedDevicesMessage(String deviceId) =>
|
||||||
'Found multiple devices with name or id matching $deviceId:';
|
'Found multiple devices with name or id matching $deviceId:';
|
||||||
|
String _foundSpecifiedDevicesMessage(int count, String deviceId) =>
|
||||||
|
'Found $count devices with name or id matching $deviceId:';
|
||||||
|
String _noMatchingDeviceMessage(String deviceId) => 'No supported devices found with name or id '
|
||||||
|
"matching '$deviceId'.";
|
||||||
|
|
||||||
/// This class handles functionality of finding and selecting target devices.
|
/// This class handles functionality of finding and selecting target devices.
|
||||||
///
|
///
|
||||||
@ -193,7 +201,7 @@ class TargetDevices {
|
|||||||
|
|
||||||
if (_deviceManager.hasSpecifiedDeviceId) {
|
if (_deviceManager.hasSpecifiedDeviceId) {
|
||||||
_logger.printStatus(
|
_logger.printStatus(
|
||||||
userMessages.flutterNoMatchingDevice(_deviceManager.specifiedDeviceId!),
|
_noMatchingDeviceMessage(_deviceManager.specifiedDeviceId!),
|
||||||
);
|
);
|
||||||
if (unsupportedDevices.isNotEmpty) {
|
if (unsupportedDevices.isNotEmpty) {
|
||||||
_logger.printStatus('');
|
_logger.printStatus('');
|
||||||
@ -204,7 +212,7 @@ class TargetDevices {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_logger.printStatus(_deviceManager.hasSpecifiedAllDevices
|
_logger.printStatus(_deviceManager.hasSpecifiedAllDevices
|
||||||
? userMessages.flutterNoDevicesFound
|
? _noDevicesFoundMessage
|
||||||
: userMessages.flutterNoSupportedDevices);
|
: userMessages.flutterNoSupportedDevices);
|
||||||
await _printUnsupportedDevice(unsupportedDevices);
|
await _printUnsupportedDevice(unsupportedDevices);
|
||||||
return null;
|
return null;
|
||||||
@ -248,7 +256,7 @@ class TargetDevices {
|
|||||||
List<Device> supportedWirelessDevices = wirelessDevices;
|
List<Device> supportedWirelessDevices = wirelessDevices;
|
||||||
if (_deviceManager.hasSpecifiedDeviceId) {
|
if (_deviceManager.hasSpecifiedDeviceId) {
|
||||||
final int allDeviceLength = supportedAttachedDevices.length + supportedWirelessDevices.length;
|
final int allDeviceLength = supportedAttachedDevices.length + supportedWirelessDevices.length;
|
||||||
_logger.printStatus(userMessages.flutterFoundSpecifiedDevices(
|
_logger.printStatus(_foundSpecifiedDevicesMessage(
|
||||||
allDeviceLength,
|
allDeviceLength,
|
||||||
_deviceManager.specifiedDeviceId!,
|
_deviceManager.specifiedDeviceId!,
|
||||||
));
|
));
|
||||||
@ -288,7 +296,7 @@ class TargetDevices {
|
|||||||
final List<Device> allDevices = attachedDevices + wirelessDevices;
|
final List<Device> allDevices = attachedDevices + wirelessDevices;
|
||||||
|
|
||||||
if (_deviceManager.hasSpecifiedDeviceId) {
|
if (_deviceManager.hasSpecifiedDeviceId) {
|
||||||
_logger.printStatus(userMessages.flutterFoundSpecifiedDevices(
|
_logger.printStatus(_foundSpecifiedDevicesMessage(
|
||||||
allDevices.length,
|
allDevices.length,
|
||||||
_deviceManager.specifiedDeviceId!,
|
_deviceManager.specifiedDeviceId!,
|
||||||
));
|
));
|
||||||
@ -318,7 +326,7 @@ class TargetDevices {
|
|||||||
if (unsupportedDevices.isNotEmpty) {
|
if (unsupportedDevices.isNotEmpty) {
|
||||||
final StringBuffer result = StringBuffer();
|
final StringBuffer result = StringBuffer();
|
||||||
result.writeln();
|
result.writeln();
|
||||||
result.writeln(userMessages.flutterFoundButUnsupportedDevices);
|
result.writeln(_foundButUnsupportedDevicesMessage);
|
||||||
result.writeAll(
|
result.writeAll(
|
||||||
(await Device.descriptions(unsupportedDevices))
|
(await Device.descriptions(unsupportedDevices))
|
||||||
.map((String desc) => desc)
|
.map((String desc) => desc)
|
||||||
@ -345,7 +353,7 @@ class TargetDevices {
|
|||||||
void _displayDeviceOptions(List<Device> devices) {
|
void _displayDeviceOptions(List<Device> devices) {
|
||||||
int count = 1;
|
int count = 1;
|
||||||
for (final Device device in devices) {
|
for (final Device device in devices) {
|
||||||
_logger.printStatus(userMessages.flutterChooseDevice(count, device.name, device.id));
|
_logger.printStatus(_chooseDeviceOptionMessage(count, device.name, device.id));
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -356,7 +364,7 @@ class TargetDevices {
|
|||||||
<String>[ for (int i = 0; i < deviceCount; i++) '${i + 1}', 'q', 'Q'],
|
<String>[ for (int i = 0; i < deviceCount; i++) '${i + 1}', 'q', 'Q'],
|
||||||
displayAcceptedCharacters: false,
|
displayAcceptedCharacters: false,
|
||||||
logger: _logger,
|
logger: _logger,
|
||||||
prompt: userMessages.flutterChooseOne,
|
prompt: _chooseOneMessage,
|
||||||
);
|
);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -526,7 +534,7 @@ class TargetDevicesWithExtendedWirelessDeviceDiscovery extends TargetDevices {
|
|||||||
Future<List<Device>> futureWirelessDevices,
|
Future<List<Device>> futureWirelessDevices,
|
||||||
) async {
|
) async {
|
||||||
if (_includeAttachedDevices) {
|
if (_includeAttachedDevices) {
|
||||||
_logger.printStatus(_noAttachedCheckForWireless);
|
_logger.printStatus(_noAttachedCheckForWirelessMessage);
|
||||||
} else {
|
} else {
|
||||||
_logger.printStatus(_checkingForWirelessDevicesMessage);
|
_logger.printStatus(_checkingForWirelessDevicesMessage);
|
||||||
}
|
}
|
||||||
@ -613,7 +621,7 @@ class TargetDevicesWithExtendedWirelessDeviceDiscovery extends TargetDevices {
|
|||||||
_logger.printStatus(_connectedDevicesMessage);
|
_logger.printStatus(_connectedDevicesMessage);
|
||||||
} else if (_deviceManager.hasSpecifiedDeviceId) {
|
} else if (_deviceManager.hasSpecifiedDeviceId) {
|
||||||
// Multiple devices were found with part of the name/id provided.
|
// Multiple devices were found with part of the name/id provided.
|
||||||
_logger.printStatus(_foundMultipleSpecifiedDevices(
|
_logger.printStatus(_foundMultipleSpecifiedDevicesMessage(
|
||||||
_deviceManager.specifiedDeviceId!,
|
_deviceManager.specifiedDeviceId!,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@ -660,7 +668,7 @@ class TargetDevicesWithExtendedWirelessDeviceDiscovery extends TargetDevices {
|
|||||||
deviceSelection.devices = allDevices;
|
deviceSelection.devices = allDevices;
|
||||||
// Reprint device option prompt.
|
// Reprint device option prompt.
|
||||||
_logger.printStatus(
|
_logger.printStatus(
|
||||||
'${userMessages.flutterChooseOne}: ',
|
'$_chooseOneMessage: ',
|
||||||
emphasis: true,
|
emphasis: true,
|
||||||
newline: false,
|
newline: false,
|
||||||
);
|
);
|
||||||
@ -758,11 +766,10 @@ class TargetDeviceSelection {
|
|||||||
@visibleForTesting
|
@visibleForTesting
|
||||||
Future<String> readUserInput() async {
|
Future<String> readUserInput() async {
|
||||||
final RegExp pattern = RegExp(r'\d+$|q', caseSensitive: false);
|
final RegExp pattern = RegExp(r'\d+$|q', caseSensitive: false);
|
||||||
final String prompt = userMessages.flutterChooseOne;
|
|
||||||
String? choice;
|
String? choice;
|
||||||
globals.terminal.singleCharMode = true;
|
globals.terminal.singleCharMode = true;
|
||||||
while (choice == null || choice.length > 1 || !pattern.hasMatch(choice)) {
|
while (choice == null || choice.length > 1 || !pattern.hasMatch(choice)) {
|
||||||
_logger.printStatus(prompt, emphasis: true, newline: false);
|
_logger.printStatus(_chooseOneMessage, emphasis: true, newline: false);
|
||||||
// prompt ends with ': '
|
// prompt ends with ': '
|
||||||
_logger.printStatus(': ', emphasis: true, newline: false);
|
_logger.printStatus(': ', emphasis: true, newline: false);
|
||||||
choice = (await globals.terminal.keystrokes.first).trim();
|
choice = (await globals.terminal.keystrokes.first).trim();
|
||||||
|
@ -235,7 +235,7 @@ void main() {
|
|||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('succeeds with iOS device with mDNS network device', () async {
|
testUsingContext('succeeds with iOS device with mDNS wireless device', () async {
|
||||||
final FakeIOSDevice device = FakeIOSDevice(
|
final FakeIOSDevice device = FakeIOSDevice(
|
||||||
logReader: fakeLogReader,
|
logReader: fakeLogReader,
|
||||||
portForwarder: portForwarder,
|
portForwarder: portForwarder,
|
||||||
@ -307,7 +307,7 @@ void main() {
|
|||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('succeeds with iOS device with mDNS network device with debug-port', () async {
|
testUsingContext('succeeds with iOS device with mDNS wireless device with debug-port', () async {
|
||||||
final FakeIOSDevice device = FakeIOSDevice(
|
final FakeIOSDevice device = FakeIOSDevice(
|
||||||
logReader: fakeLogReader,
|
logReader: fakeLogReader,
|
||||||
portForwarder: portForwarder,
|
portForwarder: portForwarder,
|
||||||
@ -383,7 +383,7 @@ void main() {
|
|||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('succeeds with iOS device with mDNS network device with debug-url', () async {
|
testUsingContext('succeeds with iOS device with mDNS wireless device with debug-url', () async {
|
||||||
final FakeIOSDevice device = FakeIOSDevice(
|
final FakeIOSDevice device = FakeIOSDevice(
|
||||||
logReader: fakeLogReader,
|
logReader: fakeLogReader,
|
||||||
portForwarder: portForwarder,
|
portForwarder: portForwarder,
|
||||||
|
@ -409,7 +409,7 @@ void main() {
|
|||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Port publication not disabled for network device', () async {
|
testUsingContext('Port publication not disabled for wireless device', () async {
|
||||||
final DriveCommand command = DriveCommand(
|
final DriveCommand command = DriveCommand(
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
logger: logger,
|
logger: logger,
|
||||||
@ -421,9 +421,9 @@ void main() {
|
|||||||
fileSystem.file('test_driver/main_test.dart').createSync(recursive: true);
|
fileSystem.file('test_driver/main_test.dart').createSync(recursive: true);
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
|
|
||||||
final Device networkDevice = FakeIosDevice()
|
final Device wirelessDevice = FakeIosDevice()
|
||||||
..connectionInterface = DeviceConnectionInterface.wireless;
|
..connectionInterface = DeviceConnectionInterface.wireless;
|
||||||
fakeDeviceManager.wirelessDevices = <Device>[networkDevice];
|
fakeDeviceManager.wirelessDevices = <Device>[wirelessDevice];
|
||||||
|
|
||||||
await expectLater(() => createTestCommandRunner(command).run(<String>[
|
await expectLater(() => createTestCommandRunner(command).run(<String>[
|
||||||
'drive',
|
'drive',
|
||||||
@ -467,7 +467,7 @@ void main() {
|
|||||||
DeviceManager: () => fakeDeviceManager,
|
DeviceManager: () => fakeDeviceManager,
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Port publication does not default to enabled for network device if flag manually added', () async {
|
testUsingContext('Port publication does not default to enabled for wireless device if flag manually added', () async {
|
||||||
final DriveCommand command = DriveCommand(
|
final DriveCommand command = DriveCommand(
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
logger: logger,
|
logger: logger,
|
||||||
@ -479,9 +479,9 @@ void main() {
|
|||||||
fileSystem.file('test_driver/main_test.dart').createSync(recursive: true);
|
fileSystem.file('test_driver/main_test.dart').createSync(recursive: true);
|
||||||
fileSystem.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
|
|
||||||
final Device networkDevice = FakeIosDevice()
|
final Device wirelessDevice = FakeIosDevice()
|
||||||
..connectionInterface = DeviceConnectionInterface.wireless;
|
..connectionInterface = DeviceConnectionInterface.wireless;
|
||||||
fakeDeviceManager.wirelessDevices = <Device>[networkDevice];
|
fakeDeviceManager.wirelessDevices = <Device>[wirelessDevice];
|
||||||
|
|
||||||
await expectLater(() => createTestCommandRunner(command).run(<String>[
|
await expectLater(() => createTestCommandRunner(command).run(<String>[
|
||||||
'drive',
|
'drive',
|
||||||
|
@ -228,7 +228,7 @@ void main() {
|
|||||||
|
|
||||||
expect(
|
expect(
|
||||||
testLogger.statusText,
|
testLogger.statusText,
|
||||||
containsIgnoringWhitespace(userMessages.flutterNoSupportedDevices),
|
containsIgnoringWhitespace('No supported devices connected.'),
|
||||||
);
|
);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
DeviceManager: () => testDeviceManager,
|
DeviceManager: () => testDeviceManager,
|
||||||
@ -404,11 +404,11 @@ void main() {
|
|||||||
|
|
||||||
expect(
|
expect(
|
||||||
testLogger.statusText,
|
testLogger.statusText,
|
||||||
containsIgnoringWhitespace(userMessages.flutterNoSupportedDevices),
|
containsIgnoringWhitespace('No supported devices connected.'),
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
testLogger.statusText,
|
testLogger.statusText,
|
||||||
containsIgnoringWhitespace(userMessages.flutterFoundButUnsupportedDevices),
|
containsIgnoringWhitespace('The following devices were found, but are not supported by this project:'),
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
testLogger.statusText,
|
testLogger.statusText,
|
||||||
@ -831,7 +831,7 @@ void main() {
|
|||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('with only iOS network device', () async {
|
testUsingContext('with only iOS wireless device', () async {
|
||||||
final List<Device> devices = <Device>[
|
final List<Device> devices = <Device>[
|
||||||
FakeIOSDevice(
|
FakeIOSDevice(
|
||||||
connectionInterface: DeviceConnectionInterface.wireless,
|
connectionInterface: DeviceConnectionInterface.wireless,
|
||||||
@ -875,7 +875,7 @@ void main() {
|
|||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('with both iOS usb and network devices', () async {
|
testUsingContext('with both iOS usb and wireless devices', () async {
|
||||||
final List<Device> devices = <Device>[
|
final List<Device> devices = <Device>[
|
||||||
FakeIOSDevice(
|
FakeIOSDevice(
|
||||||
connectionInterface: DeviceConnectionInterface.wireless,
|
connectionInterface: DeviceConnectionInterface.wireless,
|
||||||
|
@ -68,7 +68,7 @@ const FakeCommand kLaunchDebugCommand = FakeCommand(command: <String>[
|
|||||||
FakeCommand attachDebuggerCommand({
|
FakeCommand attachDebuggerCommand({
|
||||||
IOSink? stdin,
|
IOSink? stdin,
|
||||||
Completer<void>? completer,
|
Completer<void>? completer,
|
||||||
bool isNetworkDevice = false,
|
bool isWirelessDevice = false,
|
||||||
}) {
|
}) {
|
||||||
return FakeCommand(
|
return FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
@ -82,9 +82,9 @@ FakeCommand attachDebuggerCommand({
|
|||||||
'--bundle',
|
'--bundle',
|
||||||
'/',
|
'/',
|
||||||
'--debug',
|
'--debug',
|
||||||
if (!isNetworkDevice) '--no-wifi',
|
if (!isWirelessDevice) '--no-wifi',
|
||||||
'--args',
|
'--args',
|
||||||
if (isNetworkDevice)
|
if (isWirelessDevice)
|
||||||
'--enable-dart-profiling --enable-checked-mode --verify-entry-points --vm-service-host=0.0.0.0'
|
'--enable-dart-profiling --enable-checked-mode --verify-entry-points --vm-service-host=0.0.0.0'
|
||||||
else
|
else
|
||||||
'--enable-dart-profiling --enable-checked-mode --verify-entry-points',
|
'--enable-dart-profiling --enable-checked-mode --verify-entry-points',
|
||||||
@ -244,7 +244,7 @@ void main() {
|
|||||||
final CompleterIOSink stdin = CompleterIOSink();
|
final CompleterIOSink stdin = CompleterIOSink();
|
||||||
final Completer<void> completer = Completer<void>();
|
final Completer<void> completer = Completer<void>();
|
||||||
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
|
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
|
||||||
attachDebuggerCommand(stdin: stdin, completer: completer, isNetworkDevice: true),
|
attachDebuggerCommand(stdin: stdin, completer: completer, isWirelessDevice: true),
|
||||||
]);
|
]);
|
||||||
final IOSDevice device = setUpIOSDevice(
|
final IOSDevice device = setUpIOSDevice(
|
||||||
processManager: processManager,
|
processManager: processManager,
|
||||||
@ -620,7 +620,7 @@ class FakeMDnsVmServiceDiscovery extends Fake implements MDnsVmServiceDiscovery
|
|||||||
bool usesIpv6 = false,
|
bool usesIpv6 = false,
|
||||||
int? hostVmservicePort,
|
int? hostVmservicePort,
|
||||||
required int deviceVmservicePort,
|
required int deviceVmservicePort,
|
||||||
bool isNetworkDevice = false,
|
bool useDeviceIPAsHost = false,
|
||||||
Duration timeout = Duration.zero,
|
Duration timeout = Duration.zero,
|
||||||
}) async {
|
}) async {
|
||||||
return Uri.tryParse('http://0.0.0.0:1234');
|
return Uri.tryParse('http://0.0.0.0:1234');
|
||||||
|
@ -335,7 +335,7 @@ void main() {
|
|||||||
expect(uri.toString(), 'http://127.0.0.1:123/');
|
expect(uri.toString(), 'http://127.0.0.1:123/');
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('Get network device IP (iPv4)', () async {
|
testWithoutContext('Get wireless device IP (iPv4)', () async {
|
||||||
final MDnsClient client = FakeMDnsClient(
|
final MDnsClient client = FakeMDnsClient(
|
||||||
<PtrResourceRecord>[
|
<PtrResourceRecord>[
|
||||||
PtrResourceRecord('foo', future, domainName: 'bar'),
|
PtrResourceRecord('foo', future, domainName: 'bar'),
|
||||||
@ -367,12 +367,12 @@ void main() {
|
|||||||
final Uri? uri = await portDiscovery.getVMServiceUriForAttach(
|
final Uri? uri = await portDiscovery.getVMServiceUriForAttach(
|
||||||
'bar',
|
'bar',
|
||||||
device,
|
device,
|
||||||
isNetworkDevice: true,
|
useDeviceIPAsHost: true,
|
||||||
);
|
);
|
||||||
expect(uri.toString(), 'http://111.111.111.111:1234/xyz/');
|
expect(uri.toString(), 'http://111.111.111.111:1234/xyz/');
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('Get network device IP (iPv6)', () async {
|
testWithoutContext('Get wireless device IP (iPv6)', () async {
|
||||||
final MDnsClient client = FakeMDnsClient(
|
final MDnsClient client = FakeMDnsClient(
|
||||||
<PtrResourceRecord>[
|
<PtrResourceRecord>[
|
||||||
PtrResourceRecord('foo', future, domainName: 'bar'),
|
PtrResourceRecord('foo', future, domainName: 'bar'),
|
||||||
@ -404,7 +404,7 @@ void main() {
|
|||||||
final Uri? uri = await portDiscovery.getVMServiceUriForAttach(
|
final Uri? uri = await portDiscovery.getVMServiceUriForAttach(
|
||||||
'bar',
|
'bar',
|
||||||
device,
|
device,
|
||||||
isNetworkDevice: true,
|
useDeviceIPAsHost: true,
|
||||||
);
|
);
|
||||||
expect(uri.toString(), 'http://[1111:1111:1111:1111:1111:1111:1111:1111]:1234/xyz/');
|
expect(uri.toString(), 'http://[1111:1111:1111:1111:1111:1111:1111:1111]:1234/xyz/');
|
||||||
});
|
});
|
||||||
@ -557,7 +557,7 @@ void main() {
|
|||||||
expect(uri.toString(), 'http://127.0.0.1:123/');
|
expect(uri.toString(), 'http://127.0.0.1:123/');
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('Get network device IP (iPv4)', () async {
|
testWithoutContext('Get wireless device IP (iPv4)', () async {
|
||||||
final MDnsClient client = FakeMDnsClient(
|
final MDnsClient client = FakeMDnsClient(
|
||||||
<PtrResourceRecord>[
|
<PtrResourceRecord>[
|
||||||
PtrResourceRecord('foo', future, domainName: 'bar'),
|
PtrResourceRecord('foo', future, domainName: 'bar'),
|
||||||
@ -588,13 +588,13 @@ void main() {
|
|||||||
final Uri? uri = await portDiscovery.getVMServiceUriForLaunch(
|
final Uri? uri = await portDiscovery.getVMServiceUriForLaunch(
|
||||||
'bar',
|
'bar',
|
||||||
device,
|
device,
|
||||||
isNetworkDevice: true,
|
useDeviceIPAsHost: true,
|
||||||
deviceVmservicePort: 1234,
|
deviceVmservicePort: 1234,
|
||||||
);
|
);
|
||||||
expect(uri.toString(), 'http://111.111.111.111:1234/xyz/');
|
expect(uri.toString(), 'http://111.111.111.111:1234/xyz/');
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('Get network device IP (iPv6)', () async {
|
testWithoutContext('Get wireless device IP (iPv6)', () async {
|
||||||
final MDnsClient client = FakeMDnsClient(
|
final MDnsClient client = FakeMDnsClient(
|
||||||
<PtrResourceRecord>[
|
<PtrResourceRecord>[
|
||||||
PtrResourceRecord('foo', future, domainName: 'bar'),
|
PtrResourceRecord('foo', future, domainName: 'bar'),
|
||||||
@ -625,7 +625,7 @@ void main() {
|
|||||||
final Uri? uri = await portDiscovery.getVMServiceUriForLaunch(
|
final Uri? uri = await portDiscovery.getVMServiceUriForLaunch(
|
||||||
'bar',
|
'bar',
|
||||||
device,
|
device,
|
||||||
isNetworkDevice: true,
|
useDeviceIPAsHost: true,
|
||||||
deviceVmservicePort: 1234,
|
deviceVmservicePort: 1234,
|
||||||
);
|
);
|
||||||
expect(uri.toString(), 'http://[1111:1111:1111:1111:1111:1111:1111:1111]:1234/xyz/');
|
expect(uri.toString(), 'http://[1111:1111:1111:1111:1111:1111:1111:1111]:1234/xyz/');
|
||||||
@ -755,7 +755,7 @@ void main() {
|
|||||||
final MDnsVmServiceDiscoveryResult? result = await portDiscovery.firstMatchingVmService(
|
final MDnsVmServiceDiscoveryResult? result = await portDiscovery.firstMatchingVmService(
|
||||||
client,
|
client,
|
||||||
applicationId: 'srv-foo',
|
applicationId: 'srv-foo',
|
||||||
isNetworkDevice: true,
|
useDeviceIPAsHost: true,
|
||||||
);
|
);
|
||||||
expect(result?.domainName, 'srv-foo');
|
expect(result?.domainName, 'srv-foo');
|
||||||
expect(result?.port, 111);
|
expect(result?.port, 111);
|
||||||
@ -792,7 +792,7 @@ void main() {
|
|||||||
final MDnsVmServiceDiscoveryResult? result = await portDiscovery.firstMatchingVmService(
|
final MDnsVmServiceDiscoveryResult? result = await portDiscovery.firstMatchingVmService(
|
||||||
client,
|
client,
|
||||||
applicationId: 'srv-foo',
|
applicationId: 'srv-foo',
|
||||||
isNetworkDevice: true,
|
useDeviceIPAsHost: true,
|
||||||
);
|
);
|
||||||
expect(result?.domainName, 'srv-foo');
|
expect(result?.domainName, 'srv-foo');
|
||||||
expect(result?.port, 111);
|
expect(result?.port, 111);
|
||||||
@ -829,7 +829,7 @@ void main() {
|
|||||||
final MDnsVmServiceDiscoveryResult? result = await portDiscovery.firstMatchingVmService(
|
final MDnsVmServiceDiscoveryResult? result = await portDiscovery.firstMatchingVmService(
|
||||||
client,
|
client,
|
||||||
applicationId: 'srv-foo',
|
applicationId: 'srv-foo',
|
||||||
isNetworkDevice: true,
|
useDeviceIPAsHost: true,
|
||||||
);
|
);
|
||||||
expect(result?.domainName, 'srv-foo');
|
expect(result?.domainName, 'srv-foo');
|
||||||
expect(result?.port, 111);
|
expect(result?.port, 111);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user