Вопрос: CocoaPods генерирует файл xcconfig
для моего проекта, и я хочу включить файл xcconfig
в качестве зависимости от него. Могу ли я сделать, например, в post_install
крюке? Я только обнаружил, что XCBuildConfiguration имеет build_settings
хеш, но насколько я понял, я могу добавлять или изменять только ключи и не включать инструкции с этим хешем.Можно ли включить xcconfig в один, сгенерированный CocoaPods
0
A
ответ
0
Следуя инструкции из this answer я смог обновить xcconfig
и я использую этот код, чтобы включить мой xcconfig
файл в стручке Сгенерированный:
post_install do |installer|
installer.pods_project.targets.each do |target|
next unless target.name.include?("Pods-CNISDK")
puts "Updating #{target.name}"
target.build_configurations.each do |config|
xcconfig_path = config.base_configuration_reference.real_path
# read from xcconfig to build_settings dictionary
build_settings = Hash[*File.read(xcconfig_path).lines.map{|x| x.split(/\s*=\s*/, 2)}.flatten]
# write build_settings dictionary to xcconfig
File.open(xcconfig_path, "w") do |file|
file.puts "#include \"../configurations/Warnings.xcconfig\"\n"
build_settings.each do |key,value|
file.puts "#{key} = #{value}"
end
end
end
end
end