Skip to content

Commit

Permalink
Avoid depending on simulators existing for jobs that don't run anything
Browse files Browse the repository at this point in the history
  • Loading branch information
tgoyne committed May 27, 2020
1 parent 4c4d6c6 commit 39d522c
Showing 1 changed file with 21 additions and 31 deletions.
52 changes: 21 additions & 31 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
}
Expand Down Expand Up @@ -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
;;

Expand All @@ -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
;;

Expand All @@ -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
;;

Expand Down

0 comments on commit 39d522c

Please sign in to comment.