So I am writing Automated tests that run from the command line to test the UI of my iOS application. I have the bash script working that cleans and builds the project and runs my UI Automated tests.
The problem is, I want the command-line script to be able to change a C Flag in my Xcode project that determines which server I am pointed at for my application. For example:
./run-test -target "Debug-Server"
will change the value of the C-Flag SERVER_ADDRESS to DEBUG_SERVER while:
./run-test -target "QA-Server"
changes the value of the C-Flag SERVER_ADDRESS to QA_SERVER
In order to do this, I plan to create a .xcconfig file that is fed into xcodebuild that will set the C Flags in my code to point to the correct server. Something like this:
xcodebuild -target <TARGET_NAME> -configuration Debug-QA.xcconfig -sdk "$DEVICE_SLUG""$CURRENT_SDK" DSTROOT=. clean build
I really am not familiar at all with .xcconfig files so I have a few questions about them.
- Do I have to describe every build setting in my .xcconfig file? Or is there some kind of "default" value that Xcode uses?
- Is there a better way of doing this?