Commit 5ee56930 authored by Marius Rackwitz's avatar Marius Rackwitz

[PodVariantSet] Make specs first priority

parent 186c43dd
...@@ -21,7 +21,7 @@ module Pod ...@@ -21,7 +21,7 @@ module Pod
# #
def scope_suffixes def scope_suffixes
return { variants.first => nil } if variants.count == 1 return { variants.first => nil } if variants.count == 1
scope_by_build_type scope_by_specs
end end
# Groups the collection by result of the block. # Groups the collection by result of the block.
...@@ -83,7 +83,7 @@ module Pod ...@@ -83,7 +83,7 @@ module Pod
# => Platform name + SDK version # => Platform name + SDK version
platform_name_proc = proc { |v| v.platform.to_s.tr(' ', '') } platform_name_proc = proc { |v| v.platform.to_s.tr(' ', '') }
end end
scope_if_necessary(grouped_variants.map(&:scope_by_specs), &platform_name_proc) scope_if_necessary(grouped_variants.map(&:scope_without_suffix), &platform_name_proc)
end end
# @private # @private
...@@ -93,7 +93,7 @@ module Pod ...@@ -93,7 +93,7 @@ module Pod
grouped_variants = group_by(&:specs) grouped_variants = group_by(&:specs)
all_spec_variants = grouped_variants.map { |set| set.variants.first.specs } all_spec_variants = grouped_variants.map { |set| set.variants.first.specs }
common_specs = all_spec_variants.reduce(all_spec_variants.first, &:&) common_specs = all_spec_variants.reduce(all_spec_variants.first, &:&)
scope_if_necessary(grouped_variants.map(&:scope_without_suffix)) do |variant| scope_if_necessary(grouped_variants.map(&:scope_by_build_type)) do |variant|
subspecs = variant.specs - common_specs subspecs = variant.specs - common_specs
subspec_names = subspecs.map do |spec| subspec_names = subspecs.map do |spec|
spec.root? ? 'root' : spec.name.split('/')[1..-1].join('_') spec.root? ? 'root' : spec.name.split('/')[1..-1].join('_')
......
...@@ -61,22 +61,22 @@ module Pod ...@@ -61,22 +61,22 @@ module Pod
it 'returns scopes by platform names and subspec names if they qualify' do it 'returns scopes by platform names and subspec names if they qualify' do
variants = PodVariantSet.new([ variants = PodVariantSet.new([
PodVariant.new([@root_spec], Platform.ios), PodVariant.new([@root_spec], Platform.ios),
PodVariant.new([@root_spec, @foo_subspec], Platform.ios),
PodVariant.new([@root_spec], Platform.osx), PodVariant.new([@root_spec], Platform.osx),
PodVariant.new([@root_spec, @foo_subspec], Platform.ios),
PodVariant.new([@root_spec, @bar_subspec], Platform.osx), PodVariant.new([@root_spec, @bar_subspec], Platform.osx),
]) ])
variants.scope_suffixes.values.should == [ variants.scope_suffixes.values.should == [
'iOS', 'iOS',
'iOS-Foo',
'OSX', 'OSX',
'OSX-Bar', 'Foo',
'Bar',
] ]
end end
it 'returns scopes by versioned platform names and subspec names if they qualify' do it 'returns scopes by versioned platform names and subspec names if they qualify' do
variants = PodVariantSet.new([ variants = PodVariantSet.new([
PodVariant.new([@root_spec], Platform.new(:ios, '7.0')), PodVariant.new([@root_spec], Platform.new(:ios, '7.0')),
PodVariant.new([@root_spec, @foo_subspec], Platform.ios), PodVariant.new([@root_spec], Platform.ios),
PodVariant.new([@root_spec], Platform.osx), PodVariant.new([@root_spec], Platform.osx),
PodVariant.new([@root_spec, @bar_subspec], Platform.osx), PodVariant.new([@root_spec, @bar_subspec], Platform.osx),
]) ])
...@@ -84,7 +84,7 @@ module Pod ...@@ -84,7 +84,7 @@ module Pod
'iOS7.0', 'iOS7.0',
'iOS', 'iOS',
'OSX', 'OSX',
'OSX-Bar', 'Bar',
] ]
end end
...@@ -93,13 +93,15 @@ module Pod ...@@ -93,13 +93,15 @@ module Pod
PodVariant.new([@root_spec], Platform.new(:ios, '7.0')), PodVariant.new([@root_spec], Platform.new(:ios, '7.0')),
PodVariant.new([@root_spec], Platform.ios), PodVariant.new([@root_spec], Platform.ios),
PodVariant.new([@root_spec], Platform.osx, true), PodVariant.new([@root_spec], Platform.osx, true),
PodVariant.new([@root_spec, @foo_subspec], Platform.ios),
PodVariant.new([@root_spec, @foo_subspec], Platform.osx, true), PodVariant.new([@root_spec, @foo_subspec], Platform.osx, true),
]) ])
variants.scope_suffixes.values.should == [ variants.scope_suffixes.values.should == [
'library-iOS7.0', 'library-iOS7.0',
'library-iOS', 'library-iOS',
'framework', 'framework',
'framework-Foo', 'Foo-library',
'Foo-framework',
] ]
end end
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