diff --git a/build.sh b/build.sh index 43113351b2..dbc3321940 100755 --- a/build.sh +++ b/build.sh @@ -132,11 +132,13 @@ build_combined() { local config="$CONFIGURATION" local previous_realm_xcode_version="$REALM_XCODE_VERSION" local previous_realm_swift_version="$REALM_SWIFT_VERSION" + local did_change_xcode_versions=0 if [[ "$module_name" == "Realm" ]] && [[ "$IS_RUNNING_PACKAGING" == "1" ]]; then # Work around rdar://31302382 by building Realm Objective-C with Xcode 8.2 # when packaging since 8.3 produces binaries that are ~3x bigger force_xcode_82 + did_change_xcode_versions=1 fi local destination="" @@ -183,10 +185,13 @@ build_combined() { sh build.sh binary-has-bitcode "$LIPO_OUTPUT" fi - # Reset to state before applying workaround to rdar://31302382 - REALM_XCODE_VERSION="$previous_realm_xcode_version" - REALM_SWIFT_VERSION="$previous_realm_swift_version" - set_xcode_and_swift_versions + if [[ "$did_change_xcode_versions" == "1" ]]; then + # Reset to state before applying workaround to rdar://31302382 + REALM_XCODE_VERSION="$previous_realm_xcode_version" + REALM_SWIFT_VERSION="$previous_realm_swift_version" + set_xcode_and_swift_versions + sh build.sh prelaunch-simulator + fi } clean_retrieve() { @@ -204,7 +209,9 @@ move_to_clean_dir() { test_ios_static() { local previous_realm_xcode_version="$REALM_XCODE_VERSION" local previous_realm_swift_version="$REALM_SWIFT_VERSION" - force_xcode_82 + if [[ "$IS_RUNNING_PACKAGING" == "1" ]]; then + force_xcode_82 + fi destination="$1" xc "-scheme 'Realm iOS static' -configuration $CONFIGURATION -sdk iphonesimulator -destination '$destination' build" @@ -218,16 +225,20 @@ test_ios_static() { xc "-scheme 'Realm iOS static' -configuration $CONFIGURATION -sdk iphonesimulator -destination '$destination' test" - # Reset to state before forcing Xcode 8.2 - REALM_XCODE_VERSION="$previous_realm_xcode_version" - REALM_SWIFT_VERSION="$previous_realm_swift_version" - set_xcode_and_swift_versions + if [[ "$IS_RUNNING_PACKAGING" == "1" ]]; then + # Reset to state before forcing Xcode 8.2 + REALM_XCODE_VERSION="$previous_realm_xcode_version" + REALM_SWIFT_VERSION="$previous_realm_swift_version" + set_xcode_and_swift_versions + sh build.sh prelaunch-simulator + fi } force_xcode_82() { REALM_XCODE_VERSION=8.2 REALM_SWIFT_VERSION= set_xcode_and_swift_versions + sh build.sh prelaunch-simulator } ######################################