Commit 3b900e68 authored by Eloy Durán's avatar Eloy Durán

Add Podfile#inhibit_all_warnings! to silence warnings, but not by default. #209

parent 1477c44d
...@@ -13,10 +13,11 @@ module Pod ...@@ -13,10 +13,11 @@ module Pod
def xcconfig def xcconfig
@xcconfig ||= Xcodeproj::Config.new({ @xcconfig ||= Xcodeproj::Config.new({
# In a workspace this is where the static library headers should be found. # In a workspace this is where the static library headers should be found.
'PODS_ROOT' => @target_definition.relative_pods_root, 'PODS_ROOT' => @target_definition.relative_pods_root,
'PODS_HEADERS_SEARCH_PATHS' => '${PODS_PUBLIC_HEADERS_SEARCH_PATHS}', 'PODS_HEADERS_SEARCH_PATHS' => '${PODS_PUBLIC_HEADERS_SEARCH_PATHS}',
'ALWAYS_SEARCH_USER_PATHS' => 'YES', # needed to make EmbedReader build 'ALWAYS_SEARCH_USER_PATHS' => 'YES', # needed to make EmbedReader build
'OTHER_LDFLAGS' => default_ld_flags, 'OTHER_LDFLAGS' => default_ld_flags,
'GCC_WARN_INHIBIT_ALL_WARNINGS' => @target_definition.inhibit_all_warnings? ? 'YES' : 'NO',
}) })
end end
......
...@@ -62,7 +62,7 @@ module Pod ...@@ -62,7 +62,7 @@ module Pod
attr_reader :name, :target_dependencies attr_reader :name, :target_dependencies
attr_accessor :user_project, :link_with, :platform, :parent, :exclusive attr_accessor :user_project, :link_with, :platform, :parent, :exclusive, :inhibit_all_warnings
def initialize(name, options = {}) def initialize(name, options = {})
@name, @target_dependencies = name, [] @name, @target_dependencies = name, []
...@@ -96,6 +96,11 @@ module Pod ...@@ -96,6 +96,11 @@ module Pod
@platform || (@parent.platform if @parent) @platform || (@parent.platform if @parent)
end end
def inhibit_all_warnings
@inhibit_all_warnings.nil? ? (@parent.inhibit_all_warnings? if @parent) : @inhibit_all_warnings
end
alias_method :inhibit_all_warnings?, :inhibit_all_warnings
def label def label
if name == :default if name == :default
"Pods" "Pods"
...@@ -284,6 +289,10 @@ module Pod ...@@ -284,6 +289,10 @@ module Pod
@target_definition.link_with = targets @target_definition.link_with = targets
end end
def inhibit_all_warnings!
@target_definition.inhibit_all_warnings = true
end
# Specifies a dependency of the project. # Specifies a dependency of the project.
# #
# A dependency requirement is defined by the name of the Pod and _optionally_ # A dependency requirement is defined by the name of the Pod and _optionally_
......
...@@ -66,6 +66,15 @@ describe Pod::Installer::TargetInstaller do ...@@ -66,6 +66,15 @@ describe Pod::Installer::TargetInstaller do
@installer.xcconfig.to_hash['OTHER_LDFLAGS'].split(" ").should.include("-fobjc-arc") @installer.xcconfig.to_hash['OTHER_LDFLAGS'].split(" ").should.include("-fobjc-arc")
end end
it "does not enable the GCC_WARN_INHIBIT_ALL_WARNINGS flag by default" do
@installer.xcconfig.to_hash['GCC_WARN_INHIBIT_ALL_WARNINGS'].should == 'NO'
end
it "enables the GCC_WARN_INHIBIT_ALL_WARNINGS flag" do
@podfile.inhibit_all_warnings!
@installer.xcconfig.to_hash['GCC_WARN_INHIBIT_ALL_WARNINGS'].should == 'YES'
end
it "creates a prefix header, including the contents of the specification's prefix header file" do it "creates a prefix header, including the contents of the specification's prefix header file" do
do_install! do_install!
prefix_header = @sandbox.root + 'Pods.pch' prefix_header = @sandbox.root + 'Pods.pch'
......
...@@ -151,6 +151,7 @@ describe "Pod::Podfile" do ...@@ -151,6 +151,7 @@ describe "Pod::Podfile" do
target :test, :exclusive => true do target :test, :exclusive => true do
link_with 'TestRunner' link_with 'TestRunner'
inhibit_all_warnings!
pod 'JSONKit' pod 'JSONKit'
target :subtarget do target :subtarget do
pod 'Reachability' pod 'Reachability'
...@@ -295,6 +296,12 @@ describe "Pod::Podfile" do ...@@ -295,6 +296,12 @@ describe "Pod::Podfile" do
project.build_configurations.should == { 'Release' => :release, 'Debug' => :debug, 'Test' => :debug, 'App Store' => :release } project.build_configurations.should == { 'Release' => :release, 'Debug' => :debug, 'Test' => :debug, 'App Store' => :release }
end end
it "specifies that the inhibit all warnings flag should be added to the target's build settings" do
@podfile.target_definitions[:default].should.not.inhibit_all_warnings
@podfile.target_definitions[:test].should.inhibit_all_warnings
@podfile.target_definitions[:subtarget].should.inhibit_all_warnings
end
describe "with an Xcode project that's not in the project_root" do describe "with an Xcode project that's not in the project_root" do
before do before do
@target_definition = @podfile.target_definitions[:default] @target_definition = @podfile.target_definitions[:default]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment