Created
October 3, 2014 16:08
-
-
Save amleszk/3ad63f5fd8b164fb1149 to your computer and use it in GitHub Desktop.
post_install xcode example
This file contains 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
post_install do |installer| | |
project = Xcodeproj::Project.open('MeetupApp.xcodeproj') | |
config_mapping = { | |
:Debug => 'Configuration/Debug.xcconfig' | |
} | |
set_xcconfig_reference(project,'MeetupApp','Debug','Configuration/Debug.xcconfig') | |
end | |
def set_xcconfig_reference(project, target_name, config_name, xcconfig_name) | |
puts project.targets | |
target = project.targets.find { |target| | |
target.name == target_name | |
} | |
!target and abort("Post install - target: #{target_name} not found") | |
puts target.build_configurations | |
target_config = target.build_configurations.find { |config| | |
config.name == config_name | |
} | |
!target_config and abort("Post install - target: #{target_name} config: #{config_name} not found") | |
!File.exist?(xcconfig_name) and abort("Post install - File does not exist #{xcconfig_name}") | |
config..base_configuration_reference = xcconfig_name | |
puts "Overriding configuration setting: #{target_name}.#{config_name} = #{xcconfig_name}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment