From 39d522cc8f9889e76e6f681a7c1e40468a67d1c7 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Tue, 26 May 2020 16:35:59 -0700 Subject: [PATCH] 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 ;;