Commit 1db8d02a authored by Marius Rackwitz's avatar Marius Rackwitz

[Podfile] Add shortcut to access the podfile

parent 25e2940f
...@@ -33,7 +33,7 @@ module Pod ...@@ -33,7 +33,7 @@ module Pod
# #
def self.default_ld_flags(target) def self.default_ld_flags(target)
ld_flags = '-ObjC' ld_flags = '-ObjC'
if target.target_definition.podfile.set_arc_compatibility_flag? && if target.podfile.set_arc_compatibility_flag? &&
target.spec_consumers.any?(&:requires_arc?) target.spec_consumers.any?(&:requires_arc?)
ld_flags << ' -fobjc-arc' ld_flags << ' -fobjc-arc'
end end
......
...@@ -81,7 +81,7 @@ module Pod ...@@ -81,7 +81,7 @@ module Pod
# @return [void] # @return [void]
# #
def create_bridge_support_file def create_bridge_support_file
if target_definition.podfile.generate_bridge_support? if target.podfile.generate_bridge_support?
path = target.bridge_support_path path = target.bridge_support_path
headers = native_target.headers_build_phase.files.map { |bf| sandbox.root + bf.file_ref.path } headers = native_target.headers_build_phase.files.map { |bf| sandbox.root + bf.file_ref.path }
generator = Generator::BridgeSupport.new(headers) generator = Generator::BridgeSupport.new(headers)
......
...@@ -30,6 +30,12 @@ module Pod ...@@ -30,6 +30,12 @@ module Pod
c99ext_identifier(label) c99ext_identifier(label)
end end
# @return [Podfile] The podfile which declares the dependency
#
def podfile
target_definition.podfile
end
# @return [Pathname] the folder where the client is stored used for # @return [Pathname] the folder where the client is stored used for
# computing the relative paths. If integrating it should be the # computing the relative paths. If integrating it should be the
# folder where the user project is stored, otherwise it should # folder where the user project is stored, otherwise it should
......
...@@ -48,6 +48,12 @@ module Pod ...@@ -48,6 +48,12 @@ module Pod
end end
end end
# @return [Podfile] The podfile which declares the dependency.
#
def podfile
target_definitions.first.podfile
end
# @return [String] The name to use for the source code module constructed # @return [String] The name to use for the source code module constructed
# for this target, and which will be used to import the module in # for this target, and which will be used to import the module in
# implementation source files. # implementation source files.
......
...@@ -13,17 +13,15 @@ module Pod ...@@ -13,17 +13,15 @@ module Pod
describe '::default_ld_flags' do describe '::default_ld_flags' do
it 'returns the default linker flags' do it 'returns the default linker flags' do
podfile = stub(:set_arc_compatibility_flag? => false) podfile = stub(:set_arc_compatibility_flag? => false)
target_definition = stub(:podfile => podfile) target = stub(:podfile => podfile)
target = stub(:target_definition => target_definition)
result = @sut.default_ld_flags(target) result = @sut.default_ld_flags(target)
result.should == '-ObjC' result.should == '-ObjC'
end end
it 'includes the ARC compatibility flag if required by the Podfile' do it 'includes the ARC compatibility flag if required by the Podfile' do
podfile = stub(:set_arc_compatibility_flag? => true) podfile = stub(:set_arc_compatibility_flag? => true)
target_definition = stub(:podfile => podfile)
spec_consumer = stub(:requires_arc? => true) spec_consumer = stub(:requires_arc? => true)
target = stub(:target_definition => target_definition, :spec_consumers => [spec_consumer]) target = stub(:podfile => podfile, :spec_consumers => [spec_consumer])
result = @sut.default_ld_flags(target) result = @sut.default_ld_flags(target)
result.should == '-ObjC -fobjc-arc' result.should == '-ObjC -fobjc-arc'
end end
......
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