Skip to content

Commit

Permalink
Merge pull request #11158 from CocoaPods/fix_other_ld_runtime_paths
Browse files Browse the repository at this point in the history
Fix setting `LD_RUNTIME_SEARCH_PATHS` for aggregate targets that include dynamic xcframeworks.
  • Loading branch information
dnkoutso committed Jan 14, 2022
2 parents f120f9f + 58cc35d commit 6896aa9
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -12,6 +12,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#10950](https://github.com/CocoaPods/CocoaPods/pull/10950)

* Fix setting `LD_RUNTIME_SEARCH_PATHS` for aggregate targets that include dynamic xcframeworks.
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#11158](https://github.com/CocoaPods/CocoaPods/pull/11158)

##### Bug Fixes

* None.
Expand Down
11 changes: 10 additions & 1 deletion lib/cocoapods/sandbox/file_accessor.rb
Expand Up @@ -179,7 +179,7 @@ def vendored_dynamic_frameworks
end
end

# @return [Array<Pathname>] The paths of the dynamic xcframework bundles
# @return [Array<Pathname>] The paths of the static xcframework bundles
# that come shipped with the Pod.
#
def vendored_static_xcframeworks
Expand All @@ -188,6 +188,15 @@ def vendored_static_xcframeworks
end
end

# @return [Array<Pathname>] The paths of the dynamic xcframework bundles
# that come shipped with the Pod.
#
def vendored_dynamic_xcframeworks
vendored_xcframeworks.select do |path|
Xcode::XCFramework.new(spec.name, path).build_type == BuildType.dynamic_framework
end
end

# @return [Array<Pathname>] The paths of the static (fake) framework
# bundles that come shipped with the Pod.
#
Expand Down
2 changes: 1 addition & 1 deletion lib/cocoapods/target/build_settings.rb
Expand Up @@ -1288,7 +1288,7 @@ def other_swift_flags_without_swift?
define_build_settings_method :any_vendored_dynamic_artifacts?, :memoized => true do
pod_targets.any? do |pt|
pt.file_accessors.any? do |fa|
!fa.vendored_dynamic_artifacts.empty?
!fa.vendored_dynamic_artifacts.empty? || !fa.vendored_dynamic_xcframeworks.empty?
end
end
end
Expand Down
12 changes: 12 additions & 0 deletions spec/fixtures/xcframeworks/xcframework-spec.podspec
@@ -0,0 +1,12 @@
Pod::Spec.new do |s|
s.name = 'xcframework-spec'
s.version = '1.0'
s.author = { 'xcframework-spec' => 'xcframework-spec@xcframework-spec.com' }
s.summary = 'Use this podspec for tests to point to different xcframeworks for testing'
s.description = 'Use this podspec for tests to point to different xcframeworks for testing'
s.homepage = 'http://xcframework-spec.com'
s.source = { :git => 'http://xcframework-spec-corp.local/xcframework-spec-lib.git', :tag => 'v1.0' }
s.license = 'MIT'

s.platform = :ios, '8.0'
end
18 changes: 18 additions & 0 deletions spec/unit/target/build_settings/aggregate_target_settings_spec.rb
Expand Up @@ -342,6 +342,24 @@ def specs
end
end

describe 'with a vendored dynamic xcframework pod' do
before do
coconut_pod_target = @pod_targets.first
coconut_pod_target.stubs(:build_type).returns(BuildType.static_library)
end

def specs
spec = fixture_spec('xcframeworks/xcframework-spec.podspec')
spec.vendored_frameworks = 'DynamicFramework/CoconutLib.xcframework'
[spec]
end

it 'includes default runpath search path list when linking vendored dynamic xcframework' do
@target.stubs(:build_type => BuildType.dynamic_framework)
@generator.generate.to_hash['LD_RUNPATH_SEARCH_PATHS'].should == "$(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'"
end
end

describe 'with a scoped pod target' do
def specs
[
Expand Down

0 comments on commit 6896aa9

Please sign in to comment.