Created
January 27, 2015 04:07
-
-
Save thedoritos/9ce0c62896825c921bd0 to your computer and use it in GitHub Desktop.
Override Xcode Build Settings on Podfile for Unity-iPhone
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
target 'Unity-iPhone' do | |
end | |
target 'Unity-iPhone Tests' do | |
end | |
pre_install do |installer| | |
XCODE_PROJECT_PATH = './Unity-iPhone.xcodeproj' | |
BUILD_CONFIGURATION = 'Release' | |
SEARCH_PATH_SETTINGS = ['HEADER_SEARCH_PATHS', 'OTHER_CFLAGS', 'OTHER_LDFLAGS'] | |
BUILD_PATH_SETTINGS = ['CONFIGURATION_BUILD_DIR'] | |
proj = Xcodeproj::Project.open(XCODE_PROJECT_PATH) | |
puts "Override Build Settings for #{proj.path}" | |
proj.targets.each do |target| | |
puts "Override for target:#{target.name}" | |
SEARCH_PATH_SETTINGS.each do |key| | |
values = [*target.build_configuration_list.get_setting(key)[BUILD_CONFIGURATION]] | |
overriden_values = (values.include? '$(inherited)') ? values : ['$(inherited)'] + values | |
target.build_configuration_list.set_setting(key, overriden_values) | |
puts "Override for key:#{key} from:#{values} to:#{overriden_values}" | |
end | |
BUILD_PATH_SETTINGS.each do |key| | |
value = target.build_configuration_list.get_setting(key) | |
overriden_value = '$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)' | |
target.build_configuration_list.set_setting(key, overriden_value) | |
puts "Override for key:#{key} from:#{value} to:#{overriden_value}" | |
end | |
end | |
proj.save | |
puts "Override saved" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment