我假设类似的事情
post_install do |installer|
# Debug symbols
installer.pod_project.targets.each do |target|
target.build_configurations.each do |config|
if ? == ?
config.build_settings['?'] = '?'
end
end
end
end
我今天遇到了类似的问题,并根据依赖项的复杂性找到了两种方法来实现此目的。
第一种方法很简单,如果您的本地开发 pod 位于主 pod 文件中并且未嵌套在另一个依赖项中,则应该可以使用。基本上像往常一样禁止所有警告,但在每个本地 Pod 上指定 false:
inhibit_all_warnings!
pod 'LocalPod', :path => '../LocalPod', :inhibit_warnings => false
pod 'ThirdPartyPod',
第二种更全面且适用于复杂嵌套依赖项的方法是创建本地 Pod 的白名单,然后在安装后期间禁止不属于白名单的任何 Pod 发出警告:
$local_pods = Hash[
'LocalPod0' => true,
'LocalPod1' => true,
'LocalPod2' => true,
]
def inhibit_warnings_for_third_party_pods(target, build_settings)
return if $local_pods[target.name]
if build_settings["OTHER_SWIFT_FLAGS"].nil?
build_settings["OTHER_SWIFT_FLAGS"] = "-suppress-warnings"
else
build_settings["OTHER_SWIFT_FLAGS"] += " -suppress-warnings"
end
build_settings["GCC_WARN_INHIBIT_ALL_WARNINGS"] = "YES"
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
inhibit_warnings_for_third_party_pods(target, config.build_settings)
end
end
end
现在,这只会抑制第 3 方依赖项,但会在任何本地 pod 上保留警告。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)