While configuring Xcode Cloud for Wordsmith, I stumbled upon a build error where dependency that use Macro need to be enabled before it can be used.
This is common error when you use third party dependency via SPM that also have macros dependency. In Xcode when this happens, usually a pop up is shown and you can click Trust
to make it enabled. However since this is happening on Xcode Cloud we need some scripts to do it.
From Xcode Cloud documentation, we can run 3 different scripts on different stages of build process:
ci_post_clone.sh
. run after Xcode Cloud succesfully clone our projectci_pre_xcodebuild.sh
. run before Xcode Cloud invokingxcodebuild
commandci_post_xcodebuild.sh
. run after Xcode Cloud finished runningxcodebuild
We must place all of those three scripts on folder called ci_scripts
in order to Xcode Cloud to be able to recognize and run it.
So to solve build failure for Wordsmith, I create ci_post_clone.sh
that contains this following code
#!/bin/sh
#
defaults write com.apple.dt.Xcode IDESkipMacroFingerprintValidation -bool YES
Few notes:
- Scripts must include a shebang in the first line
#!/bin/sh
- Make the script executable by running
chmod +x filename.sh