summaryrefslogtreecommitdiffstats
path: root/mkspecs
diff options
context:
space:
mode:
authorMike Krus <mike.krus@kdab.com>2019-07-19 16:00:57 +0100
committerMike Krus <mike.krus@kdab.com>2019-07-21 14:05:15 +0100
commitb202d45026229e0517e80a6e82041d5fc89d9d23 (patch)
tree8523feaeb92e37ec96208a0fa912e9362b2ec083 /mkspecs
parent857e4881c66b5db5c8cab654d33fafe5db55396c (diff)
Make simulator detection work with Xcode 11
Beta version of Xcode 11 changes the format of the json object returned by simctl and used to detect running simulators. While multiple versions of Xcode can coexist on the same system, they share the same simulator infrastructure so installing Xcode 11 Beta affects projects using previous versions. Change-Id: Icf06a794aa5ba3624163ace2ce827c0ecf97c38c Reviewed-by: Frank Osterfeld <frank.osterfeld@kdab.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'mkspecs')
-rwxr-xr-xmkspecs/features/uikit/devices.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/mkspecs/features/uikit/devices.py b/mkspecs/features/uikit/devices.py
index 0443e838f2..8cdcb370a0 100755
--- a/mkspecs/features/uikit/devices.py
+++ b/mkspecs/features/uikit/devices.py
@@ -46,11 +46,17 @@ import json
import subprocess
from distutils.version import StrictVersion
+def is_available(object):
+ if "isAvailable" in object:
+ return object["isAvailable"] # introduced in Xcode 11
+ else:
+ return "unavailable" not in object["availability"]
+
def is_suitable_runtime(runtimes, runtime_name, platform, min_version):
for runtime in runtimes:
identifier = runtime["identifier"]
if (runtime["name"] == runtime_name or identifier == runtime_name) \
- and "unavailable" not in runtime["availability"] \
+ and is_available(runtime) \
and identifier.startswith("com.apple.CoreSimulator.SimRuntime.{}".format(platform)) \
and StrictVersion(runtime["version"]) >= min_version:
return True
@@ -77,6 +83,6 @@ if __name__ == "__main__":
for runtime_name in device_dict:
if is_suitable_runtime(runtimes, runtime_name, args.platform, args.minimum_deployment_target):
for device in device_dict[runtime_name]:
- if "unavailable" not in device["availability"] \
+ if is_available(device) \
and (args.state is None or device["state"].lower() in args.state):
print(device["udid"])