Is there a way (possibly using schemes) in Xcode to specify that a clean is automatically done before doing a new build.?
I have a project that sometimes fails to build unless I do a clean first, currently I am doing it by hand.
Manually delete the [project]/. gradle as hidden folder as that one is the main culprit for large cleaned projects sizes. and don't forget to manually delete the [project]/. gradle hidden folder as that one is the main culprit for large cleaned projects sizes.
On the menu bar, choose Build, and then choose either Build ProjectName or Rebuild ProjectName. Choose Build ProjectName to build only those project components that have changed since the most recent build. Choose Rebuild ProjectName to "clean" the project and then build the project files and all project components.
To build, rebuild, or clean an entire solution Choose Rebuild All to "clean" the solution and then builds all project files and components. Choose Clean All to delete any intermediate and output files. With only the project and component files left, new instances of the intermediate and output files can then be built.
Build solution: Compiles code files (DLL and EXE) which are changed. Rebuild: Deletes all compiled files and compiles them again irrespective if the code has changed or not. Clean solution: Deletes all compiled files (DLL and EXE file).
Press ⌥⌘R, expand the selected scheme, select Pre-actions, click +, select New Run Script Action, set Provide Build Settings from to your target. In the box below type rm -rf ${BUILT_PRODUCTS_DIR}
. Note: it is BUILT not BUILD as seen in the Xcode dialog. You can type echo ${BUILT_PRODUCTS_DIR} > ~/Desktop/log.txt
to see what's going to be deleted.
The selected answer did not work for me, it caused my build to fail (Xcode 4.6.3) when trying to run on the simulator.
Based on Jano's answer and on this link in the Pre-action script instead of writing
rm -rf ${BUILT_PRODUCTS_DIR}
I wrote
touch ${BUILT_PRODUCTS_DIR}
This should have the same effect and it doesn't cause my build to fail
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With