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
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'
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.