Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix setting LD_RUNTIME_SEARCH_PATHS for aggregate targets that include dynamic xcframeworks. #11158

Merged
merged 1 commit into from Jan 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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'"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verified this fails without my change.

end
end

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