From 76b61384a2cf6cffcb7b7895b6df18a097682910 Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Mon, 9 Nov 2015 14:21:51 -0500 Subject: [PATCH] Switch ObjC Travis testing to using xctool xctool is preinstalled on the Travis OS X images and it seems to do better with iOS simulator flake, so use it instead of xcodebuild. xctool also is less chatty compared to xcodebuild, so it makes the logs a little easier to read. --- travis.sh | 49 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/travis.sh b/travis.sh index 3f281e7af3..3b6ec3362f 100755 --- a/travis.sh +++ b/travis.sh @@ -129,18 +129,55 @@ internal_install_python_deps() { fi } -build_objectivec_common () { - # Reused the build script that takes care of configure and then Xcode - # builds/tests. - objectivec/DevTools/full_mac_build.sh --core-only "$@" +internal_objectivec_common () { + # Make sure xctool is up to date. Adapted from + # http://docs.travis-ci.com/user/osx-ci-environment/ + # We don't use a before_install because we test multiple OSes. + brew update + brew outdated xctool || brew upgrade xctool + # Reused the build script that takes care of configuring and ensuring things + # are up to date. + objectivec/DevTools/full_mac_build.sh --core-only --skip-xcode +} + +internal_xctool_debug_and_release() { + xctool -configuration Debug "$@" + xctool -configuration Release "$@" } build_objectivec_ios() { - build_objectivec_common --skip-xcode-osx + internal_objectivec_common + # https://github.com/facebook/xctool/issues/509 - unlike xcodebuild, xctool + # doesn't support >1 destination, so we have to build first and then run the + # tests one destination at a time. + internal_xctool_debug_and_release \ + -project objectivec/ProtocolBuffers_iOS.xcodeproj \ + -scheme ProtocolBuffers \ + -sdk iphonesimulator \ + build-tests + IOS_DESTINATIONS=( + "platform=iOS Simulator,name=iPhone 4s,OS=8.1" # 32bit + "platform=iOS Simulator,name=iPhone 6,OS=9.1" # 64bit + "platform=iOS Simulator,name=iPad 2,OS=8.1" # 32bit + "platform=iOS Simulator,name=iPad Air,OS=9.1" # 64bit + ) + for i in "${IOS_DESTINATIONS[@]}" ; do + internal_xctool_debug_and_release \ + -project objectivec/ProtocolBuffers_iOS.xcodeproj \ + -scheme ProtocolBuffers \ + -sdk iphonesimulator \ + -destination "${i}" \ + run-tests + done } build_objectivec_osx() { - build_objectivec_common --skip-xcode-ios + internal_objectivec_common + internal_xctool_debug_and_release \ + -project objectivec/ProtocolBuffers_OSX.xcodeproj \ + -scheme ProtocolBuffers \ + -destination "platform=OS X,arch=x86_64" \ + test } build_python() {