Reputation: 22962
I'm assuming something along the lines of
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
Upvotes: 19
Views: 2315
Reputation: 1847
There's CocoaPods plugin, https://github.com/leavez/cocoapods-developing-folder that has inhibit_warnings_with_condition
. Citing the README:
🔸 Inhibit warnings for specific pods
Add the following to your podfile
plugin 'cocoapods-developing-folder' inhibit_warnings_with_condition do |pod_name, pod_target| # your condition written in ruby, like: # `not pod_name.start_with? "LE"` or # `['Asuka', 'Ayanami', 'Shinji'].include? pod_name` end
pod_target is a instance of Pod::PodTarget class, containing many more info than the name. You can use it to set up complex rules.
This function will override the warning inhibition settings by the original methods, like: inhibit_all_warnings!, pod 'Ayanami', :inhibit_warnings => true
So if you know the names of the local pods you can filter them like shown in the above example. Or you can try something like this (that tries to exploit the fact that local pods are not under Pods directory):
inhibit_warnings_with_condition do |pod_name, pod_target|
pod_target.file_accessors.first.root.to_path.start_with? pod_target.sandbox.root.to_path
end
Beware that, if I get the last statement there correctly, it will rule out inhibit_all_warnings!
and :inhibit_warnings
from effect (I checked the implementation and it looks like it's indeed the case). So you can not use both inhibit_warnings_with_condition
and inhibit_all_warnings!
or :inhibit_warnings
, but at the end, that kind of makes sense.
Upvotes: 0
Reputation: 81
I encountered a similar problem today and figured out two ways to achieve this depending on the complexity of your dependencies.
The first way is simple and should work if your local development pods are in your main pod file and not nested in another dependency. Basically inhibit all the warnings as per usual, but specify false on each local pod:
inhibit_all_warnings!
pod 'LocalPod', :path => '../LocalPod', :inhibit_warnings => false
pod 'ThirdPartyPod',
The second way which is more comprehensive and should work for complex nested dependencies is by creating a whitelist of your local pods and then during post install, inhibit the warnings of any pod that is not part of the whitelist:
$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
This will now only inhibit 3rd party dependencies but keep the warnings on any local pods.
Upvotes: 7
Reputation: 48514
Podfile Solution
While ignore_all_warnings
is an all or none proposition, you can :inhibit_warnings => true
on any individual pod in the Podfile.
# Disable warnings for each remote Pod
pod 'TGPControls', :inhibit_warnings => true
# Do not disable warnings for your own development Pod
pod 'Name', :path => '~/code/Pods/'
Upvotes: 2