Commit 1c9e0c85 authored by Eloy Durán's avatar Eloy Durán

Merge pull request #2722 from CocoaPods/issue/1992

[Sandbox] Symlink vendored framework headers into the public headers dir.
parents 7bfc1a79 5d724d44
......@@ -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 `/`.
......
......@@ -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
......@@ -118,6 +123,16 @@ module Pod
paths_for_attribute(:vendored_frameworks, true)
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])
end.flatten.uniq
end
# @return [Array<Pathname>] The paths of the library bundles that come
# shipped with the Pod.
#
......
......@@ -51,16 +51,18 @@ module Pod
file_ref.path.should == 'Resources/logo-sidebar.png'
end
it 'links the build headers' do
it 'links the headers required for building the pod target' do
@installer.install!
headers_root = @pod_target.build_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.exist
framework_header.should.not.exist
end
it 'links the public headers' do
it 'links the public headers meant for the user' do
@installer.install!
headers_root = config.sandbox.public_headers.root
public_header = headers_root + 'BananaLib/Banana.h'
......@@ -100,7 +102,7 @@ module Pod
headers = [Pathname.new('BananaLib/Banana.h')]
mappings = @installer.send(:header_mappings, headers_sandbox, @file_accessor, headers)
mappings.should == {
headers_sandbox => [Pathname.new('BananaLib/Banana.h')],
headers_sandbox => headers,
}
end
......@@ -110,7 +112,7 @@ module Pod
@file_accessor.spec_consumer.stubs(:header_dir).returns('Sub_dir')
mappings = @installer.send(:header_mappings, headers_sandbox, @file_accessor, headers)
mappings.should == {
(headers_sandbox + 'Sub_dir') => [Pathname.new('BananaLib/Banana.h')],
(headers_sandbox + 'Sub_dir') => headers,
}
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',
......@@ -108,6 +115,12 @@ module Pod
@accessor.vendored_frameworks.should.include?(@root + 'Bananalib.framework')
end
it 'returns the paths of the framework headers' do
@accessor.vendored_frameworks_headers.should == [
@root + 'Bananalib.framework/Versions/A/Headers/Bananalib.h',
]
end
it 'returns the paths of the library files' do
@accessor.vendored_libraries.should.include?(@root + 'libBananalib.a')
end
......
......@@ -16,6 +16,7 @@ module Pod
end
expected = %w(
BananaLib.podspec
Bananalib.framework/Versions/A/Headers/Bananalib.h
Classes/Banana.h
Classes/Banana.m
Classes/BananaLib.pch
......@@ -37,7 +38,19 @@ module Pod
dirs.reject! do |f|
f.include?('libPusher') || f.include?('.git')
end
dirs.sort.should == %w( Bananalib.framework Classes Resources Resources/sub_dir sub-dir sub-dir/sub-dir-2 )
dirs.sort.should == %w(
Bananalib.framework
Bananalib.framework/Headers
Bananalib.framework/Versions
Bananalib.framework/Versions/A
Bananalib.framework/Versions/A/Headers
Bananalib.framework/Versions/Current
Classes
Resources
Resources/sub_dir
sub-dir
sub-dir/sub-dir-2
)
end
it 'handles directories with glob metacharacters' 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