adds build number of ios device in flutter devices command (#84512)
This commit is contained in:
committed by
GitHub
parent
b9bf576933
commit
604c59e522
@@ -465,7 +465,7 @@ class IOSDevice extends Device {
|
||||
Future<TargetPlatform> get targetPlatform async => TargetPlatform.ios;
|
||||
|
||||
@override
|
||||
Future<String> get sdkNameAndVersion async => 'iOS $_sdkVersion';
|
||||
Future<String> get sdkNameAndVersion async => 'iOS ${_sdkVersion ?? 'unknown version'}';
|
||||
|
||||
@override
|
||||
DeviceLogReader getLogReader({
|
||||
|
||||
@@ -301,12 +301,21 @@ class XCDevice {
|
||||
continue;
|
||||
}
|
||||
|
||||
String sdkVersion = _sdkVersion(device);
|
||||
|
||||
if (sdkVersion != null) {
|
||||
final String buildVersion = _buildVersion(device);
|
||||
if (buildVersion != null) {
|
||||
sdkVersion = '$sdkVersion $buildVersion';
|
||||
}
|
||||
}
|
||||
|
||||
devices.add(IOSDevice(
|
||||
device['identifier'] as String,
|
||||
name: device['name'] as String,
|
||||
cpuArchitecture: _cpuArchitecture(device),
|
||||
interfaceType: interface,
|
||||
sdkVersion: _sdkVersion(device),
|
||||
sdkVersion: sdkVersion,
|
||||
iProxy: _iProxy,
|
||||
fileSystem: globals.fs,
|
||||
logger: _logger,
|
||||
@@ -317,6 +326,7 @@ class XCDevice {
|
||||
}
|
||||
}
|
||||
return devices;
|
||||
|
||||
}
|
||||
|
||||
/// Despite the name, com.apple.platform.iphoneos includes iPhone, iPads, and all iOS devices.
|
||||
@@ -363,7 +373,20 @@ class XCDevice {
|
||||
// "13.3 (17C54)"
|
||||
final RegExp operatingSystemRegex = RegExp(r'(.*) \(.*\)$');
|
||||
final String operatingSystemVersion = deviceProperties['operatingSystemVersion'] as String;
|
||||
return operatingSystemRegex.firstMatch(operatingSystemVersion.trim())?.group(1);
|
||||
if(operatingSystemRegex.hasMatch(operatingSystemVersion.trim())) {
|
||||
return operatingSystemRegex.firstMatch(operatingSystemVersion.trim())?.group(1);
|
||||
}
|
||||
return operatingSystemVersion;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static String _buildVersion(Map<String, dynamic> deviceProperties) {
|
||||
if (deviceProperties.containsKey('operatingSystemVersion')) {
|
||||
// Parse out the build version, for example 17C54 from "13.3 (17C54)".
|
||||
final RegExp buildVersionRegex = RegExp(r'\(.*\)$');
|
||||
final String operatingSystemVersion = deviceProperties['operatingSystemVersion'] as String;
|
||||
return buildVersionRegex.firstMatch(operatingSystemVersion)?.group(0)?.replaceAll(RegExp('[()]'), '');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user