We discovered that without excluding arm64 our CI (Xcode cloud) fails. I’d want to use a script, specifically ci_post_clone.sh script to dynamically change this setting. But I’m failing to write a proper script. Can someone help please?
This is the code I tried, and the script doesn’t even execute as it fails.
#!/bin/sh
# Now run a Ruby script to modify Xcode project settings
/usr/bin/env ruby <<EOF
require 'xcodeproj'
# Open the Xcode project
project = Xcodeproj::Project.open('ProjectName.xcodeproj')
# Define the architecture to be excluded
bad_arch = 'arm64' # Modify as needed
# Modify the build settings for the Test Debug configuration
project.build_configurations.each do |config|
if config.name == 'Test Debug'
config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = bad_arch
end
end
# Save the project after modifying the build settings
project.save
EOF
But it fails with: /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require’: cannot load such file — xcodeproj (LoadError). Which means that xcodeproj is not installed, I can’t install it as I have no permissions in Xcode cloud.
I also tried:
#!/bin/sh
# Path to your Xcode project file
PROJECT_FILE="ProjectName.xcodeproj/project.pbxproj"
# Exclude arm64 architecture for the simulator in all build configurations
sed -i '' -e 's/EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator = "";/EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator = "arm64";/' "${PROJECT_FILE}"
But this one fails with: sed: ProjectName.xcodeproj/project.pbxproj: No such file or directory.
Instead of ProjectName I used the concrete project name, this is just a placeholder.