Commit 6273593a authored by Vincent Isambart's avatar Vincent Isambart

Symlink vendored framework headers into the public headers dir

Fixes #3161
parent 4d53b470
......@@ -126,6 +126,10 @@ module Pod
header_mappings(headers_sandbox, file_accessor, file_accessor.public_headers).each do |namespaced_path, files|
sandbox.public_headers.add_files(namespaced_path, files, library.platform)
end
vendored_frameworks_header_mappings(headers_sandbox, file_accessor).each do |namespaced_path, files|
sandbox.public_headers.add_files(namespaced_path, files, library.platform)
end
end
end
end
......@@ -208,6 +212,40 @@ module Pod
mappings
end
# Computes the destination sub-directory in the sandbox for headers
# from inside vendored frameworks.
#
# @param [Pathname] headers_sandbox
# The sandbox where the header links should be stored for this
# Pod.
#
# @param [Sandbox::FileAccessor] file_accessor
# The consumer file accessor for which the headers need to be
# linked.
#
# @return [Hash{Pathname => Array<Pathname>}] A hash containing the
# headers folders as the keys and the absolute paths of the
# header files as the values.
#
def vendored_frameworks_header_mappings(headers_sandbox, file_accessor)
mappings = {}
file_accessor.vendored_frameworks.each do |framework|
headers_dir = Sandbox::FileAccessor.vendored_frameworks_headers_dir(framework)
headers = Sandbox::FileAccessor.vendored_frameworks_headers(framework)
framework_name = framework.basename(framework.extname)
dir = headers_sandbox + framework_name
headers.each do |header|
# the relative path of framework headers should be kept,
# not flattened like is done for most public headers.
relative_path = header.relative_path_from(headers_dir)
sub_dir = dir + relative_path.dirname
mappings[sub_dir] ||= []
mappings[sub_dir] << header
end
end
mappings
end
#-----------------------------------------------------------------------#
end
end
......
......@@ -152,13 +152,31 @@ module Pod
paths_for_attribute(:vendored_frameworks, true)
end
# @param [Pathname] framework
# The vendored framework to search into.
# @return [Array<Pathname>] The paths of the header directory of the
# vendored framework.
#
def self.vendored_frameworks_headers_dir(framework)
headers_dir = (framework + 'Headers').realpath
end
# @param [Pathname] framework
# The vendored framework to search into.
# @return [Array<Pathname>] The paths of the headers included in the
# vendored framework.
#
def self.vendored_frameworks_headers(framework)
headers_dir = self.vendored_frameworks_headers_dir(framework)
Pathname.glob(headers_dir + GLOB_PATTERNS[:public_header_files])
end
# @return [Array<Pathname>] The paths of the framework headers that come
# shipped with the Pod.
#
def vendored_frameworks_headers
vendored_frameworks.map do |framework|
headers_dir = (framework + 'Headers').realpath
Pathname.glob(headers_dir + GLOB_PATTERNS[:public_header_files])
self.class.vendored_frameworks_headers(framework)
end.flatten.uniq
end
......
......@@ -65,8 +65,10 @@ module Pod
headers_root = config.sandbox.public_headers.root
public_header = headers_root + 'BananaLib/Banana.h'
private_header = headers_root + 'BananaLib/BananaPrivate.h'
framework_header = headers_root + 'BananaLib/Bananalib/Bananalib.h'
public_header.should.exist
private_header.should.not.exist
framework_header.should.exist
end
end
......@@ -125,6 +127,17 @@ module Pod
}
end
end
describe '#vendored_frameworks_header_mappings' do
it 'returns the vendored frameworks header mappings' do
headers_sandbox = Pathname.new('BananaLib')
header = @file_accessor.root + 'Bananalib.framework/Versions/A/Headers/Bananalib.h'
mappings = @installer.send(:vendored_frameworks_header_mappings, headers_sandbox, @file_accessor)
mappings.should == {
(headers_sandbox + 'Bananalib') => [header],
}
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