Skip to content

Commit

Permalink
Merge pull request #4790 from realm/jp-reset-simulators-when-forcing-…
Browse files Browse the repository at this point in the history
…xcode-82

reset simulators when forcing xcode 8.2
  • Loading branch information
jpsim authored Mar 29, 2017
2 parents 7e51551 + ff1398e commit 542ccef
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=""
Expand Down Expand Up @@ -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() {
Expand All @@ -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"
Expand All @@ -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
}

######################################
Expand Down

0 comments on commit 542ccef

Please sign in to comment.