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
4f422dfe
Commit
4f422dfe
authored
May 19, 2017
by
Dimitris Koutsogiorgas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix to include proper runtime search paths for test native targets
parent
80334c51
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
30 deletions
+64
-30
CHANGELOG.md
CHANGELOG.md
+4
-0
aggregate_xcconfig.rb
lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb
+3
-30
pod_xcconfig.rb
lib/cocoapods/generator/xcconfig/pod_xcconfig.rb
+1
-0
xcconfig_helper.rb
lib/cocoapods/generator/xcconfig/xcconfig_helper.rb
+43
-0
pod_xcconfig_spec.rb
spec/unit/generator/xcconfig/pod_xcconfig_spec.rb
+13
-0
No files found.
CHANGELOG.md
View file @
4f422dfe
...
...
@@ -8,6 +8,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Enhancements
*
Fix to include proper runtime search paths for test native targets
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#6727
](
https://github.com/CocoaPods/CocoaPods/pull/6727
)
*
Add support for test target creation in the pods project generator
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#6703
](
https://github.com/CocoaPods/CocoaPods/pull/6703
)
...
...
lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb
View file @
4f422dfe
...
...
@@ -85,7 +85,9 @@ module Pod
# update the runpath search paths.
vendored_dynamic_artifacts
=
pod_targets
.
flat_map
(
&
:file_accessors
).
flat_map
(
&
:vendored_dynamic_artifacts
)
generate_ld_runpath_search_paths
if
target
.
requires_frameworks?
||
vendored_dynamic_artifacts
.
count
>
0
symbol_type
=
target
.
user_targets
.
map
(
&
:symbol_type
).
uniq
.
first
test_bundle
=
symbol_type
==
:octest_bundle
||
symbol_type
==
:unit_test_bundle
||
symbol_type
==
:ui_test_bundle
XCConfigHelper
.
generate_ld_runpath_search_paths
(
target
,
target
.
requires_host_target?
,
test_bundle
,
@xcconfig
)
if
target
.
requires_frameworks?
||
vendored_dynamic_artifacts
.
count
>
0
@xcconfig
end
...
...
@@ -177,35 +179,6 @@ module Pod
end
end
# Ensure to add the default linker run path search paths as they could
# be not present due to being historically absent in the project or
# target template or just being removed by being superficial when
# linking third-party dependencies exclusively statically. This is not
# something a project needs specifically for the integration with
# CocoaPods, but makes sure that it is self-contained for the given
# constraints.
#
def
generate_ld_runpath_search_paths
ld_runpath_search_paths
=
[
'$(inherited)'
]
if
target
.
platform
.
symbolic_name
==
:osx
ld_runpath_search_paths
<<
"'@executable_path/../Frameworks'"
symbol_type
=
target
.
user_targets
.
map
(
&
:symbol_type
).
uniq
.
first
ld_runpath_search_paths
<<
\
if
symbol_type
==
:unit_test_bundle
"'@loader_path/../Frameworks'"
else
"'@loader_path/Frameworks'"
end
else
ld_runpath_search_paths
<<
[
"'@executable_path/Frameworks'"
,
"'@loader_path/Frameworks'"
,
]
ld_runpath_search_paths
<<
"'@executable_path/../../Frameworks'"
if
target
.
requires_host_target?
end
@xcconfig
.
merge!
(
'LD_RUNPATH_SEARCH_PATHS'
=>
ld_runpath_search_paths
.
join
(
' '
))
end
private
#---------------------------------------------------------------------#
...
...
lib/cocoapods/generator/xcconfig/pod_xcconfig.rb
View file @
4f422dfe
...
...
@@ -74,6 +74,7 @@ module Pod
@xcconfig
.
merge!
XCConfigHelper
.
settings_for_dependent_targets
(
target
,
target
.
test_dependent_targets
)
XCConfigHelper
.
generate_vendored_build_settings
(
nil
,
target
.
test_dependent_targets
,
@xcconfig
)
XCConfigHelper
.
generate_other_ld_flags
(
nil
,
target
.
test_dependent_targets
,
@xcconfig
)
XCConfigHelper
.
generate_ld_runpath_search_paths
(
target
,
false
,
true
,
@xcconfig
)
end
@xcconfig
end
...
...
lib/cocoapods/generator/xcconfig/xcconfig_helper.rb
View file @
4f422dfe
...
...
@@ -324,6 +324,49 @@ module Pod
end
end
# Ensure to add the default linker run path search paths as they could
# be not present due to being historically absent in the project or
# target template or just being removed by being superficial when
# linking third-party dependencies exclusively statically. This is not
# something a project needs specifically for the integration with
# CocoaPods, but makes sure that it is self-contained for the given
# constraints.
#
# @param [Target] target
# The target, this can be an aggregate target or a pod target.
#
# @param [Boolean] requires_host_target
# If this target requires a host target
#
# @param [Boolean] test_bundle
# Whether this is a test bundle or not. This has an effect when the platform is `osx` and changes
# the runtime search paths accordingly.
#
# @param [Xcodeproj::Config] xcconfig
# The xcconfig to edit.
#
# @return [void]
#
def
self
.
generate_ld_runpath_search_paths
(
target
,
requires_host_target
,
test_bundle
,
xcconfig
)
ld_runpath_search_paths
=
[
'$(inherited)'
]
if
target
.
platform
.
symbolic_name
==
:osx
ld_runpath_search_paths
<<
"'@executable_path/../Frameworks'"
ld_runpath_search_paths
<<
\
if
test_bundle
"'@loader_path/../Frameworks'"
else
"'@loader_path/Frameworks'"
end
else
ld_runpath_search_paths
<<
[
"'@executable_path/Frameworks'"
,
"'@loader_path/Frameworks'"
,
]
ld_runpath_search_paths
<<
"'@executable_path/../../Frameworks'"
if
requires_host_target
end
xcconfig
.
merge!
(
'LD_RUNPATH_SEARCH_PATHS'
=>
ld_runpath_search_paths
.
join
(
' '
))
end
# Add pod target to list of frameworks / libraries that are linked
# with the user’s project.
#
...
...
spec/unit/generator/xcconfig/pod_xcconfig_spec.rb
View file @
4f422dfe
...
...
@@ -169,6 +169,19 @@ module Pod
xcconfig
.
to_hash
[
'LIBRARY_SEARCH_PATHS'
].
should
.
be
.
nil
xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
should
.
be
.
nil
end
it
'includes default runpath search path list for test xcconfigs'
do
generator
=
PodXCConfig
.
new
(
@coconut_pod_target
,
true
)
xcconfig
=
generator
.
generate
xcconfig
.
to_hash
[
'LD_RUNPATH_SEARCH_PATHS'
].
should
==
"$(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'"
end
it
'includes default runpath search path list for test xcconfigs for test bundle'
do
@coconut_pod_target
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:osx
,
'10.10'
))
generator
=
PodXCConfig
.
new
(
@coconut_pod_target
,
true
)
xcconfig
=
generator
.
generate
xcconfig
.
to_hash
[
'LD_RUNPATH_SEARCH_PATHS'
].
should
==
"$(inherited) '@executable_path/../Frameworks' '@loader_path/../Frameworks'"
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