Commit abc15da3 authored by Samuel Giddins's avatar Samuel Giddins

Stop adding header search paths that do not contain any headers

parent 636d1104
......@@ -86,6 +86,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#7445](https://github.com/CocoaPods/CocoaPods/pull/7445)
* Stop adding header search paths that do not contain any headers.
[Samuel Giddins](https://github.com/segiddins)
## 1.4.0 (2018-01-18)
##### Enhancements
......
......@@ -135,27 +135,28 @@ module Pod
def link_headers
UI.message '- Linking headers' do
pod_targets.each do |pod_target|
pod_target.file_accessors.each do |file_accessor|
# When integrating Pod as frameworks, built Pods are built into
# frameworks, whose headers are included inside the built
# framework. Those headers do not need to be linked from the
# sandbox.
next if pod_target.requires_frameworks? || !pod_target.should_build?
headers_sandbox = Pathname.new(file_accessor.spec.root.name)
# When integrating Pod as frameworks, built Pods are built into
# frameworks, whose headers are included inside the built
# framework. Those headers do not need to be linked from the
# sandbox.
next if pod_target.requires_frameworks? && pod_target.should_build?
pod_target.build_headers.add_search_path(headers_sandbox, pod_target.platform)
sandbox.public_headers.add_search_path(headers_sandbox, pod_target.platform)
headers_sandbox = Pathname.new(pod_target.pod_name)
added_build_headers = false
added_public_headers = false
pod_target.file_accessors.each do |file_accessor|
# Private headers will always end up in Pods/Headers/Private/PodA/*.h
# This will allow for `""` imports to work.
header_mappings(headers_sandbox, file_accessor, file_accessor.headers).each do |namespaced_path, files|
added_build_headers = true
pod_target.build_headers.add_files(namespaced_path, files)
end
# Public headers on the other hand will be added in Pods/Headers/Public/PodA/PodA/*.h
# The extra folder is intentional in order for `<>` imports to work.
header_mappings(headers_sandbox, file_accessor, file_accessor.public_headers, :public).each do |namespaced_path, files|
added_public_headers = true
sandbox.public_headers.add_files(namespaced_path, files)
end
......@@ -165,6 +166,9 @@ module Pod
end
end
end
pod_target.build_headers.add_search_path(headers_sandbox, pod_target.platform) if added_build_headers
sandbox.public_headers.add_search_path(headers_sandbox, pod_target.platform) if added_public_headers
end
end
end
......
Subproject commit 21bf4969be6345e4761a3cca3e91e8a3b953a302
Subproject commit f7fe19aff17a09075bdba1afcde1d4ffb5fff8ab
......@@ -99,7 +99,7 @@ module Pod
)
end
it 'does not link the public headers meant for the user for a vendored framework' do
it 'links the public headers meant for the user for a vendored framework' do
Target.any_instance.stubs(:requires_frameworks?).returns(true)
pod_target_one = fixture_pod_target('banana-lib/BananaLib.podspec')
pod_target_two = fixture_pod_target('monkey/monkey.podspec')
......@@ -112,7 +112,12 @@ module Pod
banana_headers = [headers_root + 'BananaLib/Banana.h', headers_root + 'BananaLib/MoreBanana.h']
banana_headers.each { |banana_header| banana_header.should.not.exist }
monkey_header = headers_root + 'monkey/monkey/monkey.h'
monkey_header.should.not.exist
monkey_header.should.exist # since it lives outside of the vendored framework
config.sandbox.public_headers.search_paths(pod_target_one.platform).should == %w(
${PODS_ROOT}/Headers/Public/monkey
${PODS_ROOT}/Headers/Public/monkey/monkey
)
end
it "doesn't link public headers from vendored framework, when frameworks required" 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