If you use CocoaPods, you already have Xcodeproj installed as a dependency: https://github.com/CocoaPods/Xcodeproj
Here's an example that prints the change for each build config (Debug, Release, ...):
#!/usr/bin/env ruby
require "xcodeproj"
project_path = File.join(File.dirname(__FILE__), 'MultiMarkdown', 'build-xcode', 'libMultiMarkdown.xcodeproj')
project = Xcodeproj::Project.open(project_path)
target = project.targets.select { |t| t.name == "libMultiMarkdown" }.first
new_build_dir = '$SYMROOT/$CONFIGURATION'
outdated_configs = target.build_configurations.select { |c| c.build_settings['CONFIGURATION_BUILD_DIR'] != new_build_dir }
if outdated_configs.empty?
puts "All up-to-date"
exit
end
outdated_configs.each do |config|
old = config.build_settings['CONFIGURATION_BUILD_DIR']
config.build_settings['CONFIGURATION_BUILD_DIR'] = new_build_dir
puts "- [#{config.name}]: Changed `CONFIGURATION_BUILD_DIR` from #{old} to #{new_build_dir}"
end
if project.dirty?
puts "Saving changes ..."
project.save
end
You can replace the key with CODE_SIGN_RESOURCE_RULES_PATH
and modify that. For all targets:
new_path = "path/to/append"
target.build_configurations.each do |config|
config.build_settings['CODE_SIGN_RESOURCE_RULES_PATH'] += new_path
end
Again, since this is shipped with CocoaPods, if you have a dependency that needs that, you can use almost the same code in a CocoaPods hook.