XcodeHelper: search for default iPhone simulator device id with a regular expression instead of a specific string

Previously, the value was "iphone-11". Now the regex is ~/iphone-\d+/g

As long as the naming scheme stays the same, this should choose the newest iPhone supported by Xcode, and we won't need to update manually anymore, like in commit 72dd60f1c8
This commit is contained in:
Josh Tynjala
2023-04-11 16:02:14 -07:00
parent 04b69a9cef
commit 1ac0810895

View File

@@ -6,7 +6,7 @@ import lime.tools.HXProject;
class XCodeHelper
{
private static inline var DEFAULT_IPAD_SIMULATOR = "ipad-air";
private static inline var DEFAULT_IPHONE_SIMULATOR = "iphone-11";
private static var DEFAULT_IPHONE_SIMULATOR_REGEX = ~/iphone-\d+/g;
private static function extractSimulatorFlagName(line:String):String
{
@@ -92,7 +92,14 @@ class XCodeHelper
}
else
{
currentDevice = devices.get(DEFAULT_IPHONE_SIMULATOR);
for (device in devices.keys())
{
if (DEFAULT_IPHONE_SIMULATOR_REGEX.match(device))
{
currentDevice = devices.get(device);
break;
}
}
}
}