[Xcode] Additional command line parameters - Runtime destination specification

Hi,

My setup is :
One TeamCity server connected to 3 MacOS build agents. Each agent have an iOS device connected to run Xcode tests (We can't use the simulator).

What I want to do is instead of hardcoding the device IDs, I want to invoke Instruments when the step is being exectuted.
I already have the CLI which is

xcodebuild -workspace MyWorkspace.xcworkspace -scheme MyScheme clean test -destination id=`instruments -s devices | grep -v '-' | grep -o -E '\[[a-z0-9]+' | grep -o -E '[a-z0-9]+'` -configuration Debug

But when I put

-destination id=`instruments -s devices | grep -v '-' | grep -o -E '\[[a-z0-9]+' | grep -o -E '[a-z0-9]+'` -configuration Debug

in the Additional command line parameters it fails with

[Step 2/2] Building workspace: /Users/server/buildagent/work/e13900a387db0bc1/MyWorkspace.xcworkspace
[Step 2/2] Using Xcode 6.3.2

[Step 2/2] Starting: /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace MyWorkspace.xcworkspace -scheme MyScheme clean test -destination id=`instruments -s devices | grep -v '-' | grep -o -E '\[[a-z0-9]+' | grep -o -E '[a-z0-9]+'` -configuration Debug
[Step 2/2] in directory: /Users/server/buildagent/work/e13900a387db0bc1
[Step 2/2] xcodebuild: error: invalid option '-s'

Anyone know a better/working way for this ?

1 comment
Comment actions Permalink

Hi Charles,

Sorry for delay.
Do I correctly understand that the Command Line build step runs successfully? Do you use the same Xcode version in both cases?
TeamCity just starts xcodebuild and the error "xcodebuild: error: invalid option '-s'" is returned by xcodebuild. Have you tried to use different quotes: " instead of ` for destination id?

0

Please sign in to leave a comment.