Skip to content

Instantly share code, notes, and snippets.

@amleszk
Created October 3, 2014 16:08
Show Gist options
  • Save amleszk/3ad63f5fd8b164fb1149 to your computer and use it in GitHub Desktop.
Save amleszk/3ad63f5fd8b164fb1149 to your computer and use it in GitHub Desktop.
post_install xcode example
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