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