Commit e2d37545 authored by Samuel Giddins's avatar Samuel Giddins

[PodTarget] Add compatible header search paths for pods with header mappings dirs

parent fb622fcb
...@@ -312,6 +312,7 @@ module Pod ...@@ -312,6 +312,7 @@ module Pod
# #
def header_mappings(headers_sandbox, file_accessor, headers, visibility_scope = :private) def header_mappings(headers_sandbox, file_accessor, headers, visibility_scope = :private)
consumer = file_accessor.spec_consumer consumer = file_accessor.spec_consumer
header_mappings_dir = consumer.header_mappings_dir
dir = headers_sandbox dir = headers_sandbox
dir += headers_sandbox if visibility_scope == :public dir += headers_sandbox if visibility_scope == :public
dir += consumer.header_dir if consumer.header_dir dir += consumer.header_dir if consumer.header_dir
...@@ -319,9 +320,8 @@ module Pod ...@@ -319,9 +320,8 @@ module Pod
mappings = {} mappings = {}
headers.each do |header| headers.each do |header|
sub_dir = dir sub_dir = dir
if consumer.header_mappings_dir if header_mappings_dir
header_mappings_dir = file_accessor.path_list.root + consumer.header_mappings_dir relative_path = header.relative_path_from(file_accessor.path_list.root + header_mappings_dir)
relative_path = header.relative_path_from(header_mappings_dir)
sub_dir += relative_path.dirname sub_dir += relative_path.dirname
end end
mappings[sub_dir] ||= [] mappings[sub_dir] ||= []
......
...@@ -585,16 +585,33 @@ module Pod ...@@ -585,16 +585,33 @@ module Pod
# #
def header_search_paths(include_test_dependent_targets = false) def header_search_paths(include_test_dependent_targets = false)
header_search_paths = [] header_search_paths = []
header_search_paths.concat(build_headers.search_paths(platform, nil, defines_module?)) header_search_paths.concat(build_headers.search_paths(platform, nil, uses_modular_headers?))
header_search_paths.concat(sandbox.public_headers.search_paths(platform, pod_name, defines_module?)) header_search_paths.concat(sandbox.public_headers.search_paths(platform, pod_name, uses_modular_headers?))
dependent_targets = recursive_dependent_targets dependent_targets = recursive_dependent_targets
dependent_targets += recursive_test_dependent_targets if include_test_dependent_targets dependent_targets += recursive_test_dependent_targets if include_test_dependent_targets
dependent_targets.each do |dependent_target| dependent_targets.each do |dependent_target|
header_search_paths.concat(sandbox.public_headers.search_paths(platform, dependent_target.pod_name, defines_module?)) header_search_paths.concat(sandbox.public_headers.search_paths(platform, dependent_target.pod_name, defines_module? && dependent_target.uses_modular_headers?(false)))
end end
header_search_paths.uniq header_search_paths.uniq
end end
protected
# Returns whether the pod target should use modular headers.
#
# @param [Boolean] only_if_defines_modules
# whether the use of modular headers should require the target to define a module
#
# @note This must return false when a pod has a `header_mappings_dir`,
# as that allows the spec to completely customize the header structure, and
# therefore it might not be expecting the module name to be prepended
# to imports at all.
#
def uses_modular_headers?(only_if_defines_modules = true)
return false if only_if_defines_modules && !defines_module?
spec_consumers.none?(&:header_mappings_dir)
end
private private
# @param [TargetDefinition] target_definition # @param [TargetDefinition] target_definition
......
...@@ -11,6 +11,7 @@ module Pod ...@@ -11,6 +11,7 @@ module Pod
vspec = stub(:test_specification? => false) vspec = stub(:test_specification? => false)
consumer = stub( consumer = stub(
"Spec Consumer (#{vspec} iOS)",
:pod_target_xcconfig => {}, :pod_target_xcconfig => {},
:libraries => ['xml2'], :libraries => ['xml2'],
:frameworks => [], :frameworks => [],
...@@ -18,6 +19,7 @@ module Pod ...@@ -18,6 +19,7 @@ module Pod
:platform_name => :ios, :platform_name => :ios,
) )
file_accessor = stub( file_accessor = stub(
'File Accessor',
:spec => vspec, :spec => vspec,
:spec_consumer => consumer, :spec_consumer => consumer,
:vendored_static_frameworks => [config.sandbox.root + 'AAA/StaticFramework.framework'], :vendored_static_frameworks => [config.sandbox.root + 'AAA/StaticFramework.framework'],
...@@ -26,6 +28,7 @@ module Pod ...@@ -26,6 +28,7 @@ module Pod
:vendored_dynamic_libraries => [config.sandbox.root + 'DDD/VendoredDyld.dyld'], :vendored_dynamic_libraries => [config.sandbox.root + 'DDD/VendoredDyld.dyld'],
) )
vendored_dep_target = stub( vendored_dep_target = stub(
'Vendored Dependent Target',
:name => 'BananaLib', :name => 'BananaLib',
:pod_name => 'BananaLib', :pod_name => 'BananaLib',
:sandbox => config.sandbox, :sandbox => config.sandbox,
...@@ -34,6 +37,7 @@ module Pod ...@@ -34,6 +37,7 @@ module Pod
:static_framework? => false, :static_framework? => false,
:dependent_targets => [], :dependent_targets => [],
:file_accessors => [file_accessor], :file_accessors => [file_accessor],
:uses_modular_headers? => false,
) )
@spec = fixture_spec('banana-lib/BananaLib.podspec') @spec = fixture_spec('banana-lib/BananaLib.podspec')
......
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