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
ec7c6a0e
Commit
ec7c6a0e
authored
Feb 21, 2018
by
Samuel Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use FRAMEWORK_SEARCH_PATHS to discover headers of vendored frameworks
parent
d7c0b2b3
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
79 deletions
+33
-79
xcconfig_helper.rb
lib/cocoapods/generator/xcconfig/xcconfig_helper.rb
+5
-3
file_references_installer.rb
...xcode/pods_project_generator/file_references_installer.rb
+17
-52
cocoapods-integration-specs
spec/cocoapods-integration-specs
+1
-1
pod_xcconfig_spec.rb
spec/unit/generator/xcconfig/pod_xcconfig_spec.rb
+5
-5
hooks_manager_spec.rb
spec/unit/hooks_manager_spec.rb
+1
-1
file_references_installer_spec.rb
.../pods_project_generator/file_references_installer_spec.rb
+4
-17
No files found.
lib/cocoapods/generator/xcconfig/xcconfig_helper.rb
View file @
ec7c6a0e
...
@@ -90,9 +90,11 @@ module Pod
...
@@ -90,9 +90,11 @@ module Pod
end
end
end
end
XCConfigHelper
.
add_dynamic_dependency_build_settings
(
target
,
pod_target
,
xcconfig
,
include_ld_flags
,
test_xcconfig
)
XCConfigHelper
.
add_dynamic_dependency_build_settings
(
target
,
pod_target
,
xcconfig
,
include_ld_flags
,
test_xcconfig
)
if
pod_target
.
requires_frameworks?
pod_target
.
dependent_targets
.
each
do
|
dependent_target
|
pod_target
.
dependent_targets
.
each
do
|
dependent_target
|
XCConfigHelper
.
add_dynamic_dependency_build_settings
(
target
,
dependent_target
,
xcconfig
,
include_ld_flags
,
test_xcconfig
)
XCConfigHelper
.
add_dynamic_dependency_build_settings
(
target
,
dependent_target
,
xcconfig
,
include_ld_flags
,
test_xcconfig
)
dependent_target
.
file_accessors
.
each
do
|
file_accessor
|
XCConfigHelper
.
add_static_dependency_build_settings
(
target
,
dependent_target
,
xcconfig
,
file_accessor
,
false
)
end
end
end
end
end
end
...
...
lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb
View file @
ec7c6a0e
...
@@ -136,34 +136,27 @@ module Pod
...
@@ -136,34 +136,27 @@ module Pod
UI
.
message
'- Linking headers'
do
UI
.
message
'- Linking headers'
do
pod_targets
.
each
do
|
pod_target
|
pod_targets
.
each
do
|
pod_target
|
pod_target
.
file_accessors
.
each
do
|
file_accessor
|
pod_target
.
file_accessors
.
each
do
|
file_accessor
|
framework_exp
=
/\.framework\//
headers_sandbox
=
Pathname
.
new
(
file_accessor
.
spec
.
root
.
name
)
# When integrating Pod as frameworks, built Pods are built into
# When integrating Pod as frameworks, built Pods are built into
# frameworks, whose headers are included inside the built
# frameworks, whose headers are included inside the built
# framework. Those headers do not need to be linked from the
# framework. Those headers do not need to be linked from the
# sandbox.
# sandbox.
unless
pod_target
.
requires_frameworks?
&&
pod_target
.
should_build?
next
if
pod_target
.
requires_frameworks?
||
!
pod_target
.
should_build?
pod_target
.
build_headers
.
add_search_path
(
headers_sandbox
,
pod_target
.
platform
)
sandbox
.
public_headers
.
add_search_path
(
headers_sandbox
,
pod_target
.
platform
)
headers_sandbox
=
Pathname
.
new
(
file_accessor
.
spec
.
root
.
name
)
# Private headers will always end up in Pods/Headers/Private/PodA/*.h
pod_target
.
build_headers
.
add_search_path
(
headers_sandbox
,
pod_target
.
platform
)
# This will allow for `""` imports to work.
sandbox
.
public_headers
.
add_search_path
(
headers_sandbox
,
pod_target
.
platform
)
header_mappings
(
headers_sandbox
,
file_accessor
,
file_accessor
.
headers
).
each
do
|
namespaced_path
,
files
|
pod_target
.
build_headers
.
add_files
(
namespaced_path
,
files
.
reject
{
|
f
|
f
.
to_path
=~
framework_exp
})
# Private headers will always end up in Pods/Headers/Private/PodA/*.h
end
# This will allow for `""` imports to work.
header_mappings
(
headers_sandbox
,
file_accessor
,
file_accessor
.
headers
).
each
do
|
namespaced_path
,
files
|
# Public headers on the other hand will be added in Pods/Headers/Public/PodA/PodA/*.h
pod_target
.
build_headers
.
add_files
(
namespaced_path
,
files
)
# The extra folder is intentional in order for `<>` imports to work.
header_mappings
(
headers_sandbox
,
file_accessor
,
file_accessor
.
public_headers
,
:public
).
each
do
|
namespaced_path
,
files
|
sandbox
.
public_headers
.
add_files
(
namespaced_path
,
files
.
reject
{
|
f
|
f
.
to_path
=~
framework_exp
})
end
end
end
unless
pod_target
.
requires_frameworks?
# Public headers on the other hand will be added in Pods/Headers/Public/PodA/PodA/*.h
vendored_frameworks_header_mappings
(
headers_sandbox
,
file_accessor
).
each
do
|
namespaced_path
,
files
|
# The extra folder is intentional in order for `<>` imports to work.
sandbox
.
public_headers
.
add_files
(
namespaced_path
,
files
)
header_mappings
(
headers_sandbox
,
file_accessor
,
file_accessor
.
public_headers
,
:public
).
each
do
|
namespaced_path
,
files
|
end
sandbox
.
public_headers
.
add_files
(
namespaced_path
,
files
)
end
end
end
end
end
end
...
@@ -319,6 +312,8 @@ module Pod
...
@@ -319,6 +312,8 @@ module Pod
mappings
=
{}
mappings
=
{}
headers
.
each
do
|
header
|
headers
.
each
do
|
header
|
next
if
header
.
to_s
.
include?
(
'.framework/'
)
sub_dir
=
dir
sub_dir
=
dir
if
header_mappings_dir
if
header_mappings_dir
relative_path
=
header
.
relative_path_from
(
file_accessor
.
path_list
.
root
+
header_mappings_dir
)
relative_path
=
header
.
relative_path_from
(
file_accessor
.
path_list
.
root
+
header_mappings_dir
)
...
@@ -330,36 +325,6 @@ module Pod
...
@@ -330,36 +325,6 @@ 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.
#
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
...
...
cocoapods-integration-specs
@
5e83e892
Subproject commit
ce9fcea6cbeb3d1f2cdc000c204569182cce92b9
Subproject commit
5e83e892038cab89896eba2beb266d831a7318ea
spec/unit/generator/xcconfig/pod_xcconfig_spec.rb
View file @
ec7c6a0e
...
@@ -115,12 +115,12 @@ module Pod
...
@@ -115,12 +115,12 @@ module Pod
@xcconfig
.
to_hash
[
'FRAMEWORK_SEARCH_PATHS'
].
should
.
not
.
include
(
'${PODS_ROOT}/DDD'
)
@xcconfig
.
to_hash
[
'FRAMEWORK_SEARCH_PATHS'
].
should
.
not
.
include
(
'${PODS_ROOT}/DDD'
)
end
end
it
'vendored frameworks
dont get added to frameworks paths
if use_frameworks! isnt set'
do
it
'vendored frameworks
get added to frameworks paths even
if use_frameworks! isnt set'
do
@pod_target
.
stubs
(
:requires_frameworks?
).
returns
(
false
)
@pod_target
.
stubs
(
:requires_frameworks?
).
returns
(
false
)
@xcconfig
=
@generator
.
generate
@xcconfig
=
@generator
.
generate
@xcconfig
.
to_hash
[
'FRAMEWORK_SEARCH_PATHS'
].
should
.
not
.
include
(
'spec/fixtures/monkey'
)
@xcconfig
.
to_hash
[
'FRAMEWORK_SEARCH_PATHS'
].
should
.
include
(
'spec/fixtures/monkey'
)
@xcconfig
.
to_hash
[
'FRAMEWORK_SEARCH_PATHS'
].
should
.
not
.
include
(
'${PODS_ROOT}/AAA'
)
@xcconfig
.
to_hash
[
'FRAMEWORK_SEARCH_PATHS'
].
should
.
include
(
'${PODS_ROOT}/AAA'
)
@xcconfig
.
to_hash
[
'FRAMEWORK_SEARCH_PATHS'
].
should
.
not
.
include
(
'${PODS_ROOT}/CCC'
)
@xcconfig
.
to_hash
[
'FRAMEWORK_SEARCH_PATHS'
].
should
.
include
(
'${PODS_ROOT}/CCC'
)
end
end
it
'sets the PODS_ROOT build variable'
do
it
'sets the PODS_ROOT build variable'
do
...
@@ -256,7 +256,7 @@ module Pod
...
@@ -256,7 +256,7 @@ module Pod
generator
=
PodXCConfig
.
new
(
@coconut_pod_target
,
true
)
generator
=
PodXCConfig
.
new
(
@coconut_pod_target
,
true
)
xcconfig
=
generator
.
generate
xcconfig
=
generator
.
generate
xcconfig
.
to_hash
[
'FRAMEWORK_SEARCH_PATHS'
].
should
==
'$(inherited) "${PODS_ROOT}/../../spec/fixtures/banana-lib"'
xcconfig
.
to_hash
[
'FRAMEWORK_SEARCH_PATHS'
].
should
==
'$(inherited) "${PODS_ROOT}/../../spec/fixtures/banana-lib"'
xcconfig
.
to_hash
[
'LIBRARY_SEARCH_PATHS'
].
should
==
'$(inherited) "${PODS_
CONFIGURATION_BUILD_DIR}/BananaLib" "${PODS_CONFIGURATION_BUILD_DIR}/CoconutLib" "${PODS_ROOT}/../../spec/fixtures/banana-l
ib"'
xcconfig
.
to_hash
[
'LIBRARY_SEARCH_PATHS'
].
should
==
'$(inherited) "${PODS_
ROOT}/../../spec/fixtures/banana-lib" "${PODS_CONFIGURATION_BUILD_DIR}/BananaLib" "${PODS_CONFIGURATION_BUILD_DIR}/CoconutL
ib"'
end
end
it
'adds correct header search paths for dependent and test targets'
do
it
'adds correct header search paths for dependent and test targets'
do
...
...
spec/unit/hooks_manager_spec.rb
View file @
ec7c6a0e
...
@@ -115,7 +115,7 @@ module Pod
...
@@ -115,7 +115,7 @@ module Pod
config
.
verbose
=
true
config
.
verbose
=
true
@hooks_manager
.
register
(
'plugin'
,
:post_install
)
{}
@hooks_manager
.
register
(
'plugin'
,
:post_install
)
{}
@hooks_manager
.
run
(
:post_install
,
Object
.
new
)
@hooks_manager
.
run
(
:post_install
,
Object
.
new
)
UI
.
output
.
should
.
match
%r{- plugin from `spec/unit/hooks_manager_spec.rb`}
UI
.
output
.
should
.
include
"- plugin from `
#{
__FILE__
}
`"
end
end
end
end
end
end
...
...
spec/unit/installer/xcode/pods_project_generator/file_references_installer_spec.rb
View file @
ec7c6a0e
...
@@ -90,11 +90,11 @@ module Pod
...
@@ -90,11 +90,11 @@ module Pod
framework_subdir_header
=
headers_root
+
'BananaLib/Bananalib/SubDir/SubBananalib.h'
framework_subdir_header
=
headers_root
+
'BananaLib/Bananalib/SubDir/SubBananalib.h'
public_headers
.
each
{
|
public_header
|
public_header
.
should
.
exist
}
public_headers
.
each
{
|
public_header
|
public_header
.
should
.
exist
}
private_header
.
should
.
not
.
exist
private_header
.
should
.
not
.
exist
framework_header
.
should
.
exist
framework_header
.
should
.
not
.
exist
framework_subdir_header
.
should
.
exist
framework_subdir_header
.
should
.
not
.
exist
end
end
it
'
links the public headers meant for the user, but only for Pods that are not built
'
do
it
'
does not link the public headers meant for the user for a vendored framework
'
do
Target
.
any_instance
.
stubs
(
:requires_frameworks?
).
returns
(
true
)
Target
.
any_instance
.
stubs
(
:requires_frameworks?
).
returns
(
true
)
pod_target_one
=
fixture_pod_target
(
'banana-lib/BananaLib.podspec'
)
pod_target_one
=
fixture_pod_target
(
'banana-lib/BananaLib.podspec'
)
pod_target_two
=
fixture_pod_target
(
'monkey/monkey.podspec'
)
pod_target_two
=
fixture_pod_target
(
'monkey/monkey.podspec'
)
...
@@ -107,7 +107,7 @@ module Pod
...
@@ -107,7 +107,7 @@ module Pod
banana_headers
=
[
headers_root
+
'BananaLib/Banana.h'
,
headers_root
+
'BananaLib/MoreBanana.h'
]
banana_headers
=
[
headers_root
+
'BananaLib/Banana.h'
,
headers_root
+
'BananaLib/MoreBanana.h'
]
banana_headers
.
each
{
|
banana_header
|
banana_header
.
should
.
not
.
exist
}
banana_headers
.
each
{
|
banana_header
|
banana_header
.
should
.
not
.
exist
}
monkey_header
=
headers_root
+
'monkey/monkey/monkey.h'
monkey_header
=
headers_root
+
'monkey/monkey/monkey.h'
monkey_header
.
should
.
exist
monkey_header
.
should
.
not
.
exist
end
end
it
"doesn't link public headers from vendored framework, when frameworks required"
do
it
"doesn't link public headers from vendored framework, when frameworks required"
do
...
@@ -301,19 +301,6 @@ module Pod
...
@@ -301,19 +301,6 @@ module Pod
result
.
should
.
be
.
nil
result
.
should
.
be
.
nil
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'
header_subdir
=
@file_accessor
.
root
+
'Bananalib.framework/Versions/A/Headers/SubDir/SubBananalib.h'
mappings
=
@installer
.
send
(
:vendored_frameworks_header_mappings
,
headers_sandbox
,
@file_accessor
)
mappings
.
should
==
{
(
headers_sandbox
+
'Bananalib'
)
=>
[
header
],
(
headers_sandbox
+
'Bananalib/SubDir'
)
=>
[
header_subdir
],
}
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