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
30ebfc4c
Commit
30ebfc4c
authored
Oct 23, 2014
by
Eloy Durán
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Sandbox] Symlink vendored framework headers into the public headers dir.
Fixes #1992.
parent
7bfc1a79
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
69 additions
and
14 deletions
+69
-14
file_references_installer.rb
lib/cocoapods/installer/file_references_installer.rb
+17
-4
file_accessor.rb
lib/cocoapods/sandbox/file_accessor.rb
+10
-0
banana-lib.tar.gz
spec/fixtures/banana-lib.tar.gz
+0
-0
file_references_installer_spec.rb
spec/unit/installer/file_references_installer_spec.rb
+22
-9
file_accessor_spec.rb
spec/unit/sandbox/file_accessor_spec.rb
+6
-0
path_list_spec.rb
spec/unit/sandbox/path_list_spec.rb
+14
-1
No files found.
lib/cocoapods/installer/file_references_installer.rb
View file @
30ebfc4c
...
...
@@ -117,11 +117,15 @@ 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
).
each
do
|
namespaced_path
,
files
|
header_mappings
(
headers_sandbox
,
file_accessor
,
file_accessor
.
headers
,
false
).
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
).
each
do
|
namespaced_path
,
files
|
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
|
sandbox
.
public_headers
.
add_files
(
namespaced_path
,
files
,
library
.
platform
)
end
end
...
...
@@ -177,11 +181,15 @@ 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
)
def
header_mappings
(
headers_sandbox
,
file_accessor
,
headers
,
framework_headers
)
consumer
=
file_accessor
.
spec_consumer
dir
=
headers_sandbox
dir
+=
consumer
.
header_dir
if
consumer
.
header_dir
...
...
@@ -189,7 +197,12 @@ module Pod
mappings
=
{}
headers
.
each
do
|
header
|
sub_dir
=
dir
if
consumer
.
header_mappings_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
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
...
...
lib/cocoapods/sandbox/file_accessor.rb
View file @
30ebfc4c
...
...
@@ -118,6 +118,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.
#
...
...
spec/fixtures/banana-lib.tar.gz
View file @
30ebfc4c
No preview for this file type
spec/unit/installer/file_references_installer_spec.rb
View file @
30ebfc4c
...
...
@@ -51,22 +51,26 @@ 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'
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'
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
...
...
@@ -98,9 +102,9 @@ 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
)
mappings
=
@installer
.
send
(
:header_mappings
,
headers_sandbox
,
@file_accessor
,
headers
,
false
)
mappings
.
should
==
{
headers_sandbox
=>
[
Pathname
.
new
(
'BananaLib/Banana.h'
)]
,
headers_sandbox
=>
headers
,
}
end
...
...
@@ -108,9 +112,9 @@ 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
)
mappings
=
@installer
.
send
(
:header_mappings
,
headers_sandbox
,
@file_accessor
,
headers
,
false
)
mappings
.
should
==
{
(
headers_sandbox
+
'Sub_dir'
)
=>
[
Pathname
.
new
(
'BananaLib/Banana.h'
)]
,
(
headers_sandbox
+
'Sub_dir'
)
=>
headers
,
}
end
...
...
@@ -120,12 +124,21 @@ 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
)
mappings
=
@installer
.
send
(
:header_mappings
,
headers_sandbox
,
@file_accessor
,
headers
,
false
)
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
...
...
spec/unit/sandbox/file_accessor_spec.rb
View file @
30ebfc4c
...
...
@@ -108,6 +108,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
...
...
spec/unit/sandbox/path_list_spec.rb
View file @
30ebfc4c
...
...
@@ -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
...
...
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