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
3e47acbf
Commit
3e47acbf
authored
Feb 10, 2017
by
Dimitris Koutsogiorgas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correctly handle `OTHER_LDFLAGS` for targets with inherit search paths and source pods.
parent
d597f715
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
18 deletions
+71
-18
CHANGELOG.md
CHANGELOG.md
+5
-0
aggregate_xcconfig.rb
lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb
+2
-2
xcconfig_helper.rb
lib/cocoapods/generator/xcconfig/xcconfig_helper.rb
+6
-11
xcconfig_helper_spec.rb
spec/unit/generator/xcconfig/xcconfig_helper_spec.rb
+58
-5
No files found.
CHANGELOG.md
View file @
3e47acbf
...
...
@@ -14,6 +14,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes
*
Correctly handle
`OTHER_LDFLAGS`
for targets with inherit search paths and source pods.
[
Justin Martin
](
https://github.com/justinseanmartin
)
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#6481
](
https://github.com/CocoaPods/CocoaPods/pull/6481
)
*
Do not generate
`UIRequiredDeviceCapabilities`
for
`tvOS`
Info.plists.
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#6193
](
https://github.com/CocoaPods/CocoaPods/issues/6193
)
...
...
lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb
View file @
3e47acbf
...
...
@@ -198,11 +198,11 @@ module Pod
if
pod_target
.
requires_frameworks?
%(-framework "#{pod_target.product_basename}")
else
%(-l "#{pod_target.product_basename}")
%(-l "#{pod_target.product_basename}")
if
XCConfigHelper
.
links_dependency?
(
target
,
pod_target
)
end
end
@xcconfig
.
merge!
(
'OTHER_LDFLAGS'
=>
other_ld_flags
.
join
(
' '
))
@xcconfig
.
merge!
(
'OTHER_LDFLAGS'
=>
other_ld_flags
.
compact
.
join
(
' '
))
end
# Ensure to add the default linker run path search paths as they could
...
...
lib/cocoapods/generator/xcconfig/xcconfig_helper.rb
View file @
3e47acbf
...
...
@@ -103,11 +103,11 @@ module Pod
#
def
self
.
add_static_dependency_build_settings
(
aggregate_target
,
pod_target
,
xcconfig
,
file_accessor
)
file_accessor
.
vendored_static_frameworks
.
each
do
|
vendored_static_framework
|
adds_other_ldflags
=
XCConfigHelper
.
links_
static_
dependency?
(
aggregate_target
,
pod_target
)
adds_other_ldflags
=
XCConfigHelper
.
links_dependency?
(
aggregate_target
,
pod_target
)
XCConfigHelper
.
add_framework_build_settings
(
vendored_static_framework
,
xcconfig
,
pod_target
.
sandbox
.
root
,
adds_other_ldflags
)
end
file_accessor
.
vendored_static_libraries
.
each
do
|
vendored_static_library
|
adds_other_ldflags
=
XCConfigHelper
.
links_
static_
dependency?
(
aggregate_target
,
pod_target
)
adds_other_ldflags
=
XCConfigHelper
.
links_dependency?
(
aggregate_target
,
pod_target
)
XCConfigHelper
.
add_library_build_settings
(
vendored_static_library
,
xcconfig
,
pod_target
.
sandbox
.
root
,
adds_other_ldflags
)
end
end
...
...
@@ -122,15 +122,10 @@ module Pod
# of the aggregate target. Aggregate targets that inherit search paths will only link
# if the target has explicitly declared the pod dependency.
#
def
self
.
links_static_dependency?
(
aggregate_target
,
pod_target
)
return
true
if
aggregate_target
.
nil?
||
aggregate_target
.
target_definition
.
inheritance
!=
'search_paths'
# Only link this static dependency if its explicitly defined for this target.
aggregate_target
.
target_definition
.
non_inherited_dependencies
.
each
do
|
d
|
if
d
.
name
==
pod_target
.
name
return
true
end
end
false
def
self
.
links_dependency?
(
aggregate_target
,
pod_target
)
return
true
if
aggregate_target
.
nil?
||
aggregate_target
.
target_definition
.
inheritance
==
'complete'
targets
=
aggregate_target
.
pod_targets
-
aggregate_target
.
search_paths_aggregate_targets
.
flat_map
(
&
:pod_targets
)
targets
.
include?
(
pod_target
)
end
# Adds build settings for dynamic vendored frameworks and libraries.
...
...
spec/unit/generator/xcconfig/xcconfig_helper_spec.rb
View file @
3e47acbf
...
...
@@ -233,8 +233,8 @@ module Pod
end
it
'should not include static framework other ld flags when inheriting search paths'
do
target_definition
=
stub
(
:inheritance
=>
'search_paths'
,
:non_inherited_dependencies
=>
[]
)
aggregate_target
=
stub
(
:target_definition
=>
target_definition
,
:pod_targets
=>
[])
target_definition
=
stub
(
:inheritance
=>
'search_paths'
)
aggregate_target
=
stub
(
:target_definition
=>
target_definition
,
:pod_targets
=>
[]
,
:search_paths_aggregate_targets
=>
[]
)
pod_target
=
stub
(
:sandbox
=>
config
.
sandbox
)
xcconfig
=
Xcodeproj
::
Config
.
new
@sut
.
add_static_dependency_build_settings
(
aggregate_target
,
pod_target
,
xcconfig
,
@accessor
)
...
...
@@ -244,10 +244,9 @@ module Pod
end
it
'should include static framework other ld flags when inheriting search paths but explicitly declared'
do
dependency
=
stub
(
:name
=>
'BananaLib'
)
target_definition
=
stub
(
:inheritance
=>
'search_paths'
,
:non_inherited_dependencies
=>
[
dependency
])
target_definition
=
stub
(
:inheritance
=>
'search_paths'
)
pod_target
=
stub
(
:name
=>
'BananaLib'
,
:sandbox
=>
config
.
sandbox
)
aggregate_target
=
stub
(
:target_definition
=>
target_definition
,
:pod_targets
=>
[
pod_target
])
aggregate_target
=
stub
(
:target_definition
=>
target_definition
,
:pod_targets
=>
[
pod_target
]
,
:search_paths_aggregate_targets
=>
[]
)
xcconfig
=
Xcodeproj
::
Config
.
new
@sut
.
add_static_dependency_build_settings
(
aggregate_target
,
pod_target
,
xcconfig
,
@accessor
)
xcconfig
.
to_hash
[
'LIBRARY_SEARCH_PATHS'
].
should
==
'$(inherited) "${PODS_ROOT}/../../spec/fixtures/banana-lib"'
...
...
@@ -274,6 +273,60 @@ module Pod
xcconfig
.
to_hash
[
'FRAMEWORK_SEARCH_PATHS'
].
should
==
'"${PODS_ROOT}/../../spec/fixtures/banana-lib"'
xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
should
==
'-l"Bananalib" -framework "Bananalib"'
end
it
'should link static dependency for pod targets'
do
pod_target
=
stub
(
:name
=>
'BananaLib'
,
:sandbox
=>
config
.
sandbox
)
@sut
.
links_dependency?
(
nil
,
pod_target
).
should
.
be
.
true
end
it
'should link static dependency when target explicitly specifies it'
do
target_definition
=
stub
(
:inheritance
=>
'complete'
)
pod_target
=
stub
(
:name
=>
'BananaLib'
,
:sandbox
=>
config
.
sandbox
)
aggregate_target
=
stub
(
:target_definition
=>
target_definition
,
:pod_targets
=>
[
pod_target
],
:search_paths_aggregate_targets
=>
[])
@sut
.
links_dependency?
(
aggregate_target
,
pod_target
).
should
.
be
.
true
end
it
'should link static dependency when target explicitly specifies it even with search paths'
do
target_definition
=
stub
(
:inheritance
=>
'search_paths'
)
pod_target
=
stub
(
:name
=>
'BananaLib'
,
:sandbox
=>
config
.
sandbox
)
aggregate_target
=
stub
(
:target_definition
=>
target_definition
,
:pod_targets
=>
[
pod_target
],
:search_paths_aggregate_targets
=>
[])
@sut
.
links_dependency?
(
aggregate_target
,
pod_target
).
should
.
be
.
true
end
it
'should not link static dependency when inheriting search paths and parent includes dependency'
do
parent_target_definition
=
stub
child_target_definition
=
stub
(
:inheritance
=>
'search_paths'
)
pod_target
=
stub
(
:name
=>
'BananaLib'
,
:sandbox
=>
config
.
sandbox
)
parent_aggregate_target
=
stub
(
:target_definition
=>
parent_target_definition
,
:pod_targets
=>
[
pod_target
],
:search_paths_aggregate_targets
=>
[])
child_aggregate_target
=
stub
(
:target_definition
=>
child_target_definition
,
:pod_targets
=>
[],
:search_paths_aggregate_targets
=>
[
parent_aggregate_target
])
@sut
.
links_dependency?
(
child_aggregate_target
,
pod_target
).
should
.
be
.
false
end
it
'should link static transitive dependencies if the parent does not link them'
do
child_pod_target
=
stub
(
:name
=>
'ChildPod'
,
:sandbox
=>
config
.
sandbox
)
parent_pod_target
=
stub
(
:name
=>
'ParentPod'
,
:sandbox
=>
config
.
sandbox
,
:dependent_targets
=>
[
child_pod_target
])
parent_target_definition
=
stub
child_target_definition
=
stub
(
:inheritance
=>
'search_paths'
)
parent_aggregate_target
=
stub
(
:target_definition
=>
parent_target_definition
,
:pod_targets
=>
[],
:search_paths_aggregate_targets
=>
[])
child_aggregate_target
=
stub
(
:target_definition
=>
child_target_definition
,
:pod_targets
=>
[
parent_pod_target
,
child_pod_target
],
:search_paths_aggregate_targets
=>
[
parent_aggregate_target
])
@sut
.
links_dependency?
(
child_aggregate_target
,
child_pod_target
).
should
.
be
.
true
@sut
.
links_dependency?
(
child_aggregate_target
,
parent_pod_target
).
should
.
be
.
true
end
it
'should link static only transitive dependencies that the parent does not link'
do
child_pod_target
=
stub
(
:name
=>
'ChildPod'
,
:sandbox
=>
config
.
sandbox
)
parent_pod_target
=
stub
(
:name
=>
'ParentPod'
,
:sandbox
=>
config
.
sandbox
,
:dependent_targets
=>
[
child_pod_target
])
parent_target_definition
=
stub
child_target_definition
=
stub
(
:inheritance
=>
'search_paths'
)
parent_aggregate_target
=
stub
(
:target_definition
=>
parent_target_definition
,
:pod_targets
=>
[
child_pod_target
],
:search_paths_aggregate_targets
=>
[])
child_aggregate_target
=
stub
(
:target_definition
=>
child_target_definition
,
:pod_targets
=>
[
parent_pod_target
,
child_pod_target
],
:search_paths_aggregate_targets
=>
[
parent_aggregate_target
])
@sut
.
links_dependency?
(
child_aggregate_target
,
child_pod_target
).
should
.
be
.
false
@sut
.
links_dependency?
(
child_aggregate_target
,
parent_pod_target
).
should
.
be
.
true
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