.c.f.

Jenkins Jobs

TEMPORARY build in /Users/ci/.jenkins/workspace/iOS-Checkout-Appium\src

cd /Users/ci/.jenkins/workspace/iOS-Checkout-Appium
ls /Users/ci/Library/Developer/Xcode/DerivedData/dorihqdpsinhefaqkbqgbtemdknm/Build/Products/Debug-iphonesimulator/THE.app

Commands used to attempt to build iOS Simulator app

Summary

Attempts to build an iOS Simulator (x86) version of the my-app.app from the command line fail when linking, claiming that Identity based symbols aren’t available. However, building under xcode succeed - using physically the same workspace etc (In the same machine / folder etc).

export PLATFORM="iOS"
export PLATFORM_VERSION="9.3"
export DEVICE="iPhone 6"
export APP_PATH="/Users/ci/appiumTestApp/THE.app" # Needs to be x86, not ARM
export APP_PATH="/Users/ci/Library/Developer/Xcode/DerivedData/cvdcbkuhcdwgtvdnqkygobushpyq/Build/Products/Nightly-iphonesimulator/THE.app" # Needs to be x86, not ARM
export APP_PATH="/Users/ci/Library/Developer/Xcode/DerivedData/dorihqdpsinhefaqkbqgbtemdknm/Build/Products/Debug-iphonesimulator/THE.app" # Needs to be x86, not ARM

Misc.

export TEMP_DIR=`mktemp -d`

xcodebuild -showsdks | grep iphonesimulator | awk 'NF>1{print $NF}'
export IPHONE_SIMULATOR=$(xcodebuild -showsdks | grep iphonesimulator | awk 'NF>1{print $NF}')

find ~/Library/Developer/Xcode/DerivedData/ -name my-app.app -exec echo {} \; | grep Nightly-iphonesimulator
ls /Users/ci/Library/Developer/Xcode/DerivedData//my-app-cvdcbkuhcdwgtvdnqkygobushpyq/Build/Products/Nightly-iphonesimulator

xcodebuild

Unlock the keychain

security unlock -p $(PASSWORD) ~/Library/Keychains/login.keychain

Update Carthage

carthage update --platform iOS,watchOS

Via scan

scan --verbose --scheme Debug

set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace ./my-app.xcworkspace -scheme Debug \
        -destination 'platform=iOS Simulator,id=F87F228A-EC9B-44F8-AD1E-A2FD2D56FD7B' \
        -derivedDataPath '/Users/ci/Library/Developer/Xcode/DerivedData/v-axpbbzuodenmsbayweywpnkommuv' clean build test | tee '/Users/ci/Library/Logs/scan/my-app-Debug.log' | xcpretty

Works

1
set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace ./my-app.xcworkspace -scheme Debug \
        -destination 'platform=iOS Simulator,id=F87F228A-EC9B-44F8-AD1E-A2FD2D56FD7B' \
        -derivedDataPath '/Users/ci/Library/Developer/Xcode/DerivedData/my-app-axpbbzuodenmsbayweywpnkommuv' clean build  | \
tee '/Users/ci/Library/Logs/scan/my-app-Debug.log'                                                                        | xcpretty
2
set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace ./my-app.xcworkspace -scheme Debug \
        -destination 'platform=iOS Simulator,name=iPhone 6' \
        -derivedDataPath '/Users/ci/Library/Developer/Xcode/DerivedData/my-app-axpbbzuodenmsbayweywpnkommuv' clean build  | \
tee '/Users/ci/Library/Logs/scan/my-app-Debug.log'                                                                        | xcpretty   
3
export TEMP_DIR=`mktemp -d`
echo $TEMP_DIR
set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace ./my-app.xcworkspace -scheme Debug \
        -destination 'platform=iOS Simulator,name=iPhone 6' \
        -derivedDataPath $TEMP_DIR clean build                                                                       | xcpretty 
echo $TEMP_DIR
find $TEMP_DIR -name my-app.app

my-app.app is found in $TEMP_DIR/Build/Products/Debug-iphonesimulator/my-app.app

Tests

set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace ./my-app.xcworkspace -scheme Debug \
        -destination 'platform=iOS Simulator,name=iPhone 6' \
        -derivedDataPath '/Users/ci/Library/Developer/Xcode/DerivedData/my-app-axpbbzuodenmsbayweywpnkommuv' clean build  | \
