The suggestion provided by slavikus does work, but it poses a security risk because it enables any macro, allowing for the inclusion of malicious code in your Xcode build.
A safer approach could be to inform Xcode Cloud about the Macros you have explicitly enabled in your project, which are stored at ~/Library/org.swift.swiftpm/security/macros.json
, by creating a post-clone
script that copies this file into an internal location within Xcode Cloud.
Here are the steps to implement this solution:
- Create a folder called
ci_scripts
in your project's root directory.
- In this folder, create a script named
ci_post_clone.sh
with the following content:
#!/bin/zsh
mkdir -p ~/Library/org.swift.swiftpm/security/
cp macros.json ~/Library/org.swift.swiftpm/security/
- Copy file
~/Library/org.swift.swiftpm/security/macros.json
into the same folder.
This script will be executed after your project is cloned from the repo and before Xcode Cloud starts building the project.
For more details about writing custom scripts to enhance Xcode Cloud workflows: https://developer.apple.com/documentation/xcode/writing-custom-build-scripts
Running ci_post_clone.sh script failed (exited with code 1)
. macros.json is inci_scripts
folder - any idea? – Swamy