Commit 943e14c4 authored by Eloy Duran's avatar Eloy Duran

Improve fix and improve spec for compiler_flags of subspecs. #364.

parent ee2dc5f6
...@@ -264,16 +264,11 @@ module Pod ...@@ -264,16 +264,11 @@ module Pod
def compiler_flags def compiler_flags
if @parent if @parent
chained = @compiler_flags[active_platform].clone flags = [@parent.compiler_flags]
# TODO hack to get the parent's compiler flags without it being
# converted to a String by Specification#compiler_flags.
chained.unshift @parent.instance_variable_get(:@compiler_flags)[active_platform]
else else
chained = @compiler_flags[active_platform].clone flags = [requires_arc ? ' -fobjc-arc' : '']
chained.unshift '-fobjc-arc' if requires_arc
chained.unshift ''
end end
chained.join(' ') (flags + @compiler_flags[active_platform].clone).join(' ')
end end
platform_attr_writer :compiler_flags, lambda {|value, current| current << value } platform_attr_writer :compiler_flags, lambda {|value, current| current << value }
......
...@@ -321,7 +321,7 @@ describe "A Pod::Specification subspec" do ...@@ -321,7 +321,7 @@ describe "A Pod::Specification subspec" do
it "automatically forwards top level attributes to the top level parent" do it "automatically forwards top level attributes to the top level parent" do
@spec.activate_platform(:ios) @spec.activate_platform(:ios)
[:version, :license, :authors, :requires_arc].each do |attr| [:version, :license, :authors, :requires_arc, :compiler_flags].each do |attr|
@spec.subspecs.first.send(attr).should == @spec.send(attr) @spec.subspecs.first.send(attr).should == @spec.send(attr)
@spec.subspecs.first.subspecs.first.send(attr).should == @spec.send(attr) @spec.subspecs.first.subspecs.first.send(attr).should == @spec.send(attr)
end end
...@@ -332,8 +332,10 @@ describe "A Pod::Specification subspec" do ...@@ -332,8 +332,10 @@ describe "A Pod::Specification subspec" do
@spec.source_files.map { |f| f.to_s }.should == %w[ spec.m ] @spec.source_files.map { |f| f.to_s }.should == %w[ spec.m ]
@subspec.source_files.map { |f| f.to_s }.should == %w[ spec.m subspec_ios.m ] @subspec.source_files.map { |f| f.to_s }.should == %w[ spec.m subspec_ios.m ]
@subsubspec.source_files.map { |f| f.to_s }.should == %w[ spec.m subspec_ios.m subsubspec.m ] @subsubspec.source_files.map { |f| f.to_s }.should == %w[ spec.m subspec_ios.m subsubspec.m ]
@subsubspec.resources.should == %w[ resource ] @subsubspec.resources.should == %w[ resource ]
@subsubspec.compiler_flags = '-Wdeprecated-implementations'
@subsubspec.compiler_flags.should == ' -fobjc-arc -Wdeprecated-implementations'
end end
it "returns empty arrays for chained attributes with no value in the chain" do it "returns empty arrays for chained attributes with no value in the chain" do
......
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