tee '/Users/ci/Library/Logs/scan/my-app-Debug.log'                                                                        | xcpretty     
set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace ./my-app.xcworkspace -scheme Debug \
        -sdk iphonesimulator9.3                                                         \
        -destination 'platform=iOS Simulator,name=iPhone 6' \
        -derivedDataPath '/Users/ci/Library/Developer/Xcode/DerivedData/my-app-axpbbzuodenmsbayweywpnkommuv' clean build  | \
tee '/Users/ci/Library/Logs/scan/my-app-Debug.log'                                                                        | xcpretty

Build

xcodebuild -workspace my-app.xcworkspace -scheme Nightly            -sdk iphonesimulator9.3 -destination 'platform=OS X,arch=x86_64'              | xcpretty
xcodebuild -workspace my-app.xcworkspace -scheme Nightly            -sdk iphonesimulator9.3 -destination 'platform=iOS Simulator, name:iPhone 6'  | xcpretty
xcodebuild -workspace my-app.xcworkspace -scheme Nightly -arch i386 -sdk iphonesimulator9.3                                                       | xcpretty
xcodebuild -workspace my-app.xcworkspace -scheme Nightly -arch i386 -sdk iphonesimulator9.3 build  | xcpretty

xcodebuild -project George.xcodeproj -alltargets -parallelizeTargets -configuration Debug build

xcodebuild ARCHS="i386" ONLY_ACTIVE_ARCH=NO -scheme temp -sdk iphonesimulator6.1

xcodebuild -workspace my-app.xcworkspace -scheme Nightly  ARCHS="i386" ONLY_ACTIVE_ARCH=NO -sdk iphonesimulator9.3 -configuration Debug build

xctool

xctool -workspace my-app.xcworkspace -scheme Debug test

fastlane (gym)

gym --workspace ASmy-appOS.xcworkspace --scheme "Nightly" --clean --sdk iphonesimulator9.3 --use_legacy_build_api --xcargs "'CODE_SIGNING_REQUIRED=NO' 'CODE_SIGN_IDENTITY=' 'PROVISIONING_PROFILE='"
gym --workspace my-app.xcworkspace --scheme "Nightly" --clean --sdk iphonesimulator9.3 --use_legacy_build_api --xcargs "'CODE_SIGNING_REQUIRED=NO' 'CODE_SIGN_IDENTITY=' 'PROVISIONING_PROFILE='"

App is currently stored in APP_PATH="/Users/ci/appiumTestApp/my-app.app", need to automate creation.

xcodebuild -workspace my-app.xcworkspace   -scheme Nightly -arch i386  -sdk iphonesimulator9.3 | xcpretty
find ~/Library/Developer/Xcode/DerivedData/ -name my-app.app -exec echo {} \; | grep Nightly-iphonesimulator
ls /Users/ci/Library/Developer/Xcode/DerivedData/cvdcbkuhcdwgtvdnqkygobushpyq/Build/Products/Nightly-iphonesimulator

Building simulator .app with xcodebuild

TODO: Consider xctool

xcodebuild -showsdks | grep iphonesimulator | awk 'NF>1{print $NF}'

If this is something you'd like to support in gym, here are the main things that are different for a simulator build:

We didn't need to sign the IPA (this worked fine by leaving out provisioning_profile_path)
We needed to pass the -arch i386 option and ONLY_ACTIVE_ARCH=NO (this worked fine via xcargs)
Needed to exclude the -destination and -archivePath options
The xcodebuild action should be build instead of archive

List the available SDKs: xcodebuild -showsdks

For example, I have iphonesimulator9.3 in my list of SDKs. This will be used in the next step.

Xcode Build

Build the project:

xcodebuild -project '/path/to/Awesome.xcproj' -arch i386 -sdk iphonesimulator8.2

If you are using workspace, then you need to provide the scheme too:

xcodebuild -workspace '/path/to/Awesome.xcworkspace' -scheme 'Awesome-Production' -arch i386 -sdk iphonesimulator8.2

Or, more likely, you are using Xcode app (not commandline), then just build the app as per normal. The build will be created at ~/Library/Developer/Xcode/DerivedData. So, if the build is successful, the app will be at ~/Library/Developer/Xcode/DerivedData/Awesome-dvxamtpiqakwogarovbwiagepzxj/Build/Products/Release-iphonesimulator/Awesome.app. This path is needed in the next step.