Commit ac11caf6 authored by Marius Rackwitz's avatar Marius Rackwitz

[PodTarget] Add #target_definitions

parent d8297f70
......@@ -7,6 +7,11 @@ module Pod
#
attr_reader :specs
# @return [Array<PBXNativeTarget>] the target definitions of the Podfile
# that generated this target.
#
attr_reader :target_definitions
# @return [HeadersStore] the header directory for the target.
#
attr_reader :build_headers
......@@ -42,7 +47,7 @@ module Pod
#
def label
if scoped?
"#{target_definition.label}-#{root_spec.name}"
"#{target_definitions.first.label}-#{root_spec.name}"
else
root_spec.name
end
......
......@@ -134,7 +134,7 @@ def fixture_pod_target(spec_or_name, platform = :ios, target_definition = nil)
end
def fixture_aggregate_target(pod_targets = [], platform = :ios, target_definition = nil)
target_definition ||= pod_targets.map(&:target_definition).first || fixture_target_definition
target_definition ||= pod_targets.flat_map(&:target_definitions).first || fixture_target_definition
target = Pod::AggregateTarget.new(target_definition, config.sandbox)
target.client_root = config.sandbox.root.dirname
version ||= (platform == :ios ? '4.3' : '10.6')
......
......@@ -17,7 +17,7 @@ module Pod
@pod_target = pod_target(@spec)
@consumer = @pod_target.spec_consumers.last
@target = fixture_aggregate_target([@pod_target])
@target.target_definition.should == @pod_target.target_definition
@target.target_definition.should == @pod_target.target_definitions.first
@target.target_definition.whitelist_pod_for_configuration(@spec.name, 'Release')
@podfile = @target.target_definition.podfile
@generator = AggregateXCConfig.new(@target, 'Release')
......
......@@ -226,7 +226,7 @@ module Pod
end
it 'flags should not be added to dtrace files' do
@installer.target.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true)
@installer.target.target_definitions.first.stubs(:inhibits_warnings_for_pod?).returns(true)
@installer.install!
dtrace_files = @installer.target.native_target.source_build_phase.files.select do |sf|
......@@ -238,7 +238,7 @@ module Pod
end
it 'adds -w per pod if target definition inhibits warnings for that pod' do
@installer.target.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true)
@installer.target.target_definitions.first.stubs(:inhibits_warnings_for_pod?).returns(true)
flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios), true)
flags.should.include?('-w')
......@@ -250,7 +250,7 @@ module Pod
end
it 'adds -Xanalyzer -analyzer-disable-checker per pod' do
@installer.target.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true)
@installer.target.target_definitions.first.stubs(:inhibits_warnings_for_pod?).returns(true)
flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios), true)
flags.should.include?('-Xanalyzer -analyzer-disable-all-checks')
......
......@@ -137,7 +137,7 @@ module Pod
describe 'With libraries' do
before do
@pod_target = fixture_pod_target('banana-lib/BananaLib.podspec')
@target = AggregateTarget.new(@pod_target.target_definition, config.sandbox)
@target = AggregateTarget.new(@pod_target.target_definitions.first, config.sandbox)
@target.pod_targets = [@pod_target]
end
......@@ -197,7 +197,7 @@ module Pod
describe 'With frameworks' do
before do
@pod_target = fixture_pod_target('orange-framework/OrangeFramework.podspec', :ios, Podfile::TargetDefinition.new('iOS Example', nil))
@target = AggregateTarget.new(@pod_target.target_definition, config.sandbox)
@target = AggregateTarget.new(@pod_target.target_definitions.first, config.sandbox)
@target.stubs(:requires_frameworks?).returns(true)
@target.pod_targets = [@pod_target]
end
......
......@@ -20,8 +20,8 @@ module Pod
end
describe 'In general' do
it 'returns the target_definition that generated it' do
@pod_target.target_definition.should == @target_definition
it 'returns the target definitions' do
@pod_target.target_definitions.should == [@target_definition]
end
it 'returns its name' 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