summaryrefslogtreecommitdiffstats
path: root/mkspecs/macx-ios-clang/features/default_post.prf
diff options
context:
space:
mode:
Diffstat (limited to 'mkspecs/macx-ios-clang/features/default_post.prf')
-rw-r--r--mkspecs/macx-ios-clang/features/default_post.prf45
1 files changed, 25 insertions, 20 deletions
diff --git a/mkspecs/macx-ios-clang/features/default_post.prf b/mkspecs/macx-ios-clang/features/default_post.prf
index f1f23dd716..c9d3a5d85b 100644
--- a/mkspecs/macx-ios-clang/features/default_post.prf
+++ b/mkspecs/macx-ios-clang/features/default_post.prf
@@ -1,14 +1,5 @@
-# In case the user sets the SDK manually
-contains(QMAKE_MAC_SDK, ^iphonesimulator.*) {
- iphonesimulator_and_iphoneos: \
- error("iOS simulator is handled automatically for iphonesimulator_and_iphoneos")
-
- CONFIG += iphonesimulator
-}
-
-iphonesimulator_and_iphoneos:iphonesimulator: \
- QMAKE_MAC_SDK ~= s,^iphoneos,iphonesimulator,
+load(sdk)
# Resolve config so we don't need to use CONFIG() later on
CONFIG(iphonesimulator, iphonesimulator|iphoneos) {
@@ -50,7 +41,6 @@ equals(TEMPLATE, app) {
RESOURCES =
INSTALLS =
QMAKE_EXTRA_COMPILERS =
- QMAKE_EXTRA_TARGETS =
!build_pass {
CONFIG += debug_and_release
@@ -76,8 +66,8 @@ equals(TEMPLATE, app) {
args += $$system_quote($$arg)
system("cd $$system_quote($$OUT_PWD) && $$QMAKE_QMAKE $$args $$system_quote($$_PRO_FILE_) -spec macx-xcode")
- check.commands = "$(MAKE) -f $(MAKEFILE).ReleaseSimulator xcode_build_check"
- QMAKE_EXTRA_TARGETS += check
+ # We have a target, even though our template is aux
+ CONFIG += have_target
} else {
load(resolve_config)
@@ -92,10 +82,13 @@ equals(TEMPLATE, app) {
else: \
cfg = release
- for(action, $$list(build install clean)) {
+ for(action, $$list(build install clean test)) {
equals(action, build) {
action_target_suffix =
action_target = all
+ } else: equals(action, test) {
+ action_target_suffix = -check
+ action_target = check
} else {
action_target_suffix = -$$action
action_target = $$action
@@ -103,7 +96,24 @@ equals(TEMPLATE, app) {
target = $${sdk}-$${cfg}$${action_target_suffix}
- $${target}.commands = "@bash -o pipefail -c 'xcodebuild $$action -sdk $$sdk -configuration $$title($$cfg) | grep -v setenv'"
+ xcodebuild = "xcodebuild $$action -scheme $(TARGET) -sdk $$sdk -configuration $$title($$cfg)"
+
+ equals(action, test):equals(sdk, iphoneos) {
+ AVAILABLE_DEVICE_IDS = "$(shell system_profiler SPUSBDataType | sed -n -E -e '/(iPhone|iPad|iPod)/,/Serial/s/ *Serial Number: *(.+)/\1/p')"
+ CUSTOM_DEVICE_IDS = "$(filter $(EXPORT_AVAILABLE_DEVICE_IDS), $(IOS_TEST_DEVICE_IDS))"
+ TEST_DEVICE_IDS = "$(strip $(if $(EXPORT_CUSTOM_DEVICE_IDS), $(EXPORT_CUSTOM_DEVICE_IDS), $(EXPORT_AVAILABLE_DEVICE_IDS)))"
+
+ QMAKE_EXTRA_VARIABLES += AVAILABLE_DEVICE_IDS CUSTOM_DEVICE_IDS TEST_DEVICE_IDS
+
+ xcodebuild = "@$(if $(EXPORT_TEST_DEVICE_IDS),"\
+ "echo Running tests on $(words $(EXPORT_TEST_DEVICE_IDS)) device\\(s\\): && ("\
+ "$(foreach deviceid, $(EXPORT_TEST_DEVICE_IDS),"\
+ "(echo Testing on device ID '$(deviceid)' ... && $${xcodebuild} -destination 'platform=iOS,id=$(deviceid)' && echo) &&"\
+ ") echo Tests completed successfully on all devices"\
+ "), $(error No iOS devices connected, please connect at least one device that can be used for testing.))"
+ }
+
+ $${target}.commands = $$xcodebuild
QMAKE_EXTRA_TARGETS += $$target
$${action_target}.depends += $$target
@@ -115,12 +125,7 @@ equals(TEMPLATE, app) {
QMAKE_EXTRA_TARGETS += xcode_build_dir_distclean
distclean.depends = xcode_build_dir_distclean
QMAKE_EXTRA_TARGETS += distclean
-
- xcode_build_check.commands = "$(TESTRUNNER) $$title($$cfg)-$${sdk}/$(TARGET).app $(TESTARGS)"
- QMAKE_EXTRA_TARGETS += xcode_build_check
}
-
- CONFIG =
}
}
} else: equals(TEMPLATE, lib) {