2

I am doing CI build on azure devops. I am wondering how to pass pre-processor macro value so that I can make different flavours of build.

AFAIK if we can set preprocessor macro in xcode build then we can do it on azure devops as well.

Any helpful pointer is welcome

2 Answers 2

4

Approach 1: By the means of GCC_PREPROCESSOR_DEFINITIONS

You have to make use of GCC_PREPROCESSOR_DEFINITIONS on xcodebuild command line.

Here is a sample macro in your code

#ifdef Flavour1 

NSLog(@"This is flavour 1"); 

#endif

and Here is how you pass the macro through command line

xcodebuild -verbose -scheme "YourAppScheme" GCC_PREPROCESSOR_DEFINITIONS='$GCC_PREPROCESSOR_DEFINITIONS Flavour1=1'

Approach 2: By the means of separate xcode Scheme

Have a scheme and it's respective target for each flavour. so that it can have different App name,version number,signers etc if required and you can have macro injected in preprocessor definition of build settings in target.

All you have to do is just pass the right scheme in xcodebuild command and that's you sorted

P.S:-

I personally prefer Approach 2 because it's easy to customise without worrying much about xcodebuild command line parameters.

Sign up to request clarification or add additional context in comments.

Comments

0

You can create a ruby script which can setup the project. Xcodeproj is a powerful tool to modify Xcode projects.

https://github.com/CocoaPods/Xcodeproj

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.