From 55b45c00d02697d38202da86ca49d5f1a3520c02 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Wed, 20 May 2020 13:41:46 -0700 Subject: [PATCH 01/13] Add Xcode 11.5 --- .jenkins.yml | 153 ++++++++++++++++++++++++++++++++++++ CHANGELOG.md | 4 +- Jenkinsfile.releasability | 6 +- build.sh | 2 +- scripts/package_examples.rb | 2 +- scripts/pr-ci-matrix.rb | 2 +- 6 files changed, 161 insertions(+), 8 deletions(-) diff --git a/.jenkins.yml b/.jenkins.yml index 7e7c3b13b8..87d8d4fc9a 100644 --- a/.jenkins.yml +++ b/.jenkins.yml @@ -9,6 +9,7 @@ xcode_version: - 11.2.1 - 11.3 - 11.4.1 + - 11.5 target: - docs - swiftlint @@ -75,6 +76,14 @@ exclude: target: docs configuration: Debug + - xcode_version: 11.4.1 + target: docs + configuration: Release + + - xcode_version: 11.5 + target: docs + configuration: Debug + - xcode_version: 10.3 target: swiftlint configuration: Debug @@ -111,6 +120,14 @@ exclude: target: swiftlint configuration: Debug + - xcode_version: 11.4.1 + target: swiftlint + configuration: Release + + - xcode_version: 11.5 + target: swiftlint + configuration: Debug + - xcode_version: 10.3 target: osx-encryption configuration: Debug @@ -143,6 +160,14 @@ exclude: target: osx-encryption configuration: Debug + - xcode_version: 11.4.1 + target: osx-encryption + configuration: Release + + - xcode_version: 11.5 + target: osx-encryption + configuration: Debug + - xcode_version: 10.3 target: osx-object-server configuration: Debug @@ -175,6 +200,14 @@ exclude: target: osx-object-server configuration: Debug + - xcode_version: 11.4.1 + target: osx-object-server + configuration: Release + + - xcode_version: 11.5 + target: osx-object-server + configuration: Debug + - xcode_version: 10.3 target: ios-static configuration: Debug @@ -207,6 +240,14 @@ exclude: target: ios-static configuration: Debug + - xcode_version: 11.4.1 + target: ios-static + configuration: Release + + - xcode_version: 11.5 + target: ios-static + configuration: Debug + - xcode_version: 10.3 target: ios-dynamic configuration: Debug @@ -239,6 +280,14 @@ exclude: target: ios-dynamic configuration: Debug + - xcode_version: 11.4.1 + target: ios-dynamic + configuration: Release + + - xcode_version: 11.5 + target: ios-dynamic + configuration: Debug + - xcode_version: 10.3 target: watchos configuration: Debug @@ -271,6 +320,14 @@ exclude: target: watchos configuration: Debug + - xcode_version: 11.4.1 + target: watchos + configuration: Release + + - xcode_version: 11.5 + target: watchos + configuration: Debug + - xcode_version: 10.3 target: tvos configuration: Debug @@ -303,6 +360,14 @@ exclude: target: tvos configuration: Debug + - xcode_version: 11.4.1 + target: tvos + configuration: Release + + - xcode_version: 11.5 + target: tvos + configuration: Debug + - xcode_version: 10.3 target: ios-swift configuration: Debug @@ -335,6 +400,14 @@ exclude: target: ios-swift configuration: Debug + - xcode_version: 11.4.1 + target: ios-swift + configuration: Release + + - xcode_version: 11.5 + target: ios-swift + configuration: Debug + - xcode_version: 10.3 target: tvos-swift configuration: Debug @@ -367,6 +440,14 @@ exclude: target: tvos-swift configuration: Debug + - xcode_version: 11.4.1 + target: tvos-swift + configuration: Release + + - xcode_version: 11.5 + target: tvos-swift + configuration: Debug + - xcode_version: 10.3 target: catalyst configuration: Debug @@ -387,6 +468,10 @@ exclude: target: catalyst configuration: Debug + - xcode_version: 11.4.1 + target: catalyst + configuration: Debug + - xcode_version: 10.3 target: catalyst-swift configuration: Debug @@ -407,6 +492,10 @@ exclude: target: catalyst-swift configuration: Debug + - xcode_version: 11.4.1 + target: catalyst-swift + configuration: Debug + - xcode_version: 10.3 target: xcframework configuration: Debug @@ -443,6 +532,14 @@ exclude: target: xcframework configuration: Debug + - xcode_version: 11.4.1 + target: xcframework + configuration: Release + + - xcode_version: 11.5 + target: xcframework + configuration: Debug + - xcode_version: 10.3 target: cocoapods-osx configuration: Debug @@ -463,6 +560,10 @@ exclude: target: cocoapods-osx configuration: Debug + - xcode_version: 11.5 + target: cocoapods-osx + configuration: Debug + - xcode_version: 10.3 target: cocoapods-ios configuration: Debug @@ -495,6 +596,14 @@ exclude: target: cocoapods-ios configuration: Debug + - xcode_version: 11.4.1 + target: cocoapods-ios + configuration: Release + + - xcode_version: 11.5 + target: cocoapods-ios + configuration: Debug + - xcode_version: 10.3 target: cocoapods-ios-dynamic configuration: Debug @@ -527,6 +636,14 @@ exclude: target: cocoapods-ios-dynamic configuration: Debug + - xcode_version: 11.4.1 + target: cocoapods-ios-dynamic + configuration: Release + + - xcode_version: 11.5 + target: cocoapods-ios-dynamic + configuration: Debug + - xcode_version: 10.3 target: cocoapods-watchos configuration: Debug @@ -559,6 +676,14 @@ exclude: target: cocoapods-watchos configuration: Debug + - xcode_version: 11.4.1 + target: cocoapods-watchos + configuration: Release + + - xcode_version: 11.5 + target: cocoapods-watchos + configuration: Debug + - xcode_version: 10.3 target: swiftpm configuration: Debug @@ -579,6 +704,10 @@ exclude: target: swiftpm configuration: Debug + - xcode_version: 11.4.1 + target: swiftpm + configuration: Debug + - xcode_version: 10.3 target: swiftpm-address configuration: Debug @@ -615,6 +744,14 @@ exclude: target: swiftpm-address configuration: Debug + - xcode_version: 11.4.1 + target: swiftpm-address + configuration: Release + + - xcode_version: 11.5 + target: swiftpm-address + configuration: Debug + - xcode_version: 10.3 target: swiftpm-thread configuration: Debug @@ -651,6 +788,14 @@ exclude: target: swiftpm-thread configuration: Debug + - xcode_version: 11.4.1 + target: swiftpm-thread + configuration: Release + + - xcode_version: 11.5 + target: swiftpm-thread + configuration: Debug + - xcode_version: 10.3 target: swiftpm-ios configuration: Debug @@ -686,3 +831,11 @@ exclude: - xcode_version: 11.4.1 target: swiftpm-ios configuration: Debug + + - xcode_version: 11.4.1 + target: swiftpm-ios + configuration: Release + + - xcode_version: 11.5 + target: swiftpm-ios + configuration: Debug diff --git a/CHANGELOG.md b/CHANGELOG.md index 02bc0cc479..edc4d46e71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ x.y.z Release notes (yyyy-MM-dd) ============================================================= ### Enhancements -* None. +* Add prebuilt binary for Xcode 11.5 to the release package. ### Fixed * Fix linker error when building a xcframework for Catalyst. @@ -19,7 +19,7 @@ x.y.z Release notes (yyyy-MM-dd) * Realm Object Server: 3.21.0 or later. * Realm Studio: 3.11 or later. * APIs are backwards compatible with all previous releases in the 5.x.y series. -* Carthage release for Swift is built with Xcode 11.4.1. +* Carthage release for Swift is built with Xcode 11.5. ### Internal * Upgraded realm-core from ? to ? diff --git a/Jenkinsfile.releasability b/Jenkinsfile.releasability index 6e22446ec6..a00bf6794f 100644 --- a/Jenkinsfile.releasability +++ b/Jenkinsfile.releasability @@ -1,10 +1,10 @@ -xcodeVersions = ['10.3', '11.1', '11.2.1', '11.3', '11.4.1'] +xcodeVersions = ['10.3', '11.1', '11.2.1', '11.3', '11.4.1', '11.5'] platforms = ['osx', 'ios', 'watchos', 'tvos', 'catalyst'] carthagePlatforms = ['osx', 'ios', 'watchos', 'tvos'] platformNames = ['osx': 'macOS', 'ios': 'iOS', 'watchos': 'watchOS', 'tvos': 'tvOS', 'catalyst': 'Catalyst'] -carthageXcodeVersion = '11.4.1' +carthageXcodeVersion = '11.5' objcXcodeVersion = '10.3' -docsSwiftVersion = '5.1.2' +docsSwiftVersion = '5.2.4' def installationTest(platform, test, language) { return { diff --git a/build.sh b/build.sh index 7363d66874..274d2a8691 100755 --- a/build.sh +++ b/build.sh @@ -1567,7 +1567,7 @@ x.y.z Release notes (yyyy-MM-dd) * Realm Object Server: 3.21.0 or later. * Realm Studio: 3.11 or later. * APIs are backwards compatible with all previous releases in the 5.x.y series. -* Carthage release for Swift is built with Xcode 11.4.1. +* Carthage release for Swift is built with Xcode 11.5. ### Internal * Upgraded realm-core from ? to ? diff --git a/scripts/package_examples.rb b/scripts/package_examples.rb index 7186c69758..09a87d08ba 100755 --- a/scripts/package_examples.rb +++ b/scripts/package_examples.rb @@ -41,7 +41,7 @@ def replace_in_file(filepath, pattern, replacement) "examples/tvos/swift", ] -xcode_versions = %w(10.3 11.1 11.2.1 11.3 11.4.1) +xcode_versions = %w(10.3 11.1 11.2.1 11.3 11.4.1 11.5) # Remove reference to Realm.xcodeproj from all example workspaces. base_examples.each do |example| diff --git a/scripts/pr-ci-matrix.rb b/scripts/pr-ci-matrix.rb index 2853e9886e..9400dce794 100755 --- a/scripts/pr-ci-matrix.rb +++ b/scripts/pr-ci-matrix.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby # A script to generate the .jenkins.yml file for the CI pull request job -XCODE_VERSIONS = %w(10.3 11.1 11.2.1 11.3 11.4.1) +XCODE_VERSIONS = %w(10.3 11.1 11.2.1 11.3 11.4.1 11.5) CONFIGURATIONS = %w(Debug Release) release_only = ->(v, c) { c == 'Release' } From 85b088586669757d34be9cca395f9c3e1f0bbabc Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Fri, 22 May 2020 12:05:50 -0700 Subject: [PATCH 02/13] Avoid building Realm.framework twice in some CI jobs --- build.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 274d2a8691..174ad1c134 100755 --- a/build.sh +++ b/build.sh @@ -965,7 +965,8 @@ case "$COMMAND" in ;; "verify-osx") - sh build.sh test-osx + REALM_EXTRA_BUILD_ARGUMENTS="$REALM_EXTRA_BUILD_ARGUMENTS -workspace examples/osx/objc/RealmExamples.xcworkspace" \ + sh build.sh test-osx sh build.sh examples-osx ( @@ -1023,13 +1024,15 @@ case "$COMMAND" in ;; "verify-tvos") - sh build.sh test-tvos + REALM_EXTRA_BUILD_ARGUMENTS="$REALM_EXTRA_BUILD_ARGUMENTS -workspace examples/tvos/objc/RealmExamples.xcworkspace" \ + sh build.sh test-tvos sh build.sh examples-tvos exit 0 ;; "verify-tvos-swift") - sh build.sh test-tvos-swift + REALM_EXTRA_BUILD_ARGUMENTS="$REALM_EXTRA_BUILD_ARGUMENTS -workspace examples/tvos/swift/RealmExamples.xcworkspace" \ + sh build.sh test-tvos-swift sh build.sh examples-tvos-swift exit 0 ;; From fcd44ba27d8c48672e28af4354f7587faaa865cc Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Fri, 22 May 2020 13:56:55 -0700 Subject: [PATCH 03/13] Maybe speed up swift-version.sh on CI The first time each Xcode.app directory is touched seems to involve a 30s delay for some reason. --- scripts/swift-version.sh | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/scripts/swift-version.sh b/scripts/swift-version.sh index b514f6a4b6..2f35074cb7 100755 --- a/scripts/swift-version.sh +++ b/scripts/swift-version.sh @@ -8,6 +8,10 @@ get_xcode_version() { "$1" -version 2>/dev/null | sed -ne 's/^Xcode \([^\b ]*\).*/\1/p' } +is_xcode_version() { + test "$(get_xcode_version "$1")" = "$2" +} + find_xcode_with_version() { local path required_version @@ -18,14 +22,23 @@ find_xcode_with_version() { required_version=$1 # First check if the currently active one is fine, unless we are in a CI run - if [ -z "$JENKINS_HOME" ] && [[ $(get_xcode_version xcodebuild) = "$required_version" ]]; then + if [ -z "$JENKINS_HOME" ] && is_xcode_version xcodebuild "$required_version"; then DEVELOPER_DIR=$(xcode-select -p) return 0 fi + # Check the spot where we install it on CI machines + path="/Applications/Xcode-${required_version}.app/Contents/Developer" + if [ -d "$path" ]; then + if is_xcode_version "$path/usr/bin/xcodebuild" "$required_version"; then + DEVELOPER_DIR=$path + return 0 + fi + fi + # Check all of the items in /Applications that look promising per #4534 for path in /Applications/Xcode*.app/Contents/Developer; do - if [ $(get_xcode_version "$path/usr/bin/xcodebuild") = "$required_version" ]; then + if is_xcode_version "$path/usr/bin/xcodebuild" "$required_version"; then DEVELOPER_DIR=$path return 0 fi @@ -37,7 +50,7 @@ find_xcode_with_version() { if [ ! -d "$path" ]; then continue fi - if [ $(get_xcode_version "$path/usr/bin/xcodebuild") = "$required_version" ]; then + if is_xcode_version "$path/usr/bin/xcodebuild" "$required_version"; then DEVELOPER_DIR=$path return 0 fi @@ -56,7 +69,7 @@ test_xcode_for_swift_version() { local required_version=$2 for swift in "$path"/Toolchains/*.xctoolchain/usr/bin/swift; do - if [ $(get_swift_version "$swift") = "$required_version" ]; then + if [ "$(get_swift_version "$swift")" = "$required_version" ]; then return 0 fi done @@ -118,7 +131,7 @@ find_default_xcode_version() { newest_xcode_version=0 for path in $(/usr/bin/mdfind "kMDItemCFBundleIdentifier == 'com.apple.dt.Xcode'" 2>/dev/null); do xcode_version=$(/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" "$path/Contents/Info.plist") - if echo $xcode_version $newest_xcode_version | awk '{exit !( $1 > $2)}'; then + if echo "$xcode_version" "$newest_xcode_version" | awk '{exit !( $1 > $2)}'; then newest_xcode_version="$xcode_version" newest_xcode_path="$path" fi @@ -134,20 +147,20 @@ find_default_xcode_version() { set_xcode_and_swift_versions() { if [ -n "$REALM_XCODE_VERSION" ]; then - find_xcode_with_version $REALM_XCODE_VERSION + find_xcode_with_version "$REALM_XCODE_VERSION" if [ -n "$REALM_SWIFT_VERSION" ] && ! test_xcode_for_swift_version "$DEVELOPER_DIR" "$REALM_SWIFT_VERSION"; then echo "The version of Xcode specified ($REALM_XCODE_VERSION) does not support the Swift version required: $REALM_SWIFT_VERSION" exit 1 fi elif [ -n "$REALM_SWIFT_VERSION" ]; then - find_xcode_for_swift $REALM_SWIFT_VERSION + find_xcode_for_swift "$REALM_SWIFT_VERSION" elif [ -z "$DEVELOPER_DIR" ]; then find_default_xcode_version fi export DEVELOPER_DIR - REALM_XCODE_VERSION=$(get_xcode_version "$DEVELOPER_DIR/usr/bin/xcodebuild") + REALM_XCODE_VERSION="$(get_xcode_version "$DEVELOPER_DIR/usr/bin/xcodebuild")" export REALM_XCODE_VERSION if [ -z "$REALM_SWIFT_VERSION" ]; then From a6137c8da898b1d26a68232087ac5f0871c03006 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Fri, 22 May 2020 14:00:09 -0700 Subject: [PATCH 04/13] Only initialize nvm for jobs which need it --- build.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 174ad1c134..53dbac1c12 100755 --- a/build.sh +++ b/build.sh @@ -1313,8 +1313,10 @@ EOM sh build.sh prelaunch-simulator fi - source $(brew --prefix nvm)/nvm.sh --no-use - export REALM_NODE_PATH="$(nvm which 8)" + if [[ "$target" = *"server"* ]]; then + source $(brew --prefix nvm)/nvm.sh --no-use + export REALM_NODE_PATH="$(nvm which 8)" + fi # Reset CoreSimulator.log mkdir -p ~/Library/Logs/CoreSimulator From 258bc99fd535bb37eefab91d307dc0d43135ef64 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Fri, 22 May 2020 15:50:12 -0700 Subject: [PATCH 05/13] Skip some redundant simulator resetting --- build.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index 53dbac1c12..acc49f7b0e 100755 --- a/build.sh +++ b/build.sh @@ -482,7 +482,9 @@ case "$COMMAND" in ;; "prelaunch-simulator") - sh ${source_root}/scripts/reset-simulators.sh + if [ -z "$REALM_SKIP_PRELAUNCH" ]; then + sh ${source_root}/scripts/reset-simulators.sh + fi ;; ###################################### @@ -982,7 +984,8 @@ case "$COMMAND" in ;; "verify-ios-static") - REALM_EXTRA_BUILD_ARGUMENTS="$REALM_EXTRA_BUILD_ARGUMENTS -workspace examples/ios/objc/RealmExamples.xcworkspace" sh build.sh test-ios-static + REALM_EXTRA_BUILD_ARGUMENTS="$REALM_EXTRA_BUILD_ARGUMENTS -workspace examples/ios/objc/RealmExamples.xcworkspace" \ + sh build.sh test-ios-static sh build.sh examples-ios ;; @@ -991,7 +994,8 @@ case "$COMMAND" in ;; "verify-ios-swift") - REALM_EXTRA_BUILD_ARGUMENTS="$REALM_EXTRA_BUILD_ARGUMENTS -workspace examples/ios/swift/RealmExamples.xcworkspace" sh build.sh test-ios-swift + REALM_EXTRA_BUILD_ARGUMENTS="$REALM_EXTRA_BUILD_ARGUMENTS -workspace examples/ios/swift/RealmExamples.xcworkspace" \ + sh build.sh test-ios-swift sh build.sh examples-ios-swift ;; @@ -1086,6 +1090,8 @@ case "$COMMAND" in ###################################### "examples") sh build.sh clean + sh build.sh prelaunch-simulator + export REALM_SKIP_PRELAUNCH=1 sh build.sh examples-ios sh build.sh examples-ios-swift sh build.sh examples-osx @@ -1309,9 +1315,10 @@ EOM export sha=$GITHUB_PR_SOURCE_BRANCH export CONFIGURATION=$configuration export REALM_EXTRA_BUILD_ARGUMENTS='GCC_GENERATE_DEBUGGING_SYMBOLS=NO -allowProvisioningUpdates' - if [[ ${target} != *"osx"* ]];then + if [[ "$target" = *ios* ]] || [[ "$target" = *tvos* ]] || [[ "$target" = *watchos* ]]; then sh build.sh prelaunch-simulator fi + export REALM_SKIP_PRELAUNCH=1 if [[ "$target" = *"server"* ]]; then source $(brew --prefix nvm)/nvm.sh --no-use From ac340baf8f6ef842e1093437ee7c6172d62223fa Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Fri, 22 May 2020 17:56:44 -0700 Subject: [PATCH 06/13] Upgrade ROS version used in tests and switch to node 10 --- build.sh | 2 +- dependencies.list | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index acc49f7b0e..ad30b32cc8 100755 --- a/build.sh +++ b/build.sh @@ -1322,7 +1322,7 @@ EOM if [[ "$target" = *"server"* ]]; then source $(brew --prefix nvm)/nvm.sh --no-use - export REALM_NODE_PATH="$(nvm which 8)" + export REALM_NODE_PATH="$(nvm which 10)" fi # Reset CoreSimulator.log diff --git a/dependencies.list b/dependencies.list index 7dd6680c41..f2e5d8d156 100644 --- a/dependencies.list +++ b/dependencies.list @@ -1,4 +1,4 @@ VERSION=5.0.0 REALM_CORE_VERSION=6.0.4 REALM_SYNC_VERSION=5.0.3 -REALM_OBJECT_SERVER_VERSION=3.23.1 +REALM_OBJECT_SERVER_VERSION=3.28.5 From 1a5eb90295b4187bdb654343c3989e5178141797 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Fri, 22 May 2020 18:01:28 -0700 Subject: [PATCH 07/13] Disable warnings when building ReactiveCocoa for the example --- examples/ios/objc/Podfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/ios/objc/Podfile b/examples/ios/objc/Podfile index 2899dc30f9..ccccb17799 100644 --- a/examples/ios/objc/Podfile +++ b/examples/ios/objc/Podfile @@ -1,5 +1,5 @@ platform :ios, '7.0' target 'RACTableView' do - pod 'ReactiveCocoa' + pod 'ReactiveCocoa', :inhibit_warnings => true end From 4efbe44b46695a3e398cb4e0b49db4856526b475 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Fri, 22 May 2020 23:03:43 -0700 Subject: [PATCH 08/13] Wait for the dyld cache to update after creating a simulator Trying to run the build in parallel with this seems to just make both very slow. --- scripts/reset-simulators.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/reset-simulators.rb b/scripts/reset-simulators.rb index 2b1e31e2b7..2f2479143e 100755 --- a/scripts/reset-simulators.rb +++ b/scripts/reset-simulators.rb @@ -125,6 +125,12 @@ def shutdown_simulator_devices(devices) system("xcrun simctl boot 'iPhone 8'") or raise "Failed to boot iPhone 8 simulator" puts ' done!' + print 'Waiting for dyld shared cache to update...' + while system('pgrep -q update_dyld_sim_shared_cache') + sleep 15 + end + puts ' done!' + rescue => e if (attempts += 1) < 5 puts '' From da5aa2e16283386e685d6ccf91268c61da70d307 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Sat, 23 May 2020 16:34:35 -0700 Subject: [PATCH 09/13] Prelaunch the Apple TV simulator for tvos jobs --- build.sh | 4 ++-- scripts/reset-simulators.rb | 11 +++++++++-- scripts/reset-simulators.sh | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/build.sh b/build.sh index ad30b32cc8..f2016f953a 100755 --- a/build.sh +++ b/build.sh @@ -483,7 +483,7 @@ case "$COMMAND" in "prelaunch-simulator") if [ -z "$REALM_SKIP_PRELAUNCH" ]; then - sh ${source_root}/scripts/reset-simulators.sh + sh ${source_root}/scripts/reset-simulators.sh "$1" fi ;; @@ -1316,7 +1316,7 @@ EOM export CONFIGURATION=$configuration export REALM_EXTRA_BUILD_ARGUMENTS='GCC_GENERATE_DEBUGGING_SYMBOLS=NO -allowProvisioningUpdates' if [[ "$target" = *ios* ]] || [[ "$target" = *tvos* ]] || [[ "$target" = *watchos* ]]; then - sh build.sh prelaunch-simulator + sh build.sh prelaunch-simulator "$target" fi export REALM_SKIP_PRELAUNCH=1 diff --git a/scripts/reset-simulators.rb b/scripts/reset-simulators.rb index 2f2479143e..b55982f618 100755 --- a/scripts/reset-simulators.rb +++ b/scripts/reset-simulators.rb @@ -3,6 +3,8 @@ require 'json' require 'open3' +prelaunch_simulator = ARGV[0] || '' + def platform_for_runtime(runtime) runtime['identifier'].gsub(/com.apple.CoreSimulator.SimRuntime.([^-]+)-.*/, '\1') end @@ -121,8 +123,13 @@ def shutdown_simulator_devices(devices) end puts ' done!' - print 'Booting iPhone 8 simulator...' - system("xcrun simctl boot 'iPhone 8'") or raise "Failed to boot iPhone 8 simulator" + if prelaunch_simulator.include? 'tvos' + print 'Booting Apple TV simulator...' + system("xcrun simctl boot 'Apple TV'") or raise "Failed to boot Apple TV simulator" + else + print 'Booting iPhone 8 simulator...' + system("xcrun simctl boot 'iPhone 8'") or raise "Failed to boot iPhone 8 simulator" + end puts ' done!' print 'Waiting for dyld shared cache to update...' diff --git a/scripts/reset-simulators.sh b/scripts/reset-simulators.sh index cba7f345bb..ce828352ca 100755 --- a/scripts/reset-simulators.sh +++ b/scripts/reset-simulators.sh @@ -6,4 +6,4 @@ set -e source "$(dirname "$0")/swift-version.sh" set_xcode_and_swift_versions -"$(dirname "$0")/reset-simulators.rb" +"$(dirname "$0")/reset-simulators.rb" "$1" From eb139a166fa771e2c45c30ef5874b4df74fd1348 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Wed, 20 May 2020 15:20:50 -0700 Subject: [PATCH 10/13] Fix some race conditions in tests Tests which do things on dispatch queues need to wait for the queue to be flushed or sometimes the Realms allocated on those queues will be deallocated after the test tearDown has started. --- RealmSwift/Tests/CombineTests.swift | 90 +++++++++---------- RealmSwift/Tests/ObjectTests.swift | 2 + .../Tests/RealmCollectionTypeTests.swift | 1 - RealmSwift/Tests/TestCase.swift | 1 + 4 files changed, 48 insertions(+), 46 deletions(-) diff --git a/RealmSwift/Tests/CombineTests.swift b/RealmSwift/Tests/CombineTests.swift index 00fee31207..3d52a1da0f 100644 --- a/RealmSwift/Tests/CombineTests.swift +++ b/RealmSwift/Tests/CombineTests.swift @@ -40,22 +40,22 @@ func hasCombine() -> Bool { } @available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *) -class CombineObjectPublisherTests: TestCase { +class CombineTestCase: TestCase { var realm: Realm! var token: AnyCancellable? - var obj: SwiftIntObject! + let subscribeOnQueue = DispatchQueue(label: "subscribe on") + let receiveOnQueue = DispatchQueue(label: "receive on") override class var defaultTestSuite: XCTestSuite { if hasCombine() { return super.defaultTestSuite } - return XCTestSuite(name: "CombineObjectPublisherTests") + return XCTestSuite(name: "\(type(of: self))") } override func setUp() { super.setUp() realm = try! Realm(configuration: Realm.Configuration(inMemoryIdentifier: "test")) - obj = try! realm.write { realm.create(SwiftIntObject.self, value: []) } } override func tearDown() { @@ -64,8 +64,20 @@ class CombineObjectPublisherTests: TestCase { } realm.invalidate() realm = nil + subscribeOnQueue.sync { } + receiveOnQueue.sync { } super.tearDown() } +} + +@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *) +class CombineObjectPublisherTests: CombineTestCase { + var obj: SwiftIntObject! + + override func setUp() { + super.setUp() + obj = try! realm.write { realm.create(SwiftIntObject.self, value: []) } + } func testWillChange() { let exp = XCTestExpectation() @@ -118,7 +130,7 @@ class CombineObjectPublisherTests: TestCase { let sema = DispatchSemaphore(value: 0) var i = 1 token = valuePublisher(obj) - .subscribe(on: DispatchQueue(label: "scheduler queue")) + .subscribe(on: subscribeOnQueue) .map { obj -> SwiftIntObject in sema.signal() XCTAssertEqual(obj.intCol, i) @@ -145,7 +157,7 @@ class CombineObjectPublisherTests: TestCase { func testReceiveOn() { var exp = XCTestExpectation() token = valuePublisher(obj) - .receive(on: DispatchQueue(label: "queue")) + .receive(on: receiveOnQueue) .map { obj -> Int in exp.fulfill() return obj.intCol @@ -174,7 +186,7 @@ class CombineObjectPublisherTests: TestCase { var prev: SwiftIntObject? token = changesetPublisher(obj) - .subscribe(on: DispatchQueue(label: "queue")) + .subscribe(on: subscribeOnQueue) .assertNoFailure() .sink(receiveCompletion: { _ in sema.signal() }, receiveValue: { change in if case .change(let o, let properties) = change { @@ -211,7 +223,7 @@ class CombineObjectPublisherTests: TestCase { var exp = XCTestExpectation(description: "change") token = changesetPublisher(obj) - .receive(on: DispatchQueue(label: "queue")) + .receive(on: receiveOnQueue) .assertNoFailure() .sink(receiveCompletion: { _ in exp.fulfill() }, receiveValue: { change in if case .change(let o, let properties) = change { @@ -242,8 +254,8 @@ class CombineObjectPublisherTests: TestCase { var prev: SwiftIntObject? token = changesetPublisher(obj) - .subscribe(on: DispatchQueue(label: "subscribe queue")) - .receive(on: DispatchQueue(label: "receive queue")) + .subscribe(on: subscribeOnQueue) + .receive(on: receiveOnQueue) .assertNoFailure() .sink(receiveCompletion: { _ in sema.signal() }, receiveValue: { change in if case .change(let o, let properties) = change { @@ -283,7 +295,7 @@ class CombineObjectPublisherTests: TestCase { token = changesetPublisher(obj) .map { $0 } .threadSafeReference() - .receive(on: DispatchQueue(label: "queue")) + .receive(on: receiveOnQueue) .assertNoFailure() .sink(receiveCompletion: { _ in exp.fulfill() }, receiveValue: { change in if case .change(let o, let properties) = change { @@ -333,7 +345,7 @@ class CombineObjectPublisherTests: TestCase { func testFrozenChangeSetSubscribeOn() { let sema = DispatchSemaphore(value: 0) token = changesetPublisher(obj) - .subscribe(on: DispatchQueue(label: "queue")) + .subscribe(on: subscribeOnQueue) .freeze() .collect() .assertNoFailure() @@ -368,7 +380,7 @@ class CombineObjectPublisherTests: TestCase { let exp = XCTestExpectation(description: "sink complete") token = changesetPublisher(obj) .freeze() - .receive(on: DispatchQueue(label: "queue")) + .receive(on: receiveOnQueue) .collect() .assertNoFailure() .sink { arr in @@ -399,9 +411,9 @@ class CombineObjectPublisherTests: TestCase { func testFrozenChangeSetSubscribeOnAndReceiveOn() { let sema = DispatchSemaphore(value: 0) token = changesetPublisher(obj) - .subscribe(on: DispatchQueue(label: "subscribe queue")) + .subscribe(on: subscribeOnQueue) .freeze() - .receive(on: DispatchQueue(label: "receive queue")) + .receive(on: receiveOnQueue) .collect() .assertNoFailure() .sink { arr in @@ -436,7 +448,7 @@ class CombineObjectPublisherTests: TestCase { token = valuePublisher(obj) .map { $0 } .threadSafeReference() - .receive(on: DispatchQueue(label: "queue")) + .receive(on: receiveOnQueue) .map { obj -> Int in exp.fulfill() return obj.intCol @@ -466,7 +478,7 @@ class CombineObjectPublisherTests: TestCase { let exp = XCTestExpectation() token = objects.publisher .threadSafeReference() - .receive(on: DispatchQueue(label: "queue")) + .receive(on: receiveOnQueue) .map { $0.intCol } .collect() .sink { (arr: [Int]) in @@ -488,7 +500,7 @@ class CombineObjectPublisherTests: TestCase { let exp = XCTestExpectation() token = objects.publisher .threadSafeReference() - .receive(on: DispatchQueue(label: "queue")) + .receive(on: receiveOnQueue) .map { $0.intCol } .collect() .sink { (arr: [Int]) in @@ -504,7 +516,7 @@ class CombineObjectPublisherTests: TestCase { .freeze() .map { $0 } .threadSafeReference() - .receive(on: DispatchQueue(label: "queue")) + .receive(on: receiveOnQueue) .assertNoFailure() .sink { obj in XCTAssertTrue(obj.isFrozen) @@ -536,7 +548,7 @@ class CombineObjectPublisherTests: TestCase { let exp = XCTestExpectation() token = objects.publisher .threadSafeReference() - .receive(on: DispatchQueue(label: "queue")) + .receive(on: receiveOnQueue) .map { $0.intCol } .collect() .sink { (arr: [Int]) in @@ -553,10 +565,8 @@ private protocol CombineTestCollection { } @available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *) -private class CombineCollectionPublisherTests: TestCase +private class CombineCollectionPublisherTests: CombineTestCase where Collection: CombineTestCollection, Collection: RealmSubscribable { - var realm: Realm! - var token: AnyCancellable? var collection: Collection! class func testSuite(_ name: String) -> XCTestSuite { @@ -574,19 +584,9 @@ private class CombineCollectionPublisherTests: Test override func setUp() { super.setUp() - realm = try! Realm(configuration: Realm.Configuration(inMemoryIdentifier: "test")) collection = Collection.getCollection(realm) } - override func tearDown() { - collection = nil - realm = nil - if let token = token { - token.cancel() - } - super.tearDown() - } - func testWillChange() { let exp = XCTestExpectation() token = collection.objectWillChange.sink { @@ -654,7 +654,7 @@ private class CombineCollectionPublisherTests: Test let sema = DispatchSemaphore(value: 0) var calls = 0 token = collection.publisher - .subscribe(on: DispatchQueue(label: "queue")) + .subscribe(on: subscribeOnQueue) .assertNoFailure() .sink { r in XCTAssertEqual(r.count, calls) @@ -673,7 +673,7 @@ private class CombineCollectionPublisherTests: Test var calls = 0 var exp = XCTestExpectation(description: "initial") token = collection.publisher - .receive(on: DispatchQueue(label: "queue")) + .receive(on: receiveOnQueue) .assertNoFailure() .sink { r in XCTAssertEqual(r.count, calls) @@ -693,7 +693,7 @@ private class CombineCollectionPublisherTests: Test var calls = 0 let sema = DispatchSemaphore(value: 0) token = collection.changesetPublisher - .subscribe(on: DispatchQueue(label: "queue")) + .subscribe(on: subscribeOnQueue) .sink { change in self.checkChangeset(change, calls: calls) calls += 1 @@ -711,7 +711,7 @@ private class CombineCollectionPublisherTests: Test var exp = XCTestExpectation(description: "initial") var calls = 0 token = collection.changesetPublisher - .receive(on: DispatchQueue(label: "queue")) + .receive(on: receiveOnQueue) .sink { change in self.checkChangeset(change, calls: calls) calls += 1 @@ -732,7 +732,7 @@ private class CombineCollectionPublisherTests: Test token = collection.publisher .map { $0 } .threadSafeReference() - .receive(on: DispatchQueue(label: "queue")) + .receive(on: receiveOnQueue) .assertNoFailure() .sink { r in XCTAssertEqual(r.count, calls) @@ -754,7 +754,7 @@ private class CombineCollectionPublisherTests: Test token = collection.changesetPublisher .map { $0 } .threadSafeReference() - .receive(on: DispatchQueue(label: "queue")) + .receive(on: receiveOnQueue) .sink { change in self.checkChangeset(change, calls: calls) calls += 1 @@ -793,7 +793,7 @@ private class CombineCollectionPublisherTests: Test func testFrozenChangeSetSubscribeOn() { let sema = DispatchSemaphore(value: 0) token = collection.changesetPublisher - .subscribe(on: DispatchQueue(label: "queue")) + .subscribe(on: subscribeOnQueue) .freeze() .assertNoFailure() .signal(sema) @@ -817,7 +817,7 @@ private class CombineCollectionPublisherTests: Test let exp = XCTestExpectation() token = collection.changesetPublisher .freeze() - .receive(on: DispatchQueue(label: "queue")) + .receive(on: receiveOnQueue) .prefix(10) .collect() .assertNoFailure() @@ -837,9 +837,9 @@ private class CombineCollectionPublisherTests: Test func testFrozenChangeSetSubscribeOnAndReceiveOn() { let sema = DispatchSemaphore(value: 0) token = collection.changesetPublisher - .subscribe(on: DispatchQueue(label: "subscription queue")) + .subscribe(on: subscribeOnQueue) .freeze() - .receive(on: DispatchQueue(label: "receive queue")) + .receive(on: receiveOnQueue) .signal(sema) .prefix(10) .collect() @@ -863,7 +863,7 @@ private class CombineCollectionPublisherTests: Test token = collection.publisher .freeze() .threadSafeReference() - .receive(on: DispatchQueue(label: "background queue")) + .receive(on: receiveOnQueue) .prefix(10) .collect() .assertNoFailure() @@ -886,7 +886,7 @@ private class CombineCollectionPublisherTests: Test token = collection.changesetPublisher .freeze() .threadSafeReference() - .receive(on: DispatchQueue(label: "queue")) + .receive(on: receiveOnQueue) .prefix(10) .collect() .assertNoFailure() diff --git a/RealmSwift/Tests/ObjectTests.swift b/RealmSwift/Tests/ObjectTests.swift index bb14cf8320..179828dfbc 100644 --- a/RealmSwift/Tests/ObjectTests.swift +++ b/RealmSwift/Tests/ObjectTests.swift @@ -724,6 +724,7 @@ class ObjectTests: TestCase { sema.wait() token.invalidate() + queue.sync { } } func testInvalidateObserverOnDifferentQueueBeforeRegistration() { @@ -757,6 +758,7 @@ class ObjectTests: TestCase { } sema.wait() token2.invalidate() + queue.sync { } } func testEqualityForObjectTypeWithPrimaryKey() { diff --git a/RealmSwift/Tests/RealmCollectionTypeTests.swift b/RealmSwift/Tests/RealmCollectionTypeTests.swift index eecb0c23c7..d6ea3c5ae1 100644 --- a/RealmSwift/Tests/RealmCollectionTypeTests.swift +++ b/RealmSwift/Tests/RealmCollectionTypeTests.swift @@ -472,7 +472,6 @@ class RealmCollectionTypeTests: TestCase { func observeOnQueue(_ collection: Collection) where Collection.Element: Object { let sema = DispatchSemaphore(value: 0) - let queue = DispatchQueue(label: "background queue") let token = collection.observe(on: queue) { (changes: RealmCollectionChange) in switch changes { case .initial(let collection): diff --git a/RealmSwift/Tests/TestCase.swift b/RealmSwift/Tests/TestCase.swift index 1d7a5bf778..e1aef2fd7c 100644 --- a/RealmSwift/Tests/TestCase.swift +++ b/RealmSwift/Tests/TestCase.swift @@ -61,6 +61,7 @@ class TestCase: RLMTestCaseBase { exceptionThrown = false autoreleasepool { super.invokeTest() } + queue.sync { } if !exceptionThrown { XCTAssertFalse(RLMHasCachedRealmForPath(defaultRealmURL().path)) From 4acada29e697f3797ed6cbbffa5ad491fb6afaab Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Tue, 26 May 2020 13:49:31 -0700 Subject: [PATCH 11/13] Disable debug symbol generation in cocoapods installation examples This speeds up compilation a little and cuts down on i/o a lot. --- examples/installation/ios/objc/CocoaPodsExample/Podfile | 8 ++++++++ examples/installation/ios/swift/CocoaPodsExample/Podfile | 1 + examples/installation/osx/objc/CocoaPodsExample/Podfile | 8 ++++++++ examples/installation/osx/swift/CocoaPodsExample/Podfile | 1 + .../installation/watchos/objc/CocoaPodsExample/Podfile | 8 ++++++++ .../installation/watchos/swift/CocoaPodsExample/Podfile | 1 + 6 files changed, 27 insertions(+) diff --git a/examples/installation/ios/objc/CocoaPodsExample/Podfile b/examples/installation/ios/objc/CocoaPodsExample/Podfile index 4720c1e800..f926386c57 100644 --- a/examples/installation/ios/objc/CocoaPodsExample/Podfile +++ b/examples/installation/ios/objc/CocoaPodsExample/Podfile @@ -10,3 +10,11 @@ end target 'CocoaPodsExampleTests' do pod 'Realm/Headers', git: 'https://github.com/realm/realm-cocoa.git', branch: branch, submodules: true end + +post_install do |installer| + installer.pods_project.targets.each do |target| + target.build_configurations.each do |config| + config.build_settings['GCC_GENERATE_DEBUGGING_SYMBOLS'] = 'NO' + end + end +end diff --git a/examples/installation/ios/swift/CocoaPodsExample/Podfile b/examples/installation/ios/swift/CocoaPodsExample/Podfile index 24c78606e0..12754e16f4 100644 --- a/examples/installation/ios/swift/CocoaPodsExample/Podfile +++ b/examples/installation/ios/swift/CocoaPodsExample/Podfile @@ -19,6 +19,7 @@ post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['SWIFT_VERSION'] = '4.0' + config.build_settings['GCC_GENERATE_DEBUGGING_SYMBOLS'] = 'NO' end end end diff --git a/examples/installation/osx/objc/CocoaPodsExample/Podfile b/examples/installation/osx/objc/CocoaPodsExample/Podfile index 4720c1e800..f926386c57 100644 --- a/examples/installation/osx/objc/CocoaPodsExample/Podfile +++ b/examples/installation/osx/objc/CocoaPodsExample/Podfile @@ -10,3 +10,11 @@ end target 'CocoaPodsExampleTests' do pod 'Realm/Headers', git: 'https://github.com/realm/realm-cocoa.git', branch: branch, submodules: true end + +post_install do |installer| + installer.pods_project.targets.each do |target| + target.build_configurations.each do |config| + config.build_settings['GCC_GENERATE_DEBUGGING_SYMBOLS'] = 'NO' + end + end +end diff --git a/examples/installation/osx/swift/CocoaPodsExample/Podfile b/examples/installation/osx/swift/CocoaPodsExample/Podfile index 24c78606e0..12754e16f4 100644 --- a/examples/installation/osx/swift/CocoaPodsExample/Podfile +++ b/examples/installation/osx/swift/CocoaPodsExample/Podfile @@ -19,6 +19,7 @@ post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['SWIFT_VERSION'] = '4.0' + config.build_settings['GCC_GENERATE_DEBUGGING_SYMBOLS'] = 'NO' end end end diff --git a/examples/installation/watchos/objc/CocoaPodsExample/Podfile b/examples/installation/watchos/objc/CocoaPodsExample/Podfile index 1749015f87..71e7b0eeeb 100644 --- a/examples/installation/watchos/objc/CocoaPodsExample/Podfile +++ b/examples/installation/watchos/objc/CocoaPodsExample/Podfile @@ -5,3 +5,11 @@ target 'CocoaPodsExample WatchKit Extension' do platform :watchos, '2.0' pod 'Realm', git: 'https://github.com/realm/realm-cocoa.git', branch: branch, submodules: true end + +post_install do |installer| + installer.pods_project.targets.each do |target| + target.build_configurations.each do |config| + config.build_settings['GCC_GENERATE_DEBUGGING_SYMBOLS'] = 'NO' + end + end +end diff --git a/examples/installation/watchos/swift/CocoaPodsExample/Podfile b/examples/installation/watchos/swift/CocoaPodsExample/Podfile index 101328cd34..625fda49e3 100644 --- a/examples/installation/watchos/swift/CocoaPodsExample/Podfile +++ b/examples/installation/watchos/swift/CocoaPodsExample/Podfile @@ -11,6 +11,7 @@ post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['SWIFT_VERSION'] = '4.0' + config.build_settings['GCC_GENERATE_DEBUGGING_SYMBOLS'] = 'NO' end end end From 4c4d6c655e6ce60a0c760c7008e46af7ec4d4978 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Tue, 26 May 2020 13:58:46 -0700 Subject: [PATCH 12/13] Only verify the Swift pod on PR jobs Since the swift pod depends on the obj-c pod, it would be very difficult for there to ever be a problem which the obj-c test would catch which the swift one will not. --- build.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/build.sh b/build.sh index f2016f953a..c2f767f7a7 100755 --- a/build.sh +++ b/build.sh @@ -957,7 +957,6 @@ case "$COMMAND" in # https://github.com/CocoaPods/CocoaPods/issues/7708 export EXPANDED_CODE_SIGN_IDENTITY='' cd examples/installation - sh build.sh test-$PLATFORM-objc-cocoapods sh build.sh test-$PLATFORM-swift-cocoapods ;; From 39d522cc8f9889e76e6f681a7c1e40468a67d1c7 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Tue, 26 May 2020 16:35:59 -0700 Subject: [PATCH 13/13] Avoid depending on simulators existing for jobs that don't run anything --- build.sh | 52 +++++++++++++++++++++------------------------------- 1 file changed, 21 insertions(+), 31 deletions(-) diff --git a/build.sh b/build.sh index c2f767f7a7..859ceb1b0b 100755 --- a/build.sh +++ b/build.sh @@ -147,17 +147,13 @@ build_combined() { local version_suffix="$6" local config="$CONFIGURATION" - local destination="" local os_name="" if [[ "$os" == "iphoneos" ]]; then os_name="ios" - destination="iPhone 8" elif [[ "$os" == "watchos" ]]; then os_name="$os" - destination="Apple Watch Series 4 - 40mm" elif [[ "$os" == "appletvos" ]]; then os_name="tvos" - destination="Apple TV" fi # Derive build paths @@ -170,8 +166,8 @@ build_combined() { local out_path="build/$os_name$scope_suffix$version_suffix" # Build for each platform - xc "-scheme '$scheme' -configuration $config -sdk $os" - xc "-scheme '$scheme' -configuration $config -sdk $simulator -destination 'name=$destination' ONLY_ACTIVE_ARCH=NO" + xc "-scheme '$scheme' -configuration $config -sdk $os build" + xc "-scheme '$scheme' -configuration $config -sdk $simulator build ONLY_ACTIVE_ARCH=NO" # Combine .swiftmodule if [ -d $simulator_path/Modules/$module_name.swiftmodule ]; then @@ -197,7 +193,7 @@ build_combined() { # Verify that the combined library has bitcode and we didn't accidentally # remove it somewhere along the line - if [[ "$destination" != "" && "$config" == "Release" ]]; then + if [[ "$config" == "Release" ]]; then sh build.sh binary-has-bitcode "$LIPO_OUTPUT" fi } @@ -1100,38 +1096,30 @@ case "$COMMAND" in ;; "examples-ios") - sh build.sh prelaunch-simulator workspace="examples/ios/objc/RealmExamples.xcworkspace" pod install --project-directory="$workspace/.." --no-repo-update - xc "-workspace $workspace -scheme Simple -configuration $CONFIGURATION -destination 'name=iPhone 8' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme TableView -configuration $CONFIGURATION -destination 'name=iPhone 8' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme Migration -configuration $CONFIGURATION -destination 'name=iPhone 8' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme Backlink -configuration $CONFIGURATION -destination 'name=iPhone 8' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme GroupedTableView -configuration $CONFIGURATION -destination 'name=iPhone 8' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme RACTableView -configuration $CONFIGURATION -destination 'name=iPhone 8' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme Encryption -configuration $CONFIGURATION -destination 'name=iPhone 8' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme Draw -configuration $CONFIGURATION -destination 'name=iPhone 8' build ${CODESIGN_PARAMS}" - + examples="Simple TableView Migration Backlink GroupedTableView RACTableView Encryption Draw" + for example in $examples; do + xc "-workspace $workspace -scheme $example -configuration $CONFIGURATION -sdk iphonesimulator build ARCHS=x86_64 ${CODESIGN_PARAMS}" + done if [ ! -z "${JENKINS_HOME}" ]; then - xc "-workspace $workspace -scheme Extension -configuration $CONFIGURATION -destination 'name=iPhone 8' build ${CODESIGN_PARAMS}" + xc "-workspace $workspace -scheme Extension -configuration $CONFIGURATION -sdk iphonesimulator build ARCHS=x86_64 ${CODESIGN_PARAMS}" fi exit 0 ;; "examples-ios-swift") - sh build.sh prelaunch-simulator workspace="examples/ios/swift/RealmExamples.xcworkspace" if [[ ! -d "$workspace" ]]; then workspace="${workspace/swift/swift-$REALM_XCODE_VERSION}" fi - xc "-workspace $workspace -scheme Simple -configuration $CONFIGURATION -destination 'name=iPhone 8' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme TableView -configuration $CONFIGURATION -destination 'name=iPhone 8' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme Migration -configuration $CONFIGURATION -destination 'name=iPhone 8' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme Encryption -configuration $CONFIGURATION -destination 'name=iPhone 8' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme Backlink -configuration $CONFIGURATION -destination 'name=iPhone 8' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme GroupedTableView -configuration $CONFIGURATION -destination 'name=iPhone 8' build ${CODESIGN_PARAMS}" + examples="Simple TableView Migration Backlink GroupedTableView Encryption" + for example in $examples; do + xc "-workspace $workspace -scheme $example -configuration $CONFIGURATION -sdk iphonesimulator build ARCHS=x86_64 ${CODESIGN_PARAMS}" + done + exit 0 ;; @@ -1141,10 +1129,11 @@ case "$COMMAND" in "examples-tvos") workspace="examples/tvos/objc/RealmExamples.xcworkspace" - destination="Apple TV" + examples="DownloadCache PreloadedData" + for example in $examples; do + xc "-workspace $workspace -scheme $example -configuration $CONFIGURATION -sdk appletvsimulator build ARCHS=x86_64 ${CODESIGN_PARAMS}" + done - xc "-workspace $workspace -scheme DownloadCache -configuration $CONFIGURATION -destination 'name=$destination' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme PreloadedData -configuration $CONFIGURATION -destination 'name=$destination' build ${CODESIGN_PARAMS}" exit 0 ;; @@ -1153,10 +1142,11 @@ case "$COMMAND" in if [[ ! -d "$workspace" ]]; then workspace="${workspace/swift/swift-$REALM_XCODE_VERSION}" fi + examples="DownloadCache PreloadedData" + for example in $examples; do + xc "-workspace $workspace -scheme $example -configuration $CONFIGURATION -sdk appletvsimulator build ARCHS=x86_64 ${CODESIGN_PARAMS}" + done - destination="Apple TV" - xc "-workspace $workspace -scheme DownloadCache -configuration $CONFIGURATION -destination 'name=$destination' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme PreloadedData -configuration $CONFIGURATION -destination 'name=$destination' build ${CODESIGN_PARAMS}" exit 0 ;;