summaryrefslogtreecommitdiffstats
path: root/mkspecs
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2016-07-25 14:02:43 +0200
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2016-08-24 13:05:09 +0000
commit86ebd92addfcb6168875351f5af2fab89be3730f (patch)
treebf282e00b94aaff03ddd781c1e24d90f8c357041 /mkspecs
parent0f8c2ab3d89dd49d89ae53cfefa83e38ea3c3c17 (diff)
iOS, mkspec: update UUID parsing to support Xcode 8 beta
"simctl list devices" has changed output format in Xcode 8 beta to include additional information placed inside parentheses for each device. And this confuses the scripts we use to parse and find UUIDs. Instead of making the inline scripts even longer and more complex, this patch will factor most of it out to a separate perl script that reads out device information on json format and parses the UUID. Change-Id: I3cd4dc276ecda030fda1932073c8bf1e0bc85deb Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Diffstat (limited to 'mkspecs')
-rwxr-xr-xmkspecs/macx-ios-clang/ios_destinations.sh3
-rwxr-xr-xmkspecs/macx-ios-clang/ios_devices.pl50
-rw-r--r--mkspecs/macx-ios-clang/xcodebuild.mk5
3 files changed, 55 insertions, 3 deletions
diff --git a/mkspecs/macx-ios-clang/ios_destinations.sh b/mkspecs/macx-ios-clang/ios_destinations.sh
index ce6b238a65..b85f59ca30 100755
--- a/mkspecs/macx-ios-clang/ios_destinations.sh
+++ b/mkspecs/macx-ios-clang/ios_destinations.sh
@@ -33,7 +33,8 @@
##
#############################################################################
-booted_simulator=$(xcrun simctl list devices | grep -E "iPhone|iPad" | grep -v unavailable | grep Booted | perl -lne 'print $1 if /\((.*?)\)/')
+DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+booted_simulator=$($DIR/ios_devices.pl "iPhone|iPad" "Booted" "NOT unavailable" | tail -n 1)
echo "IPHONESIMULATOR_DEVICES = $booted_simulator"
xcodebuild test -scheme $1 -destination 'id=0' -destination-timeout 1 2>&1| sed -n 's/{ \(platform:.*\) }/\1/p' | while read destination; do
diff --git a/mkspecs/macx-ios-clang/ios_devices.pl b/mkspecs/macx-ios-clang/ios_devices.pl
new file mode 100755
index 0000000000..eb45d1dab9
--- /dev/null
+++ b/mkspecs/macx-ios-clang/ios_devices.pl
@@ -0,0 +1,50 @@
+#!/usr/bin/perl
+
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: http://www.qt.io/licensing/
+##
+## This file is the build configuration utility of the Qt Toolkit.
+##
+## $QT_BEGIN_LICENSE:LGPL21$
+## Commercial License Usage
+## Licensees holding valid commercial Qt licenses may use this file in
+## accordance with the commercial license agreement provided with the
+## Software or, alternatively, in accordance with the terms contained in
+## a written agreement between you and The Qt Company. For licensing terms
+## and conditions see http://www.qt.io/terms-conditions. For further
+## information use the contact form at http://www.qt.io/contact-us.
+##
+## GNU Lesser General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU Lesser
+## General Public License version 2.1 or version 3 as published by the Free
+## Software Foundation and appearing in the file LICENSE.LGPLv21 and
+## LICENSE.LGPLv3 included in the packaging of this file. Please review the
+## following information to ensure the GNU Lesser General Public License
+## requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+##
+## As a special exception, The Qt Company gives you certain additional
+## rights. These rights are described in The Qt Company LGPL Exception
+## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+$output = `xcrun simctl list devices --json 2>&1`;
+$output =~ s/\n//g;
+
+BLOCK:
+foreach $block ($output =~ /{.*?}/g) {
+ foreach $filter (@ARGV) {
+ if ($filter =~ /^NOT\s(.*)/) {
+ $block =~ /$1/ && next BLOCK;
+ } else {
+ $block =~ /$filter/ || next BLOCK;
+ }
+ }
+ $block =~ /udid[:|\s|\"]+(.*)\"/;
+ print "$1\n";
+}
diff --git a/mkspecs/macx-ios-clang/xcodebuild.mk b/mkspecs/macx-ios-clang/xcodebuild.mk
index 1bd18430df..bf6b791368 100644
--- a/mkspecs/macx-ios-clang/xcodebuild.mk
+++ b/mkspecs/macx-ios-clang/xcodebuild.mk
@@ -56,11 +56,12 @@ iphonesimulator-install: ACTION = build
release-%: CONFIGURATION = Release
debug-%: CONFIGURATION = Debug
+SPECDIR := $(dir $(lastword $(MAKEFILE_LIST)))
+
# Test and build (device) destinations
ifneq ($(filter check%,$(MAKECMDGOALS)),)
ifeq ($(DEVICES),)
$(info Enumerating test destinations (you may override this by setting DEVICES explicitly), please wait...)
- SPECDIR := $(dir $(lastword $(MAKEFILE_LIST)))
DESTINATIONS_INCLUDE = /tmp/ios_destinations.mk
$(shell $(SPECDIR)/ios_destinations.sh $(TARGET) > $(DESTINATIONS_INCLUDE))
include $(DESTINATIONS_INCLUDE)
@@ -71,7 +72,7 @@ endif
%-iphoneos: DEVICES = $(IPHONEOS_DEVICES)
IPHONEOS_GENERIC_DESTINATION := "generic/platform=iOS"
-IPHONESIMULATOR_GENERIC_DESTINATION := "id=$(shell xcrun simctl list devices | grep -E 'iPhone|iPad' | grep -v unavailable | perl -lne 'print $$1 if /\((.*?)\)/' | tail -n 1)"
+IPHONESIMULATOR_GENERIC_DESTINATION := "id=$(shell $(SPECDIR)/ios_devices.pl "iPhone|iPad" "NOT unavailable" | tail -n 1)"
DESTINATION = $(if $(DESTINATION_ID),"id=$(DESTINATION_ID)",$(value $(call toupper,$(call basesdk,$(SDK)))_GENERIC_DESTINATION))