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
c679ae82
Commit
c679ae82
authored
Aug 30, 2017
by
Paul Beusterien
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix OTHER_LDFLAGS for projects including source static frameworks
parent
a75a2e85
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
101 additions
and
9 deletions
+101
-9
CHANGELOG.md
CHANGELOG.md
+6
-2
aggregate_xcconfig.rb
lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb
+2
-2
pod_xcconfig.rb
lib/cocoapods/generator/xcconfig/pod_xcconfig.rb
+2
-2
xcconfig_helper.rb
lib/cocoapods/generator/xcconfig/xcconfig_helper.rb
+12
-2
xcconfig_helper_spec.rb
spec/unit/generator/xcconfig/xcconfig_helper_spec.rb
+79
-1
No files found.
CHANGELOG.md
View file @
c679ae82
...
@@ -16,14 +16,18 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -16,14 +16,18 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
dependency resolution.
dependency resolution.
[
Samuel Giddins
](
https://github.com/segiddins
)
[
Samuel Giddins
](
https://github.com/segiddins
)
*
Add support for source static library frameworks
*
Add support for source static library frameworks
[
Paul Beusterien
](
https://github.com/paulb777
)
[
Paul Beusterien
](
https://github.com/paulb777
)
[
#6811
](
https://github.com/CocoaPods/CocoaPods/pull/6811
)
[
#6811
](
https://github.com/CocoaPods/CocoaPods/pull/6811
)
*
Add Private Header support to static frameworks
*
Add Private Header support to static frameworks
[
Paul Beusterien
](
https://github.com/paulb777
)
[
Paul Beusterien
](
https://github.com/paulb777
)
[
#6969
](
https://github.com/CocoaPods/CocoaPods/pull/6969
)
[
#6969
](
https://github.com/CocoaPods/CocoaPods/pull/6969
)
*
For source static frameworks, include frameworks from dependent targets and libraries in OTHER_LDFLAGS
[
paulb777
](
https://github.com/paulb777
)
[
#6988
](
https://github.com/CocoaPods/CocoaPods/pull/6988
)
##### Bug Fixes
##### Bug Fixes
*
Perform code signing on xctest bundles in the Pods project generated by a test spec
*
Perform code signing on xctest bundles in the Pods project generated by a test spec
...
...
lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb
View file @
c679ae82
...
@@ -170,11 +170,11 @@ module Pod
...
@@ -170,11 +170,11 @@ module Pod
# - `@import …;` / `import …`
# - `@import …;` / `import …`
#
#
def
generate_settings_to_import_pod_targets
def
generate_settings_to_import_pod_targets
@xcconfig
.
merge!
XCConfigHelper
.
se
tting
s_for_dependent_targets
(
target
,
pod_targets
)
@xcconfig
.
merge!
XCConfigHelper
.
se
arch_path
s_for_dependent_targets
(
target
,
pod_targets
)
@xcconfig
.
merge!
(
settings_to_import_pod_targets
)
@xcconfig
.
merge!
(
settings_to_import_pod_targets
)
target
.
search_paths_aggregate_targets
.
each
do
|
search_paths_target
|
target
.
search_paths_aggregate_targets
.
each
do
|
search_paths_target
|
generator
=
AggregateXCConfig
.
new
(
search_paths_target
,
configuration_name
)
generator
=
AggregateXCConfig
.
new
(
search_paths_target
,
configuration_name
)
@xcconfig
.
merge!
XCConfigHelper
.
se
tting
s_for_dependent_targets
(
nil
,
search_paths_target
.
pod_targets
)
@xcconfig
.
merge!
XCConfigHelper
.
se
arch_path
s_for_dependent_targets
(
nil
,
search_paths_target
.
pod_targets
)
@xcconfig
.
merge!
(
generator
.
settings_to_import_pod_targets
)
@xcconfig
.
merge!
(
generator
.
settings_to_import_pod_targets
)
end
end
end
end
...
...
lib/cocoapods/generator/xcconfig/pod_xcconfig.rb
View file @
c679ae82
...
@@ -70,10 +70,10 @@ module Pod
...
@@ -70,10 +70,10 @@ module Pod
end
end
XCConfigHelper
.
add_target_specific_settings
(
target
,
@xcconfig
)
XCConfigHelper
.
add_target_specific_settings
(
target
,
@xcconfig
)
recursive_dependent_targets
=
target
.
recursive_dependent_targets
recursive_dependent_targets
=
target
.
recursive_dependent_targets
@xcconfig
.
merge!
XCConfigHelper
.
se
tting
s_for_dependent_targets
(
target
,
recursive_dependent_targets
,
@test_xcconfig
)
@xcconfig
.
merge!
XCConfigHelper
.
se
arch_path
s_for_dependent_targets
(
target
,
recursive_dependent_targets
,
@test_xcconfig
)
if
@test_xcconfig
if
@test_xcconfig
test_dependent_targets
=
[
target
,
*
target
.
recursive_test_dependent_targets
].
uniq
test_dependent_targets
=
[
target
,
*
target
.
recursive_test_dependent_targets
].
uniq
@xcconfig
.
merge!
XCConfigHelper
.
se
tting
s_for_dependent_targets
(
target
,
test_dependent_targets
-
recursive_dependent_targets
,
@test_xcconfig
)
@xcconfig
.
merge!
XCConfigHelper
.
se
arch_path
s_for_dependent_targets
(
target
,
test_dependent_targets
-
recursive_dependent_targets
,
@test_xcconfig
)
XCConfigHelper
.
generate_vendored_build_settings
(
nil
,
target
.
all_test_dependent_targets
,
@xcconfig
)
XCConfigHelper
.
generate_vendored_build_settings
(
nil
,
target
.
all_test_dependent_targets
,
@xcconfig
)
XCConfigHelper
.
generate_other_ld_flags
(
nil
,
target
.
all_test_dependent_targets
,
@xcconfig
)
XCConfigHelper
.
generate_other_ld_flags
(
nil
,
target
.
all_test_dependent_targets
,
@xcconfig
)
XCConfigHelper
.
generate_ld_runpath_search_paths
(
target
,
false
,
true
,
@xcconfig
)
XCConfigHelper
.
generate_ld_runpath_search_paths
(
target
,
false
,
true
,
@xcconfig
)
...
...
lib/cocoapods/generator/xcconfig/xcconfig_helper.rb
View file @
c679ae82
...
@@ -270,7 +270,7 @@ module Pod
...
@@ -270,7 +270,7 @@ module Pod
#
#
# @return [Hash<String, String>] the settings
# @return [Hash<String, String>] the settings
#
#
def
self
.
se
tting
s_for_dependent_targets
(
target
,
dependent_targets
,
test_xcconfig
=
false
)
def
self
.
se
arch_path
s_for_dependent_targets
(
target
,
dependent_targets
,
test_xcconfig
=
false
)
dependent_targets
=
dependent_targets
.
select
(
&
:should_build?
)
dependent_targets
=
dependent_targets
.
select
(
&
:should_build?
)
# Filter out dependent targets that are subsets of another target.
# Filter out dependent targets that are subsets of another target.
...
@@ -332,7 +332,7 @@ module Pod
...
@@ -332,7 +332,7 @@ module Pod
#
#
def
self
.
generate_vendored_build_settings
(
aggregate_target
,
pod_targets
,
xcconfig
)
def
self
.
generate_vendored_build_settings
(
aggregate_target
,
pod_targets
,
xcconfig
)
pod_targets
.
each
do
|
pod_target
|
pod_targets
.
each
do
|
pod_target
|
unless
pod_target
.
should_build?
&&
pod_target
.
requires_frameworks?
unless
pod_target
.
should_build?
&&
pod_target
.
requires_frameworks?
&&
!
pod_target
.
static_framework?
XCConfigHelper
.
add_settings_for_file_accessors_of_target
(
aggregate_target
,
pod_target
,
xcconfig
)
XCConfigHelper
.
add_settings_for_file_accessors_of_target
(
aggregate_target
,
pod_target
,
xcconfig
)
end
end
end
end
...
@@ -396,6 +396,16 @@ module Pod
...
@@ -396,6 +396,16 @@ module Pod
# @return [void]
# @return [void]
#
#
def
self
.
generate_other_ld_flags
(
aggregate_target
,
pod_targets
,
xcconfig
)
def
self
.
generate_other_ld_flags
(
aggregate_target
,
pod_targets
,
xcconfig
)
# Make sure -framework option gets added for the search paths when static_frameworks are involved.
# Otherwise test targets won't link in their primary target's dependencies.
unless
aggregate_target
.
nil?
dependent_targets
=
aggregate_target
.
search_paths_aggregate_targets
dependent_targets
.
each
do
|
dependent_target
|
if
dependent_target
.
pod_targets
.
any?
(
&
:static_framework?
)
generate_other_ld_flags
(
dependent_target
,
dependent_target
.
pod_targets
,
xcconfig
)
end
end
end
other_ld_flags
=
pod_targets
.
select
(
&
:should_build?
).
map
do
|
pod_target
|
other_ld_flags
=
pod_targets
.
select
(
&
:should_build?
).
map
do
|
pod_target
|
if
pod_target
.
requires_frameworks?
if
pod_target
.
requires_frameworks?
%(-framework "#{pod_target.product_basename}")
%(-framework "#{pod_target.product_basename}")
...
...
spec/unit/generator/xcconfig/xcconfig_helper_spec.rb
View file @
c679ae82
...
@@ -77,10 +77,88 @@ module Pod
...
@@ -77,10 +77,88 @@ module Pod
:configuration_build_dir
=>
'B'
,
:configuration_build_dir
=>
'B'
,
)
)
dependent_targets
=
[
target1
,
target2
]
dependent_targets
=
[
target1
,
target2
]
build_settings
=
@sut
.
se
tting
s_for_dependent_targets
(
nil
,
dependent_targets
)
build_settings
=
@sut
.
se
arch_path
s_for_dependent_targets
(
nil
,
dependent_targets
)
build_settings
[
'FRAMEWORK_SEARCH_PATHS'
].
should
==
'"AB"'
build_settings
[
'FRAMEWORK_SEARCH_PATHS'
].
should
==
'"AB"'
end
end
it
'adds the libraries of the xcconfig for a static framework'
do
target_definition
=
stub
(
:inheritance
=>
'search_paths'
)
consumer
=
stub
(
:pod_target_xcconfig
=>
{},
:libraries
=>
[
'xml2'
],
:frameworks
=>
[],
:weak_frameworks
=>
[],
:platform_name
=>
:ios
,
)
file_accessor
=
stub
(
:spec_consumer
=>
consumer
,
:vendored_static_frameworks
=>
[],
:vendored_dynamic_frameworks
=>
[],
:vendored_static_libraries
=>
[],
:vendored_dynamic_libraries
=>
[],
)
pod_target
=
stub
(
:name
=>
'BananaLib'
,
:sandbox
=>
config
.
sandbox
,
:should_build?
=>
true
,
:requires_frameworks?
=>
true
,
:static_framework?
=>
true
,
:dependent_targets
=>
[],
:file_accessors
=>
[
file_accessor
],
)
pod_targets
=
[
pod_target
]
aggregate_target
=
stub
(
:target_definition
=>
target_definition
,
:pod_targets
=>
pod_targets
,
:search_paths_aggregate_targets
=>
[],
)
xcconfig
=
Xcodeproj
::
Config
.
new
@sut
.
generate_vendored_build_settings
(
aggregate_target
,
pod_targets
,
xcconfig
)
xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
should
==
'-l"xml2"'
end
it
'makes sure setting from search_paths get propagated for static frameworks'
do
target_definition
=
stub
(
:inheritance
=>
'search_paths'
)
consumer
=
stub
(
:pod_target_xcconfig
=>
{},
:libraries
=>
[
'xml2'
],
:frameworks
=>
[
'Foo'
],
:weak_frameworks
=>
[],
:platform_name
=>
:ios
,
)
file_accessor
=
stub
(
:spec_consumer
=>
consumer
,
:vendored_static_frameworks
=>
[],
:vendored_dynamic_frameworks
=>
[],
:vendored_static_libraries
=>
[],
:vendored_dynamic_libraries
=>
[],
)
pod_target
=
stub
(
:name
=>
'BananaLib'
,
:sandbox
=>
config
.
sandbox
,
:should_build?
=>
true
,
:requires_frameworks?
=>
true
,
:static_framework?
=>
true
,
:dependent_targets
=>
[],
:file_accessors
=>
[
file_accessor
],
:product_basename
=>
'Foo'
,
)
pod_targets
=
[
pod_target
]
aggregate_target
=
stub
(
:target_definition
=>
target_definition
,
:pod_targets
=>
pod_targets
,
:search_paths_aggregate_targets
=>
[],
)
test_aggregate_target
=
stub
(
:target_definition
=>
target_definition
,
:pod_targets
=>
[],
:search_paths_aggregate_targets
=>
[
aggregate_target
],
)
xcconfig
=
Xcodeproj
::
Config
.
new
@sut
.
generate_other_ld_flags
(
test_aggregate_target
,
[],
xcconfig
)
xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
should
==
'-framework "Foo"'
end
it
'adds the frameworks of the xcconfig'
do
it
'adds the frameworks of the xcconfig'
do
xcconfig
=
Xcodeproj
::
Config
.
new
xcconfig
=
Xcodeproj
::
Config
.
new
consumer
=
stub
(
consumer
=
stub
(
...
...
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