
In the Build Phases pane of the project editor, you can configure a project to run a shell script as part of building a target. In the shell script, you can use build phase-specific variables in addition to environment variables. You can also write to the build log and trigger a build failure.
You can use these additional variables in a build phase shell script:
Variable | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| The total number of script files described as inputs. | ||||||||||
| Each input file listed is exported as an environment variable, starting with | ||||||||||
| The total number of file lists described as input file lists. | ||||||||||
| A path to the file with each of the values within the given input list resolved with their expanded values, starting with | ||||||||||
| The total number of script files described as outputs. | ||||||||||
| Each output file listed is exported as an environment variable, starting with | ||||||||||
| The total number of file lists described as output file lists. | ||||||||||
| A path to the file with each of the values within the given output list resolved with their expanded values, starting with | ||||||||||
To add errors and warnings to the build log, write the message to standard out and prefix it with either error: or warning:. These messages will appear in the build log.
To trigger a build failure, return a non-zero exit code from the script.
For example:
echo "error: This is an error message that will show up in the build log."echo "warning: This is a warning message that will show up in the build log."# This will cause a build failureexit 1