From fac1242320595d4b6ea9e154c23e1eba9cb32770 Mon Sep 17 00:00:00 2001 From: Alex Coomans Date: Wed, 11 Sep 2019 11:14:34 -0700 Subject: [PATCH] Include dependent vendored frameworks in linker flags --- CHANGELOG.md | 4 ++++ lib/cocoapods/target/build_settings.rb | 12 ++++++++---- spec/cocoapods-integration-specs | 2 +- .../build_settings/pod_target_settings_spec.rb | 4 ++-- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c20c9b1b98..9f95ea6e79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ##### Bug Fixes +* Include dependent vendored frameworks in linker flags + [Alex Coomans](https://github.com/drcapulet) + [#9045]((https://github.com/CocoaPods/CocoaPods/pull/9045) + * Correctly set deployment target for non library specs even if the root spec does not specify one. [Dimitris Koutsogiorgas](https://github.com/dnkoutso) [#9153](https://github.com/CocoaPods/CocoaPods/pull/9153) diff --git a/lib/cocoapods/target/build_settings.rb b/lib/cocoapods/target/build_settings.rb index 8f42439ed2..0e09423dd9 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