Commit f85fd191 authored by Marius Rackwitz's avatar Marius Rackwitz

[Analyzer] Reduce code duplication in #scope_suffix_for_distinctor

parent 7c68caba
...@@ -363,23 +363,19 @@ module Pod ...@@ -363,23 +363,19 @@ module Pod
result = targets_by_distinctors.map { |d, _| [d, platform_name_proc.call(d[1])] } result = targets_by_distinctors.map { |d, _| [d, platform_name_proc.call(d[1])] }
else else
common_specs = all_spec_variants.reduce(all_spec_variants.first, &:&) common_specs = all_spec_variants.reduce(all_spec_variants.first, &:&)
if all_spec_variants.uniq.count == all_spec_variants.count result = targets_by_distinctors.map do |distinctor, _|
result = targets_by_distinctors.map do |distinctor, _| specs, = *distinctor
specs, = *distinctor specs -= common_specs
specs -= common_specs subspec_names = specs.map { |spec| spec.name.split('/')[1..-1].join('_') }
subspec_names = specs.map { |spec| spec.name.split('/')[1..-1].join('_') } # => Subspecs names without common subspecs
# => Subspecs names without common subspecs [distinctor, subspec_names.empty? ? nil : subspec_names.join('-')]
[distinctor, subspec_names.empty? ? nil : subspec_names.join('-')] end
end if all_spec_variants.count > all_spec_variants.uniq.count
else result.map! do |distinctor, suffix|
result = targets_by_distinctors.map do |distinctor, _| _, platform = *distinctor
specs, platform = *distinctor
specs -= common_specs
subspec_names = specs.map { |spec| spec.name.split('/')[1..-1].join('_') }
platform_name = platform_name_proc.call(platform) platform_name = platform_name_proc.call(platform)
name_parts = [platform_name] + subspec_names
# => Platform name (+ SDK version) + subspecs names without common subspecs # => Platform name (+ SDK version) + subspecs names without common subspecs
[distinctor, name_parts.join('-')] [distinctor, [platform_name, suffix].compact.join('-')]
end end
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