Title: [280622] trunk/Tools
Revision
280622
Author
jbed...@apple.com
Date
2021-08-03 16:40:10 -0700 (Tue, 03 Aug 2021)

Log Message

[webkitpy] Handle case where no existing simulators are defined
https://bugs.webkit.org/show_bug.cgi?id=228758
<rdar://problem/81484040>

Reviewed by Ryan Haddad.

* Scripts/webkitpy/xcode/simulated_device.py:
(SimulatedDeviceManager._disambiguate_device_type): If there are no available devices,
find the newest device identifier which matches the requested type.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (280621 => 280622)


--- trunk/Tools/ChangeLog	2021-08-03 23:14:44 UTC (rev 280621)
+++ trunk/Tools/ChangeLog	2021-08-03 23:40:10 UTC (rev 280622)
@@ -1,5 +1,17 @@
 2021-08-03  Jonathan Bedard  <jbed...@apple.com>
 
+        [webkitpy] Handle case where no existing simulators are defined
+        https://bugs.webkit.org/show_bug.cgi?id=228758
+        <rdar://problem/81484040>
+
+        Reviewed by Ryan Haddad.
+
+        * Scripts/webkitpy/xcode/simulated_device.py:
+        (SimulatedDeviceManager._disambiguate_device_type): If there are no available devices,
+        find the newest device identifier which matches the requested type.
+
+2021-08-03  Jonathan Bedard  <jbed...@apple.com>
+
         [build.webkit.org] Simulator temp files filling up disk (Follow-up fix)
         https://bugs.webkit.org/show_bug.cgi?id=228335
         <rdar://problem/81171840>

Modified: trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py (280621 => 280622)


--- trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py	2021-08-03 23:14:44 UTC (rev 280621)
+++ trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py	2021-08-03 23:40:10 UTC (rev 280622)
@@ -243,12 +243,19 @@
 
         if full_device_type.hardware_type is None:
             # Again, we use the existing devices to determine a legal hardware type
-            for name in SimulatedDeviceManager._device_identifier_to_name.values():
-                type_from_name = DeviceType.from_string(name)
-                if type_from_name == full_device_type:
-                    full_device_type.hardware_type = type_from_name.hardware_type
+            for device in SimulatedDeviceManager.AVAILABLE_DEVICES:
+                if device.device_type == full_device_type:
+                    full_device_type.hardware_type = device.device_type.hardware_type
                     break
 
+        if not full_device_type.hardware_family or not full_device_type.hardware_type:
+            # If we couldn't define a device with existing devices, pick the newest matching device type
+            for _, type_name in reversed(SimulatedDeviceManager._device_identifier_to_name.items()):
+                candidate = DeviceType.from_string(type_name)
+                if candidate == full_device_type:
+                    full_device_type = candidate
+                    break
+
         full_device_type.check_consistency()
         return full_device_type
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to