#!/bin/bash set -o pipefail set -e usage() { cat < Cartfile else echo "github \"realm/realm-cocoa\" \"${sha:-master}\"" > Cartfile fi if [[ $PLATFORM == ios ]]; then carthage update --platform iOS elif [[ $PLATFORM == osx ]]; then carthage update --platform Mac elif [[ $PLATFORM == watchos ]]; then carthage update --platform watchOS fi ) elif [[ $LANG == swift* ]]; then download_zip_if_needed swift else download_zip_if_needed $LANG fi DESTINATION="" if [[ $PLATFORM == ios ]]; then simulator_id="$(xcrun simctl list devices | grep -v unavailable | grep -m 1 -o '[0-9A-F\-]\{36\}')" xcrun simctl boot $simulator_id DESTINATION="-destination id=$simulator_id" elif [[ $PLATFORM == watchos ]]; then if xcrun simctl list devicetypes | grep -q 'iPhone Xs'; then DESTINATION="-destination id=$(xcrun simctl list devices | grep -v unavailable | grep 'iPhone Xs' | grep -m 1 -o '[0-9A-F\-]\{36\}')" fi fi CMD="-project $PROJECT" if [ -d $WORKSPACE ]; then CMD="-workspace $WORKSPACE" fi ACTION="" if [[ $PLATFORM == watchos ]]; then ACTION="build" else ACTION="build test" fi if [[ $PLATFORM == ios ]]; then xcodebuild $CMD -scheme $NAME clean $ACTION $DESTINATION CODE_SIGN_IDENTITY= else xcodebuild $CMD -scheme $NAME clean $ACTION $DESTINATION CODE_SIGN_IDENTITY= CODE_SIGNING_REQUIRED=NO fi } source "$(dirname "$0")/../../scripts/swift-version.sh" set_xcode_and_swift_versions # exports REALM_SWIFT_VERSION, REALM_XCODE_VERSION, and DEVELOPER_DIR variables if not already set case "$COMMAND" in "test-all") for target in ios-swift-dynamic ios-swift-cocoapods osx-swift-dynamic ios-swift-carthage osx-swift-carthage; do ./build.sh test-$target || exit 1 done ;; "test-ios-objc-static") xctest ios objc StaticExample ;; "test-ios-objc-dynamic") xctest ios objc DynamicExample ;; "test-ios-objc-cocoapods") xctest ios objc CocoaPodsExample ;; "test-ios-objc-cocoapods-dynamic") xctest ios objc CocoaPodsDynamicExample ;; "test-ios-objc-carthage") xctest ios objc CarthageExample ;; "test-ios-swift-dynamic") xctest ios swift DynamicExample ;; "test-ios-swift-cocoapods") xctest ios swift CocoaPodsExample ;; "test-ios-swift-carthage") xctest ios swift CarthageExample ;; "test-osx-objc-dynamic") xctest osx objc DynamicExample ;; "test-osx-objc-cocoapods") xctest osx objc CocoaPodsExample ;; "test-osx-objc-carthage") xctest osx objc CarthageExample ;; "test-osx-swift-dynamic") xctest osx swift DynamicExample ;; "test-osx-swift-cocoapods") xctest osx swift CocoaPodsExample ;; "test-osx-swift-carthage") xctest osx swift CarthageExample ;; "test-watchos-objc-dynamic") xctest watchos objc DynamicExample ;; "test-watchos-objc-cocoapods") xctest watchos objc CocoaPodsExample ;; "test-watchos-objc-carthage") xctest watchos objc CarthageExample ;; "test-watchos-swift-dynamic") xctest watchos swift DynamicExample ;; "test-watchos-swift-cocoapods") xctest watchos swift CocoaPodsExample ;; "test-watchos-swift-carthage") xctest watchos swift CarthageExample ;; *) echo "Unknown command '$COMMAND'" usage exit 1 ;; esac