Index: deploy/build.sh |
diff --git a/deploy/build.sh b/deploy/build.sh |
deleted file mode 100755 |
index 52a1db9809a897dc22ea86a755c30e39d1b6f409..0000000000000000000000000000000000000000 |
--- a/deploy/build.sh |
+++ /dev/null |
@@ -1,120 +0,0 @@ |
-#!/bin/sh |
- |
-set -e # abort on error |
-set -x # expand and print executed commands |
- |
-SDK_DEVICE=$1 |
-SDK_VERSION=$2 |
-SDK="${SDK_DEVICE}${SDK_VERSION}" |
- |
-IOS_SIMULATOR_VERSION=${3:-SDK_VERSION} |
- |
-# This is redirecting all output to file. Which means that stdout gets nothing. |
-# And in particular environment of CircleCI, it's a Good Thing for couple of reasons: |
-# - CCI web UI is extremely slow when trying to display a lengthy build log |
-# - even if the log is displayed, it's limited to first 400k chars |
-# - the system allows downloading the log, but only first 4M of it |
-# - even if the error happens in first 400k, the system rarely detects it correctly, pointing |
-# at irrelevant warnings or noncritical errors instead. It may not be completely a CCI fault |
-# as xcodebuild output is quite cryptic (so cryptic that it warrants xcrun existence). |
-LOGFILE="${CIRCLE_ARTIFACTS}/build_${SDK}.log" |
-exec > $LOGFILE 2>&1 |
- |
-# xcodebuild default build path must be overridden because it stores |
-# the compilation products at a cryptic temporary path but we need |
-# to copy it away for archivation and deployment |
-BUILD_DIR=$PWD/$SDK |
- |
-CI_BUILD_NUMBER=${CIRCLE_BUILD_NUM} |
-CI_VERSION_NUMBER=${APP_VERSION} |
- |
-# Resulting build artifact name (ending with .app, .ipa, .dSYM and whatever) |
-ARTIFACT_NAME="${XCODE_SCHEME}-${SDK}-${CI_BUILD_NUMBER}" |
- |
-# Keep an eye on used ruby version, in case future Xcode/Circle updates |
-# introduce incompatible expectations again |
-ruby -v |
- |
-# Note to the following construction and usage of ARTIFACT_DIR: |
-# It is effectively the same folder as CONFIGURATION_BUILD_DIR made from |
-# ${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}. But CONFIGURATION_BUILD_DIR is ignored in |
-# "Copy Pod Resources" step since Pods 1.0 - the path is constructed directly from $BUILD_DIR. |
-# Custom CONFIGURATION_BUILD_DIR results in builds landing in custom location but then being |
-# attempted to copy from a different location based on $BUILD_DIR. |
-# So BUILD_DIR, the root var of all config must be modified, and the resulting |
-# CONFIGURATION_BUILD_DIR then constructed manually. |
-# https://github.com/CocoaPods/CocoaPods/issues/5358 |
- |
-case $SDK in |
- iphonesimulator*) |
- CONFIGURATION=Debug |
-# BUILD TEST |
- xcodebuild \ |
- -sdk $SDK \ |
- -workspace "$XCODE_WORKSPACE" \ |
- -scheme "$XCODE_SCHEME" \ |
- -configuration "$CONFIGURATION" \ |
- -destination "platform=iOS Simulator,name=iPhone SE,OS=${IOS_SIMULATOR_VERSION}" \ |
- BUILD_DIR=$BUILD_DIR \ |
- CI_BUILD_NUMBER=$CI_BUILD_NUMBER \ |
- CI_VERSION_NUMBER=$CI_VERSION_NUMBER \ |
- test # build-test has the main build in its xcodeproj dependencies |
-# ZIP AND COPY APP so that it's downloadable from artifacts |
- ARTIFACT_DIR=$BUILD_DIR/${CONFIGURATION}-iphonesimulator |
- ditto -ck --keepParent --norsrc "${ARTIFACT_DIR}/${XCODE_SCHEME}.app" "$CIRCLE_ARTIFACTS/${ARTIFACT_NAME}.zip" |
- ;; |
- iphoneos*) |
-# BUILD PRODUCT |
- CONFIGURATION=Devbuild |
- # Specific name for archive |
- ARTIFACT_DIR=$BUILD_DIR/${CONFIGURATION}-iphoneos |
- ARCHIVE_NAME="${ARTIFACT_DIR}/${ARTIFACT_NAME}.xcarchive" |
- # The folder where exported IPA is stored |
- IPA_LOCATION="${ARTIFACT_DIR}/${ARTIFACT_NAME}" |
- xcodebuild \ |
- -sdk $SDK \ |
- -workspace "$XCODE_WORKSPACE" \ |
- -scheme "$XCODE_SCHEME" \ |
- -configuration "$CONFIGURATION" \ |
- -archivePath "$ARCHIVE_NAME" \ |
- BUILD_DIR=$BUILD_DIR \ |
- CI_BUILD_NUMBER=$CI_BUILD_NUMBER \ |
- CI_VERSION_NUMBER=$CI_VERSION_NUMBER \ |
- archive # no test |
- if [ "$CIRCLE_BRANCH" == "master" ]; then |
- echo "Branch '${CIRCLE_BRANCH}', packing xcarchive to artifacts" |
- # zip the archive and save it to artifacts |
- # @TODO upload to Eyeo signing service |
- ditto -ck --keepParent --norsrc "$ARCHIVE_NAME" "${ARCHIVE_NAME}.zip" |
- cp ${ARCHIVE_NAME}.zip $CIRCLE_ARTIFACTS |
- else |
- echo "Branch '${CIRCLE_BRANCH}', exporting xcarchive to IPA" |
- # Export the built xcarchive as IPA |
- # |
- # One would be tempted to add -exportSigningIdentity parameter here, but |
- # xcodebuild actively fights it with error: |
- # "The flag -exportSigningIdentity cannot be specified along with -exportOptionsPlist" |
- # where -exportOptionsPlist is mandated by warning: |
- # "exportArchive without -exportOptionsPlist is deprecated" |
- # SO we must trust xcodebuild export to map all signing assets correctly |
- # In CI environment, it has only one cert and a minimal necessary provisioning available |
- # but on real world devbox with half a dozen of each it could be a problem |
- xcodebuild \ |
- -exportArchive \ |
- -exportOptionsPlist "$HOME/$CIRCLE_PROJECT_REPONAME/deploy/ExportOptions.plist" \ |
- -archivePath "$ARCHIVE_NAME" \ |
- -exportPath "$IPA_LOCATION" # Path is a folder, NOT THE IPA FILENAME ITSELF! |
- # Copy to Circle artifacts. The source name is fixed by xcodebuild |
- cp "${IPA_LOCATION}/${XCODE_SCHEME}.ipa" "${CIRCLE_ARTIFACTS}/${ARTIFACT_NAME}.ipa" |
- # For some reason, dSYMs are not in xcarchive but left in the build dir |
- mv ${ARTIFACT_DIR}/*.dSYM ${ARCHIVE_NAME}/dSYMs |
- # ZIP DSYMs directly to Circle artifacts |
- # ditto creates Finder-compress-compatible package, where Apple service may have a problem accepting plain pkzip |
- ditto -ck --keepParent --rsrc --sequesterRsrc "${ARCHIVE_NAME}/dSYMs" "$CIRCLE_ARTIFACTS/${ARTIFACT_NAME}.dSYM.zip" |
- # UPLOAD AND CLEAN |
- $HOME/$CIRCLE_PROJECT_REPONAME/deploy/hockey.sh \ |
- "${CIRCLE_ARTIFACTS}/${ARTIFACT_NAME}.ipa" \ |
- "${CIRCLE_ARTIFACTS}/${ARTIFACT_NAME}.dSYM.zip" |
- fi |
- ;; |
-esac |