Mainly in my app I’ve a script that outputs a folder with a couple of information inside it. This folder is output to $(BUILT_PRODUCTS_DIR)/construct/
and is referenced through a PBXBuildFile.
As a result of I put a wait within the script (to simulate a protracted construct I’ve in my actual undertaking) it is extremely apparent when the script is or is not run. The aim can be for it to run solely when its dependencies have modified.
The trick is that if I put this script as a “run script” section inside my closing goal dependency evaluation works nice. The script solely runs when the dependencies are up to date. Nonetheless if I put the “run script” section into an combination goal then add it as a Goal Dependency in the principle goal Xcode needs to run the script each time. No matter if the dependencies have modified. Nonetheless if you happen to construct simply the mixture goal alone all the things goes simply superb. It solely builds when it has to.
To me this doesn’t fairly make sense. I believed that dependency evaluation of the script inside my combination goal can be the identical no matter whether or not that script was inside the combination goal or the principle goal.
In my app I ideally want the mixture goal to be shared by a number of different targets. Whereas I might put the script in every it could be extra foolproof to have them share an combination goal.
Why would dependency evaluation come to a distinct conclusion when the script is inside an combination goal that could be a goal dependency of the principle goal?
If it helps right here is the script and all the undertaking could be discovered right here on GitHub if you need to play with it.
mkdir -p "${SCRIPT_OUTPUT_FILE_0}/construct/"
echo "Pausing for 10 seconds earlier than creating information..."
sleep 10
cat "${SCRIPT_INPUT_FILE_0}"
cat > "${SCRIPT_OUTPUT_FILE_0}/construct/index.html"
Easy Web page
Generated at: $(date)
EOF
cat > "${SCRIPT_OUTPUT_FILE_0}/construct/web page.html"
Easy Web page
EOF