The best approach is to create pseudo target in your project.
For example, say you have a shell script that sets the app version by updating an .xcconfig
file:
- Create a target called
SetAppVersion
of typeOther
>External Build System
. - Leave the Build Tool at
/bin/bash
, set the Arguments to whatever script does the work, for examplescripts/set_app_version.sh
and set the Directory to$(PROJECT_DIR)
.
Now for any target affected by this script, simply make the SetAppVersion
target a dependency of it, and it will run before any other action is performed on those targets.