Commit 5d724d44 authored by Eloy Durán's avatar Eloy Durán

[Sandbox::FileAccessor] Don't symlink framework headers, just list them.

parent 30ebfc4c
......@@ -22,8 +22,8 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
##### Enhancements
* The `pod push` has been removed as it has been deprecated in favour of `pod
repo push` in CocoaPods 0.33.
* The `pod push` command has been removed as it has been deprecated in favour of
`pod repo push` in CocoaPods 0.33.
[Fabio Pelosin](https://github.com/fabiopelosin)
* Refactorings in preparation to framework support, which could break usages
......@@ -55,6 +55,11 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[Daniel Tomlinson](https://github.com/DanielTomlinson)
[#2562](https://github.com/CocoaPods/CocoaPods/issues/2562)
* `Sandbox::FileAccessor` now optionally includes expanded paths of headers of
vendored frameworks in `public_headers`.
[Eloy Durán](https://github.com/alloy)
[#2722](https://github.com/CocoaPods/CocoaPods/pull/2722)
##### Bug Fixes
* Do not try to clone spec-repos in `/`.
......
......@@ -117,15 +117,11 @@ module Pod
library.build_headers.add_search_path(headers_sandbox, library.platform)
sandbox.public_headers.add_search_path(headers_sandbox, library.platform)
header_mappings(headers_sandbox, file_accessor, file_accessor.headers, false).each do |namespaced_path, files|
header_mappings(headers_sandbox, file_accessor, file_accessor.headers).each do |namespaced_path, files|
library.build_headers.add_files(namespaced_path, files, library.platform)
end
header_mappings(headers_sandbox, file_accessor, file_accessor.public_headers, false).each do |namespaced_path, files|
sandbox.public_headers.add_files(namespaced_path, files, library.platform)
end
header_mappings(headers_sandbox, file_accessor, file_accessor.vendored_frameworks_headers, true).each do |namespaced_path, files|
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
end
......@@ -181,15 +177,11 @@ module Pod
# @param [Array<Pathname>] headers
# The absolute paths of the headers which need to be mapped.
#
# @param [Boolean] framework_headers
# Whether or not these headers should get an extra framework name
# namespace. E.g. `Bananas/Bananas.h` instead of `Bananas.h`.
#
# @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 header_mappings(headers_sandbox, file_accessor, headers, framework_headers)
def header_mappings(headers_sandbox, file_accessor, headers)
consumer = file_accessor.spec_consumer
dir = headers_sandbox
dir += consumer.header_dir if consumer.header_dir
......@@ -197,12 +189,7 @@ module Pod
mappings = {}
headers.each do |header|
sub_dir = dir
if framework_headers
framework_filename = header.each_filename.find do |filename|
File.extname(filename) == '.framework'
end
sub_dir += File.basename(framework_filename, '.framework')
elsif consumer.header_mappings_dir
if consumer.header_mappings_dir
header_mappings_dir = file_accessor.path_list.root + consumer.header_mappings_dir
relative_path = header.relative_path_from(header_mappings_dir)
sub_dir += relative_path.dirname
......
......@@ -85,9 +85,13 @@ module Pod
source_files.select { |f| extensions.include?(f.extname) }
end
# @param [Boolean] include_frameworks
# Whether or not to include the headers of the vendored frameworks.
# Defaults to not include them.
#
# @return [Array<Pathname>] the public headers of the specification.
#
def public_headers
def public_headers(include_frameworks = false)
public_headers = paths_for_attribute(:public_header_files)
private_headers = paths_for_attribute(:private_header_files)
if public_headers.nil? || public_headers.empty?
......@@ -95,6 +99,7 @@ module Pod
else
header_files = public_headers
end
header_files += vendored_frameworks_headers if include_frameworks
header_files - private_headers
end
......
......@@ -67,10 +67,8 @@ 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
......@@ -102,7 +100,7 @@ module Pod
it 'returns the header mappings' do
headers_sandbox = Pathname.new('BananaLib')
headers = [Pathname.new('BananaLib/Banana.h')]
mappings = @installer.send(:header_mappings, headers_sandbox, @file_accessor, headers, false)
mappings = @installer.send(:header_mappings, headers_sandbox, @file_accessor, headers)
mappings.should == {
headers_sandbox => headers,
}
......@@ -112,7 +110,7 @@ module Pod
headers_sandbox = Pathname.new('BananaLib')
headers = [Pathname.new('BananaLib/Banana.h')]
@file_accessor.spec_consumer.stubs(:header_dir).returns('Sub_dir')
mappings = @installer.send(:header_mappings, headers_sandbox, @file_accessor, headers, false)
mappings = @installer.send(:header_mappings, headers_sandbox, @file_accessor, headers)
mappings.should == {
(headers_sandbox + 'Sub_dir') => headers,
}
......@@ -124,21 +122,12 @@ module Pod
header_2 = @file_accessor.root + 'BananaLib/sub_dir/dir_2/banana_2.h'
headers = [header_1, header_2]
@file_accessor.spec_consumer.stubs(:header_mappings_dir).returns('BananaLib/sub_dir')
mappings = @installer.send(:header_mappings, headers_sandbox, @file_accessor, headers, false)
mappings = @installer.send(:header_mappings, headers_sandbox, @file_accessor, headers)
mappings.should == {
(headers_sandbox + 'dir_1') => [header_1],
(headers_sandbox + 'dir_2') => [header_2],
}
end
it 'takes into account the framework name required in the namespace' do
headers_sandbox = Pathname.new('BananaLib')
headers = [Pathname.new('BananaLib/Bananalib.framework/Versions/A/Headers/Bananalib.h')]
mappings = @installer.send(:header_mappings, headers_sandbox, @file_accessor, headers, true)
mappings.should == {
(headers_sandbox + 'Bananalib') => headers,
}
end
end
end
......
......@@ -82,6 +82,13 @@ module Pod
]
end
it 'includes the vendored framework headers if requested' do
@accessor.public_headers(true).sort.should == [
@root + 'Bananalib.framework/Versions/A/Headers/Bananalib.h',
@root + 'Classes/Banana.h',
]
end
it 'returns the resources' do
@accessor.resources.sort.should == [
@root + 'Resources/logo-sidebar.png',
......
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