Commit 339a9bdb authored by Samuel E. Giddins's avatar Samuel E. Giddins

[PrefixHeader] De-duplicate the contents on the prefix_header file when there…

[PrefixHeader] De-duplicate the contents on the prefix_header file when there are multiple subspecs with the same prefix_header

Closes https://github.com/CocoaPods/CocoaPods/issues/3283.
parent 8d801e09
......@@ -47,11 +47,10 @@ module Pod
result << "\n"
end
file_accessors.each do |file_accessor|
if prefix_header = file_accessor.prefix_header
result << Pathname(prefix_header).read
end
file_accessors.map(&:prefix_header).compact.uniq.each do |prefix_header|
result << Pathname(prefix_header).read
end
result
end
......
......@@ -67,6 +67,25 @@ module Pod
EOS
end
# @note Declaring a subspec was found in issue #3283 to generate duplicates of the prefix_header
it "does not duplicate the contents of the specification's prefix header file when a subspec is declared multiple times" do
@spec.subspec 'UI' do |su|
su.source_files = 'Source/UI/*.{h,m}'
end
@gen.file_accessors << @gen.file_accessors.first.dup.tap do |fa|
fa.stubs(:spec_consumer).returns Specification::Consumer.new(@spec.subspec_by_name('BananaLib/UI'), Platform.ios)
end
@gen.generate.should == <<-EOS.strip_heredoc
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif
#import <BananaTree/BananaTree.h>
EOS
end
it 'includes the imports' do
@gen.imports << 'header.h'
@gen.generate.should == <<-EOS.strip_heredoc
......
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