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
3d85899c
Commit
3d85899c
authored
Feb 09, 2017
by
Dimitris Koutsogiorgas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix integration with vendored static frameworks and libraries.
parent
fada1daa
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
11 deletions
+54
-11
CHANGELOG.md
CHANGELOG.md
+4
-0
xcconfig_helper.rb
lib/cocoapods/generator/xcconfig/xcconfig_helper.rb
+29
-8
xcconfig_helper_spec.rb
spec/unit/generator/xcconfig/xcconfig_helper_spec.rb
+21
-3
No files found.
CHANGELOG.md
View file @
3d85899c
...
...
@@ -12,6 +12,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes
*
Fix integration with vendored static frameworks and libraries.
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#6477
](
https://github.com/CocoaPods/CocoaPods/pull/6477
)
*
Use
`${SRCROOT}`
rather than
`${PODS_ROOT}`
in the generated manifest lock script phase.
[
Dimitris Koutsogiorgas
](
https://github.com/dnkoutso
)
[
#5499
](
https://github.com/CocoaPods/CocoaPods/issues/5499
)
...
...
lib/cocoapods/generator/xcconfig/xcconfig_helper.rb
View file @
3d85899c
...
...
@@ -103,13 +103,34 @@ 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
|
if
aggregate_target
.
nil?
||
aggregate_target
.
target_definition
.
inheritance
!=
'search_paths'
XCConfigHelper
.
add_framework_build_settings
(
vendored_static_framework
,
xcconfig
,
pod_target
.
sandbox
.
root
)
end
adds_other_ldflags
=
XCConfigHelper
.
links_static_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
|
XCConfigHelper
.
add_library_build_settings
(
vendored_static_library
,
xcconfig
,
pod_target
.
sandbox
.
root
)
adds_other_ldflags
=
XCConfigHelper
.
links_static_dependency?
(
aggregate_target
,
pod_target
)
XCConfigHelper
.
add_library_build_settings
(
vendored_static_library
,
xcconfig
,
pod_target
.
sandbox
.
root
,
adds_other_ldflags
)
end
end
# @param [AggregateTarget] aggregate_target
# The aggregate target, may be nil.
#
# @param [PodTarget] pod_target
# The pod target to link or not.
#
# @return [Boolean] Whether static dependency should be added to the 'OTHER_LDFLAGS'
# 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
end
# Adds build settings for dynamic vendored frameworks and libraries.
...
...
@@ -165,13 +186,13 @@ module Pod
#
# @return [void]
#
def
self
.
add_framework_build_settings
(
framework_path
,
xcconfig
,
sandbox_root
)
def
self
.
add_framework_build_settings
(
framework_path
,
xcconfig
,
sandbox_root
,
include_other_ldflags
=
true
)
name
=
File
.
basename
(
framework_path
,
'.framework'
)
dirname
=
'${PODS_ROOT}/'
+
framework_path
.
dirname
.
relative_path_from
(
sandbox_root
).
to_s
build_settings
=
{
'OTHER_LDFLAGS'
=>
"-framework
#{
name
}
"
,
'FRAMEWORK_SEARCH_PATHS'
=>
quote
([
dirname
]),
}
build_settings
[
'OTHER_LDFLAGS'
]
=
"-framework
#{
name
}
"
if
include_other_ldflags
xcconfig
.
merge!
(
build_settings
)
end
...
...
@@ -189,14 +210,14 @@ module Pod
#
# @return [void]
#
def
self
.
add_library_build_settings
(
library_path
,
xcconfig
,
sandbox_root
)
def
self
.
add_library_build_settings
(
library_path
,
xcconfig
,
sandbox_root
,
include_other_ldflags
=
true
)
extension
=
File
.
extname
(
library_path
)
name
=
File
.
basename
(
library_path
,
extension
).
sub
(
/\Alib/
,
''
)
dirname
=
'${PODS_ROOT}/'
+
library_path
.
dirname
.
relative_path_from
(
sandbox_root
).
to_s
build_settings
=
{
'OTHER_LDFLAGS'
=>
"-l
#{
name
}
"
,
'LIBRARY_SEARCH_PATHS'
=>
'$(inherited) '
+
quote
([
dirname
]),
}
build_settings
[
'OTHER_LDFLAGS'
]
=
"-l
#{
name
}
"
if
include_other_ldflags
xcconfig
.
merge!
(
build_settings
)
end
...
...
spec/unit/generator/xcconfig/xcconfig_helper_spec.rb
View file @
3d85899c
...
...
@@ -233,12 +233,26 @@ module Pod
end
it
'should not include static framework other ld flags when inheriting search paths'
do
target_definition
=
stub
(
:inheritance
=>
'search_paths'
)
aggregate_target
=
stub
(
:target_definition
=>
target_definition
)
target_definition
=
stub
(
:inheritance
=>
'search_paths'
,
:non_inherited_dependencies
=>
[]
)
aggregate_target
=
stub
(
:target_definition
=>
target_definition
,
:pod_targets
=>
[]
)
pod_target
=
stub
(
:sandbox
=>
config
.
sandbox
)
xcconfig
=
Xcodeproj
::
Config
.
new
@sut
.
add_static_dependency_build_settings
(
aggregate_target
,
pod_target
,
xcconfig
,
@accessor
)
xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
should
==
'-l"Bananalib"'
xcconfig
.
to_hash
[
'LIBRARY_SEARCH_PATHS'
].
should
==
'$(inherited) "${PODS_ROOT}/../../spec/fixtures/banana-lib"'
xcconfig
.
to_hash
[
'FRAMEWORK_SEARCH_PATHS'
].
should
==
'"${PODS_ROOT}/../../spec/fixtures/banana-lib"'
xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
should
.
be
.
nil
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
])
pod_target
=
stub
(
:name
=>
'BananaLib'
,
:sandbox
=>
config
.
sandbox
)
aggregate_target
=
stub
(
:target_definition
=>
target_definition
,
:pod_targets
=>
[
pod_target
])
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"'
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 include static framework other ld flags when not inheriting search paths'
do
...
...
@@ -247,6 +261,8 @@ module Pod
pod_target
=
stub
(
:sandbox
=>
config
.
sandbox
)
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"'
xcconfig
.
to_hash
[
'FRAMEWORK_SEARCH_PATHS'
].
should
==
'"${PODS_ROOT}/../../spec/fixtures/banana-lib"'
xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
should
==
'-l"Bananalib" -framework "Bananalib"'
end
...
...
@@ -254,6 +270,8 @@ module Pod
pod_target
=
stub
(
:sandbox
=>
config
.
sandbox
)
xcconfig
=
Xcodeproj
::
Config
.
new
@sut
.
add_static_dependency_build_settings
(
nil
,
pod_target
,
xcconfig
,
@accessor
)
xcconfig
.
to_hash
[
'LIBRARY_SEARCH_PATHS'
].
should
==
'$(inherited) "${PODS_ROOT}/../../spec/fixtures/banana-lib"'
xcconfig
.
to_hash
[
'FRAMEWORK_SEARCH_PATHS'
].
should
==
'"${PODS_ROOT}/../../spec/fixtures/banana-lib"'
xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
should
==
'-l"Bananalib" -framework "Bananalib"'
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