Commit 3395336a authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #3468 from CocoaPods/ignore-headers-for-should_build

No pod target if `source_files` only has headers.
parents 7e2faef5 256bf52e
...@@ -33,6 +33,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -33,6 +33,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Samuel Giddins](https://github.com/segiddins) [Samuel Giddins](https://github.com/segiddins)
[#3101](https://github.com/CocoaPods/CocoaPods/issues/3101) [#3101](https://github.com/CocoaPods/CocoaPods/issues/3101)
* Do not create pod target if `source_files` only contains headers.
[Boris Bügling](https://github.com/neonichu)
[#3106](https://github.com/CocoaPods/CocoaPods/issues/3106)
## 0.37.0.beta.1 ## 0.37.0.beta.1
......
...@@ -52,7 +52,9 @@ module Pod ...@@ -52,7 +52,9 @@ module Pod
# A target should not be build if it has no source files. # A target should not be build if it has no source files.
# #
def should_build? def should_build?
!file_accessors.flat_map(&:source_files).empty? source_files = file_accessors.flat_map(&:source_files)
source_files -= file_accessors.flat_map(&:headers)
!source_files.empty?
end end
# @return [Array<Specification::Consumer>] the specification consumers for # @return [Array<Specification::Consumer>] the specification consumers for
......
...@@ -63,6 +63,22 @@ module Pod ...@@ -63,6 +63,22 @@ module Pod
end.message end.message
message.should.match /subspecs across different build configurations/ message.should.match /subspecs across different build configurations/
end end
it 'builds a pod target if there are actual source files' do
fa = Sandbox::FileAccessor.new(nil, @pod_target)
fa.stubs(:source_files).returns([Pathname.new('foo.m')])
@pod_target.stubs(:file_accessors).returns([fa])
@pod_target.should_build?.should == true
end
it 'does not build a pod target if there are only header files' do
fa = Sandbox::FileAccessor.new(nil, @pod_target)
fa.stubs(:source_files).returns([Pathname.new('foo.h')])
@pod_target.stubs(:file_accessors).returns([fa])
@pod_target.should_build?.should == false
end
end end
describe 'Support files' do describe 'Support files' 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