To add fooobar.com/questions/844962 / ... to the answer, it is important not to clutter up project.pbxproj (where the build scripts go) or the schema file (where these scripts go) as much as possible.
With that in mind, I create a Build-Scripts folder in the root directory of the project, where I put the build scripts of the application and the scripts before the action. This folder is dragged to the root of the project as a folder, so any script that I add to it is automatically added to the project.
Assuming your pre-action script is called That_pre-action_script.sh , this is what I put in the pre-action script based on the approved answer.
say "Pre build scripts running." exec > "${PROJECT_DIR}/prebuild.log" 2>&1 echo "Starting build scheme Pre-actions" "${PROJECT_DIR}/Build-Phases/That_pre-action_script.sh"
As a test, make sure you get some message from your script so that you can see it in the prebuild.log file.
Hope this helps.
And don't forget chmod u + x your script so that it starts.
The important part is that you cannot be sure if your build script is working or not. The say command is useful here for you to know that it is actually issued before assembly.
It is a good idea to quote the path to the script if there are spaces (or not) on the path to your project.
Alex zavatone
source share