From 640168bbb1d2655e0c0af523f502f05cbf218e4a Mon Sep 17 00:00:00 2001 From: Alex Coomans Date: Fri, 6 Sep 2019 15:51:20 -0500 Subject: [PATCH] Include dependent vendored frameworks in linker flags --- CHANGELOG.md | 5 +++-- lib/cocoapods/target/build_settings.rb | 12 ++++++++---- spec/cocoapods-integration-specs | 2 +- .../build_settings/pod_target_settings_spec.rb | 4 ++-- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4263cfba59..77ba5135d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,8 +12,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ##### Bug Fixes -* None. - +* Include dependent vendored frameworks in linker flags + [Alex Coomans](https://github.com/drcapulet) + [#9045]((https://github.com/CocoaPods/CocoaPods/pull/9045) ## 1.8.0.beta.2 (2019-08-27) diff --git a/lib/cocoapods/target/build_settings.rb b/lib/cocoapods/target/build_settings.rb index 8c151bd2d5..34866c9686 100644 --- a/lib/cocoapods/target/build_settings.rb +++ b/lib/cocoapods/target/build_settings.rb @@ -564,12 +564,16 @@ def initialize(target, non_library_spec = nil) frameworks = [] frameworks.concat consumer_frameworks - if library_xcconfig? && (target.should_build? && target.build_as_dynamic?) - frameworks.concat vendored_static_frameworks.map { |l| File.basename(l, '.framework') } - end - if non_library_xcconfig? + if library_xcconfig? + # We know that this library target is being built dynamically based + # on the guard above, so include any vendored static frameworks. + frameworks.concat vendored_static_frameworks.map { |l| File.basename(l, '.framework') } if target.should_build? + # Also include any vendored dynamic frameworks of dependencies. + frameworks.concat dependent_targets.reject(&:should_build?).flat_map { |pt| pt.build_settings.dynamic_frameworks_to_import } + else frameworks.concat dependent_targets_to_link.flat_map { |pt| pt.build_settings.frameworks_to_import } end + frameworks end diff --git a/spec/cocoapods-integration-specs b/spec/cocoapods-integration-specs index ca1c6f52ee..bb95e44690 160000 --- a/spec/cocoapods-integration-specs +++ b/spec/cocoapods-integration-specs @@ -1 +1 @@ -Subproject commit ca1c6f52eeef01b4fd2f25d83106b4d78874d3e3 +Subproject commit bb95e44690cd408a52b97043ba4e248d8c02f85d diff --git a/spec/unit/target/build_settings/pod_target_settings_spec.rb b/spec/unit/target/build_settings/pod_target_settings_spec.rb index 7f319faf82..240cb7c192 100644 --- a/spec/unit/target/build_settings/pod_target_settings_spec.rb +++ b/spec/unit/target/build_settings/pod_target_settings_spec.rb @@ -89,8 +89,8 @@ class BuildSettings @xcconfig.to_hash['OTHER_LDFLAGS'].should.include('-weak_framework "iAd"') end - it 'does not include the vendored dynamic frameworks for dependency pods of the specification' do - @xcconfig.to_hash['OTHER_LDFLAGS'].should.not.include('-framework "dynamic-monkey"') + it 'does include the vendored dynamic frameworks for dependency pods of the specification' do + @xcconfig.to_hash['OTHER_LDFLAGS'].should.include('-framework "dynamic-monkey"') end it 'does not include vendored static frameworks for dependency pods of the specification' do