Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
6273593a
Commit
6273593a
authored
May 26, 2015
by
Vincent Isambart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Symlink vendored framework headers into the public headers dir
Fixes #3161
parent
4d53b470
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
2 deletions
+71
-2
file_references_installer.rb
lib/cocoapods/installer/file_references_installer.rb
+38
-0
file_accessor.rb
lib/cocoapods/sandbox/file_accessor.rb
+20
-2
file_references_installer_spec.rb
spec/unit/installer/file_references_installer_spec.rb
+13
-0
No files found.
lib/cocoapods/installer/file_references_installer.rb
View file @
6273593a
...
@@ -126,6 +126,10 @@ module Pod
...
@@ -126,6 +126,10 @@ module Pod
header_mappings
(
headers_sandbox
,
file_accessor
,
file_accessor
.
public_headers
).
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
)
sandbox
.
public_headers
.
add_files
(
namespaced_path
,
files
,
library
.
platform
)
end
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
end
end
end
...
@@ -208,6 +212,40 @@ module Pod
...
@@ -208,6 +212,40 @@ module Pod
mappings
mappings
end
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
end
end
...
...
lib/cocoapods/sandbox/file_accessor.rb
View file @
6273593a
...
@@ -152,13 +152,31 @@ module Pod
...
@@ -152,13 +152,31 @@ module Pod
paths_for_attribute
(
:vendored_frameworks
,
true
)
paths_for_attribute
(
:vendored_frameworks
,
true
)
end
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
# @return [Array<Pathname>] The paths of the framework headers that come
# shipped with the Pod.
# shipped with the Pod.
#
#
def
vendored_frameworks_headers
def
vendored_frameworks_headers
vendored_frameworks
.
map
do
|
framework
|
vendored_frameworks
.
map
do
|
framework
|
headers_dir
=
(
framework
+
'Headers'
).
realpath
self
.
class
.
vendored_frameworks_headers
(
framework
)
Pathname
.
glob
(
headers_dir
+
GLOB_PATTERNS
[
:public_header_files
])
end
.
flatten
.
uniq
end
.
flatten
.
uniq
end
end
...
...
spec/unit/installer/file_references_installer_spec.rb
View file @
6273593a
...
@@ -65,8 +65,10 @@ module Pod
...
@@ -65,8 +65,10 @@ module Pod
headers_root
=
config
.
sandbox
.
public_headers
.
root
headers_root
=
config
.
sandbox
.
public_headers
.
root
public_header
=
headers_root
+
'BananaLib/Banana.h'
public_header
=
headers_root
+
'BananaLib/Banana.h'
private_header
=
headers_root
+
'BananaLib/BananaPrivate.h'
private_header
=
headers_root
+
'BananaLib/BananaPrivate.h'
framework_header
=
headers_root
+
'BananaLib/Bananalib/Bananalib.h'
public_header
.
should
.
exist
public_header
.
should
.
exist
private_header
.
should
.
not
.
exist
private_header
.
should
.
not
.
exist
framework_header
.
should
.
exist
end
end
end
end
...
@@ -125,6 +127,17 @@ module Pod
...
@@ -125,6 +127,17 @@ module Pod
}
}
end
end
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
end
#-------------------------------------------------------------------------#
#-------------------------------------------------------------------------#
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment