在使用Cocoapods的项目中,我有3个自定义.xcconfig:
P.Base.xcconfig
P.Debug.xcconfig (Build configuration Debug)
P.Internal.xcconfig (Build configuration Internal)
Base包含通用配置,另外2个继承Base并对其进行扩充/覆盖。
项目代码分为私有Pod,我需要使用与主项目相同的配置来构建它们。
我几乎确定我需要添加类似的内容
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config. ???
end
end
end
在我的Podfile的末尾,但是我不知道如何设置各种.xcconfig
更新
我很接近,我只需要加载de .xcconfig文件,而不是对配置文件进行硬编码:
post_install do |installer|
puts "Chaining xcconfigs"
installer.pods_project.targets.each do |target|
puts "Target: " + target.name
target.build_configurations.each do |config|
puts "Config: " + config.name
specific_config = ['']
if config.name == 'Debug'
specific_config = ['DEBUG=1','xxxx']
end
if config.name == 'Internal'
specific_config = ['INTERNAL_BUILD=1']
end
old_defines = config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] || []
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = old_defines + specific_config + ['$(inherited) OSATOMIC_USE_INLINED=1 otherstuff']
puts "Result: " + config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'].join(', ')
end
end
end