Re: Multiple versions of an app


Alex Zavatone
 

In part of this thread, we talked about using build environment variables for um, stuff and things. Here’s a short little write up I did last year to show how massively useful they can be.

Using build configuration environment variables
Here are some of the strings:
$(BUNDLE_DISPLAY_NAME) - $(CONFIGURATION).entitlements
$(PRODUCT_NAME) - $(CONFIGURATION).entitlements

This gives us
MyApp - Debug.entitlements
MyApp - Release.entitlements
MyApp - Test.entitlements

In building paths for files used for builds, you can also use them to automatically create paths to files based on product name, build configuration or both.
Below is how to create build setting file path that uses app name and build configuration name dependent entitlements files.

$(SRCROOT)/../$(PRODUCT_NAME)/$(PRODUCT_NAME)-$(CONFIGURATION).entitlements

The big deal here is that you duplicate your target name and/or add a new build configuration, new entitlement files following a naming convention are automatically looked for. All you need to to is create them and they are automatically used in your build.

Cheers!
Alex Zavatone

Join xcode@apple-dev.groups.io to automatically receive all group messages.