From 6322f834980368381d4ab265df8ed88495e348cb Mon Sep 17 00:00:00 2001 From: Ethan Wong Date: Fri, 31 Mar 2023 00:33:06 +0800 Subject: [PATCH] Fix potential Gatekeeper problems by removing the `LD_RUNPATH_SEARCH_PATHS` referencing outside the App bundle for macOS targets. (#10954) --- CHANGELOG.md | 6 +++++- lib/cocoapods/target/build_settings.rb | 2 +- .../target/build_settings/aggregate_target_settings_spec.rb | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75f1322ff5..47a7350aa7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ##### Bug Fixes -* None. +* Fix potential Gatekeeper problems by removing the `LD_RUNPATH_SEARCH_PATHS` referencing outside the App bundle for + macOS targets. + [Ethan Wong](https://github.com/GetToSet) + [#11837](https://github.com/CocoaPods/CocoaPods/pull/11773) + [#10954](https://github.com/CocoaPods/CocoaPods/issues/10954) ## 1.12.1 (2023-04-18) diff --git a/lib/cocoapods/target/build_settings.rb b/lib/cocoapods/target/build_settings.rb index 0513479d40..1fe872c9f0 100644 --- a/lib/cocoapods/target/build_settings.rb +++ b/lib/cocoapods/target/build_settings.rb @@ -359,7 +359,7 @@ def _ld_runpath_search_paths(requires_host_target: false, test_bundle: false, us else "'@loader_path/Frameworks'" end - paths << '${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}' if uses_swift + paths << '${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}' if uses_swift && test_bundle else paths << "'@executable_path/Frameworks'" paths << "'@loader_path/Frameworks'" diff --git a/spec/unit/target/build_settings/aggregate_target_settings_spec.rb b/spec/unit/target/build_settings/aggregate_target_settings_spec.rb index b8ceb45a90..517e5e9ed1 100644 --- a/spec/unit/target/build_settings/aggregate_target_settings_spec.rb +++ b/spec/unit/target/build_settings/aggregate_target_settings_spec.rb @@ -440,7 +440,7 @@ def pod_target(spec, target_definition) mock_user_target = mock('usertarget') mock_user_target.stubs(:symbol_type).returns(:application) @target.stubs(:user_targets).returns([mock_user_target]) - @generator.generate.to_hash['LD_RUNPATH_SEARCH_PATHS'].should == %q[$(inherited) /usr/lib/swift '@executable_path/../Frameworks' '@loader_path/Frameworks' "${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"] + @generator.generate.to_hash['LD_RUNPATH_SEARCH_PATHS'].should == "$(inherited) /usr/lib/swift '@executable_path/../Frameworks' '@loader_path/Frameworks'" end it 'uses the target definition swift version' do