Unverified Commit 66d77ca0 authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Support armv7s architecture (#54989)

parent 96f80055
......@@ -400,6 +400,7 @@ DarwinArch getIOSArchForName(String arch) {
switch (arch) {
case 'armv7':
case 'armv7f': // iPhone 4S.
case 'armv7s': // iPad 4.
return DarwinArch.armv7;
case 'arm64':
case 'arm64e': // iPhone XS/XS Max/XR and higher. arm64 runs on arm64e devices.
......
......@@ -435,8 +435,13 @@ class XCDevice {
} on Exception {
// Fallback to default iOS architecture. Future-proof against a
// theoretical version of Xcode that changes this string to something
// slightly different like "ARM64".
cpuArchitecture ??= defaultIOSArchs.first;
// slightly different like "ARM64", or armv7 variations like
// armv7s and armv7f.
if (architecture.startsWith('armv7')) {
cpuArchitecture = DarwinArch.armv7;
} else {
cpuArchitecture = defaultIOSArchs.first;
}
_logger.printError(
'Unknown architecture $architecture, defaulting to '
'${getNameForDarwinArch(cpuArchitecture)}',
......
......@@ -443,6 +443,50 @@ void main() {
}, overrides: <Type, Generator>{
Platform: () => macPlatform,
});
testUsingContext('handles unknown architectures', () async {
when(mockXcode.isInstalledAndMeetsVersionCheck).thenReturn(true);
when(processManager.runSync(<String>['xcrun', '--find', 'xcdevice']))
.thenReturn(ProcessResult(1, 0, '/path/to/xcdevice', ''));
const String devicesOutput = '''
[
{
"simulator" : false,
"operatingSystemVersion" : "13.3 (17C54)",
"interface" : "usb",
"available" : true,
"platform" : "com.apple.platform.iphoneos",
"modelCode" : "iPhone8,1",
"identifier" : "d83d5bc53967baa0ee18626ba87b6254b2ab5418",
"architecture" : "armv7x",
"modelName" : "iPad 3 BOGUS",
"name" : "iPad"
},
{
"simulator" : false,
"operatingSystemVersion" : "13.3 (17C54)",
"interface" : "usb",
"available" : true,
"platform" : "com.apple.platform.iphoneos",
"modelCode" : "iPhone8,1",
"identifier" : "d83d5bc53967baa0ee18626ba87b6254b2ab5418",
"architecture" : "BOGUS",
"modelName" : "Future iPad",
"name" : "iPad"
}
]
''';
when(processManager.run(<String>['xcrun', 'xcdevice', 'list', '--timeout', '2']))
.thenAnswer((_) => Future<ProcessResult>.value(ProcessResult(1, 0, devicesOutput, '')));
final List<IOSDevice> devices = await xcdevice.getAvailableTetheredIOSDevices();
expect(devices[0].cpuArchitecture, DarwinArch.armv7);
expect(devices[1].cpuArchitecture, DarwinArch.arm64);
}, overrides: <Type, Generator>{
Platform: () => macPlatform,
});
});
group('diagnostics', () {
......
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