Commit 54b8a710 authored by Marius Rackwitz's avatar Marius Rackwitz

[PodTarget] #scoped returns multiple targets

One scoped target for each target definition
parent 0009b329
...@@ -30,7 +30,7 @@ module Pod ...@@ -30,7 +30,7 @@ module Pod
# dependency, but they require different sets of subspecs or they # dependency, but they require different sets of subspecs or they
# are on different platforms. # are on different platforms.
# #
attr_accessor :scoped attr_reader :scoped
alias_method :scoped?, :scoped alias_method :scoped?, :scoped
# @param [Array<Specification>] @spec #see spec # @param [Array<Specification>] @spec #see spec
...@@ -50,11 +50,16 @@ module Pod ...@@ -50,11 +50,16 @@ module Pod
@resource_bundle_targets = [] @resource_bundle_targets = []
end end
# @return [PodTarget] the same target, but scoped. # @return [Array<PodTarget>] a scoped copy for each target definition.
# #
def scoped def scoped
clone.tap do |scoped_target| target_definitions.map do |target_definition|
scoped_target.scoped = true PodTarget.new(specs, [target_definition], sandbox, true).tap do |target|
target.file_accessors = file_accessors
target.user_build_configurations = user_build_configurations
target.native_target = native_target
target.archs = archs
end
end end
end end
......
...@@ -109,7 +109,7 @@ module Pod ...@@ -109,7 +109,7 @@ module Pod
describe 'with a scoped pod target' do describe 'with a scoped pod target' do
def pod_target(spec) def pod_target(spec)
fixture_pod_target(spec).scoped fixture_pod_target(spec).scoped.first
end end
it 'links the pod targets with the aggregate target' do it 'links the pod targets with the aggregate target' do
...@@ -157,7 +157,7 @@ module Pod ...@@ -157,7 +157,7 @@ module Pod
describe 'with a scoped pod target' do describe 'with a scoped pod target' do
def pod_target(spec) def pod_target(spec)
fixture_pod_target(spec).scoped fixture_pod_target(spec).scoped.first
end end
it 'adds the framework build path to the xcconfig, with quotes, as framework search paths' do it 'adds the framework build path to the xcconfig, with quotes, as framework search paths' do
......
...@@ -93,7 +93,7 @@ module Pod ...@@ -93,7 +93,7 @@ module Pod
describe 'with a scoped pod target' do describe 'with a scoped pod target' do
before do before do
@pod_target.scoped = true @pod_target = @pod_target.scoped.first
end end
it 'adds file references for the support files of the target' do it 'adds file references for the support files of the target' do
......
...@@ -11,9 +11,9 @@ module Pod ...@@ -11,9 +11,9 @@ module Pod
describe 'Meta' do describe 'Meta' do
describe '#scoped' do describe '#scoped' do
it 'returns a cloned target, which is scoped' do it 'returns target copies per target definition, which are scoped' do
@pod_target.should.not.be.scoped @pod_target.should.not.be.scoped
@pod_target.scoped.should.be.scoped @pod_target.scoped.first.should.be.scoped
@pod_target.should.not.be.scoped @pod_target.should.not.be.scoped
end end
end end
...@@ -26,17 +26,17 @@ module Pod ...@@ -26,17 +26,17 @@ module Pod
it 'returns its name' do it 'returns its name' do
@pod_target.name.should == 'BananaLib' @pod_target.name.should == 'BananaLib'
@pod_target.scoped.name.should == 'Pods-BananaLib' @pod_target.scoped.first.name.should == 'Pods-BananaLib'
end end
it 'returns its label' do it 'returns its label' do
@pod_target.label.should == 'BananaLib' @pod_target.label.should == 'BananaLib'
@pod_target.scoped.label.should == 'Pods-BananaLib' @pod_target.scoped.first.label.should == 'Pods-BananaLib'
end end
it 'returns the name of its product' do it 'returns the name of its product' do
@pod_target.product_name.should == 'libBananaLib.a' @pod_target.product_name.should == 'libBananaLib.a'
@pod_target.scoped.product_name.should == 'libPods-BananaLib.a' @pod_target.scoped.first.product_name.should == 'libPods-BananaLib.a'
end end
it 'returns the spec consumers for the pod targets' do it 'returns the spec consumers for the pod targets' do
...@@ -53,7 +53,7 @@ module Pod ...@@ -53,7 +53,7 @@ module Pod
it 'returns the name of the resources bundle target' do it 'returns the name of the resources bundle target' do
@pod_target.resources_bundle_target_label('Fruits').should == 'BananaLib-Fruits' @pod_target.resources_bundle_target_label('Fruits').should == 'BananaLib-Fruits'
@pod_target.scoped.resources_bundle_target_label('Fruits').should == 'Pods-BananaLib-Fruits' @pod_target.scoped.first.resources_bundle_target_label('Fruits').should == 'Pods-BananaLib-Fruits'
end end
it 'returns the name of the Pods on which this target depends' do it 'returns the name of the Pods on which this target depends' do
...@@ -104,7 +104,7 @@ module Pod ...@@ -104,7 +104,7 @@ module Pod
@pod_target.xcconfig_path('Release').to_s.should.include?( @pod_target.xcconfig_path('Release').to_s.should.include?(
'Pods/Target Support Files/BananaLib/BananaLib.release.xcconfig', 'Pods/Target Support Files/BananaLib/BananaLib.release.xcconfig',
) )
@pod_target.scoped.xcconfig_path('Release').to_s.should.include?( @pod_target.scoped.first.xcconfig_path('Release').to_s.should.include?(
'Pods/Target Support Files/Pods-BananaLib/Pods-BananaLib.release.xcconfig', 'Pods/Target Support Files/Pods-BananaLib/Pods-BananaLib.release.xcconfig',
) )
end end
...@@ -113,7 +113,7 @@ module Pod ...@@ -113,7 +113,7 @@ module Pod
@pod_target.xcconfig_path("Release#{File::SEPARATOR}1").to_s.should.include?( @pod_target.xcconfig_path("Release#{File::SEPARATOR}1").to_s.should.include?(
'Pods/Target Support Files/BananaLib/BananaLib.release-1.xcconfig', 'Pods/Target Support Files/BananaLib/BananaLib.release-1.xcconfig',
) )
@pod_target.scoped.xcconfig_path("Release#{File::SEPARATOR}1").to_s.should.include?( @pod_target.scoped.first.xcconfig_path("Release#{File::SEPARATOR}1").to_s.should.include?(
'Pods/Target Support Files/Pods-BananaLib/Pods-BananaLib.release-1.xcconfig', 'Pods/Target Support Files/Pods-BananaLib/Pods-BananaLib.release-1.xcconfig',
) )
end end
...@@ -122,7 +122,7 @@ module Pod ...@@ -122,7 +122,7 @@ module Pod
@pod_target.prefix_header_path.to_s.should.include?( @pod_target.prefix_header_path.to_s.should.include?(
'Pods/Target Support Files/BananaLib/BananaLib-prefix.pch', 'Pods/Target Support Files/BananaLib/BananaLib-prefix.pch',
) )
@pod_target.scoped.prefix_header_path.to_s.should.include?( @pod_target.scoped.first.prefix_header_path.to_s.should.include?(
'Pods/Target Support Files/Pods-BananaLib/Pods-BananaLib-prefix.pch', 'Pods/Target Support Files/Pods-BananaLib/Pods-BananaLib-prefix.pch',
) )
end end
...@@ -137,7 +137,7 @@ module Pod ...@@ -137,7 +137,7 @@ module Pod
@pod_target.info_plist_path.to_s.should.include?( @pod_target.info_plist_path.to_s.should.include?(
'Pods/Target Support Files/BananaLib/Info.plist', 'Pods/Target Support Files/BananaLib/Info.plist',
) )
@pod_target.scoped.info_plist_path.to_s.should.include?( @pod_target.scoped.first.info_plist_path.to_s.should.include?(
'Pods/Target Support Files/Pods-BananaLib/Info.plist', 'Pods/Target Support Files/Pods-BananaLib/Info.plist',
) )
end end
...@@ -146,7 +146,7 @@ module Pod ...@@ -146,7 +146,7 @@ module Pod
@pod_target.dummy_source_path.to_s.should.include?( @pod_target.dummy_source_path.to_s.should.include?(
'Pods/Target Support Files/BananaLib/BananaLib-dummy.m', 'Pods/Target Support Files/BananaLib/BananaLib-dummy.m',
) )
@pod_target.scoped.dummy_source_path.to_s.should.include?( @pod_target.scoped.first.dummy_source_path.to_s.should.include?(
'Pods/Target Support Files/Pods-BananaLib/Pods-BananaLib-dummy.m', 'Pods/Target Support Files/Pods-BananaLib/Pods-BananaLib-dummy.m',
) )
end end
...@@ -162,7 +162,7 @@ module Pod ...@@ -162,7 +162,7 @@ module Pod
it 'returns the path for the CONFIGURATION_BUILD_DIR build setting' do it 'returns the path for the CONFIGURATION_BUILD_DIR build setting' do
@pod_target.configuration_build_dir.should == '$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)' @pod_target.configuration_build_dir.should == '$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)'
@pod_target.scoped.configuration_build_dir.should == '$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods' @pod_target.scoped.first.configuration_build_dir.should == '$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods'
end end
end end
...@@ -191,7 +191,7 @@ module Pod ...@@ -191,7 +191,7 @@ module Pod
it 'returns the library name' do it 'returns the library name' do
@pod_target.static_library_name.should == 'libBananaLib.a' @pod_target.static_library_name.should == 'libBananaLib.a'
@pod_target.scoped.static_library_name.should == 'libPods-BananaLib.a' @pod_target.scoped.first.static_library_name.should == 'libPods-BananaLib.a'
end end
it 'returns :framework as product type' do it 'returns :framework as product type' do
...@@ -206,7 +206,7 @@ module Pod ...@@ -206,7 +206,7 @@ module Pod
describe 'Host does not requires frameworks' do describe 'Host does not requires frameworks' do
it 'returns the product name' do it 'returns the product name' do
@pod_target.product_name.should == 'libBananaLib.a' @pod_target.product_name.should == 'libBananaLib.a'
@pod_target.scoped.product_name.should == 'libPods-BananaLib.a' @pod_target.scoped.first.product_name.should == 'libPods-BananaLib.a'
end end
it 'returns the framework name' do it 'returns the framework name' do
...@@ -215,7 +215,7 @@ module Pod ...@@ -215,7 +215,7 @@ module Pod
it 'returns the library name' do it 'returns the library name' do
@pod_target.static_library_name.should == 'libBananaLib.a' @pod_target.static_library_name.should == 'libBananaLib.a'
@pod_target.scoped.static_library_name.should == 'libPods-BananaLib.a' @pod_target.scoped.first.static_library_name.should == 'libPods-BananaLib.a'
end end
it 'returns :static_library as product type' do it 'returns :static_library as product type' do
...@@ -252,7 +252,7 @@ module Pod ...@@ -252,7 +252,7 @@ module Pod
it 'returns the library name' do it 'returns the library name' do
@pod_target.static_library_name.should == 'libOrangeFramework.a' @pod_target.static_library_name.should == 'libOrangeFramework.a'
@pod_target.scoped.static_library_name.should == 'libPods-OrangeFramework.a' @pod_target.scoped.first.static_library_name.should == 'libPods-OrangeFramework.a'
end end
it 'returns :framework as product type' do it 'returns :framework as product type' 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