diff --git a/CHANGELOG.md b/CHANGELOG.md index 91ea0b815e..c076b38cbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ##### Bug Fixes -* None. +* Also apply Xcode 11 `XCTUnwrap` fix to library and framework targets that weakly link `XCTest`. + [Dimitris Koutsogiorgas](https://github.com/dnkoutso) + [#9518](https://github.com/CocoaPods/CocoaPods/pull/9518) ## 1.9.0.beta.3 (2020-02-04) diff --git a/lib/cocoapods/target/build_settings.rb b/lib/cocoapods/target/build_settings.rb index 3bfe5b1d51..08c5341fab 100644 --- a/lib/cocoapods/target/build_settings.rb +++ b/lib/cocoapods/target/build_settings.rb @@ -992,7 +992,7 @@ def pod_target_xcconfig_values_by_consumer_by_key library_xcconfig? && target.platform.name == :ios && Version.new(target.platform.deployment_target) < Version.new('12.2') && - frameworks_to_import.include?('XCTest') + (frameworks_to_import + weak_frameworks_to_import).uniq.include?('XCTest') end #-------------------------------------------------------------------------# 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 4f2e7c9486..c29f5260e2 100644 --- a/spec/unit/target/build_settings/pod_target_settings_spec.rb +++ b/spec/unit/target/build_settings/pod_target_settings_spec.rb @@ -194,6 +194,16 @@ class BuildSettings hash['SWIFT_INCLUDE_PATHS'].should.include '"$(PLATFORM_DIR)/Developer/usr/lib"' end + it 'includes xctunwrap fix for a pod target with deployment target < 12.2 and weakly links XCTest' do + @spec.weak_frameworks = ['XCTest'] + @pod_target.stubs(:platform).returns(Platform.new(:ios, '12.1')) + generator = PodTargetSettings.new(@pod_target, nil, :configuration => :debug) + hash = generator.generate.to_hash + hash['SYSTEM_FRAMEWORK_SEARCH_PATHS'].should.include '"$(PLATFORM_DIR)/Developer/usr/lib"' + hash['LIBRARY_SEARCH_PATHS'].should.include '"$(PLATFORM_DIR)/Developer/usr/lib"' + hash['SWIFT_INCLUDE_PATHS'].should.include '"$(PLATFORM_DIR)/Developer/usr/lib"' + end + it 'does not include xctunwrap fix for a pod target with higher than 12.1 deployment target' do @spec.frameworks = ['XCTest'] @pod_target.stubs(:platform).returns(Platform.new(:ios, '12.2'))