Ensure product name for tests is not overridden by custom build settings

parent a1ffccca
...@@ -34,6 +34,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -34,6 +34,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes ##### Bug Fixes
* Ensure product name for tests is not overridden by custom build settings
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#6766](https://github.com/CocoaPods/CocoaPods/pull/6766)
* Do not use the same product name for test targets * Do not use the same product name for test targets
[Dimitris Koutsogiorgas](https://github.com/dnkoutso) [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#6762](https://github.com/CocoaPods/CocoaPods/pull/6762) [#6762](https://github.com/CocoaPods/CocoaPods/pull/6762)
......
...@@ -179,10 +179,7 @@ module Pod ...@@ -179,10 +179,7 @@ module Pod
platform = target.platform.name platform = target.platform.name
language = target.uses_swift? ? :swift : :objc language = target.uses_swift? ? :swift : :objc
native_test_target = project.new_target(product_type, name, platform, deployment_target, nil, language) native_test_target = project.new_target(product_type, name, platform, deployment_target, nil, language)
native_test_target.product_reference.name = name
product_name = name
product = native_test_target.product_reference
product.name = product_name
target.user_build_configurations.each do |bc_name, type| target.user_build_configurations.each do |bc_name, type|
native_test_target.add_build_configuration(bc_name, type) native_test_target.add_build_configuration(bc_name, type)
...@@ -190,9 +187,13 @@ module Pod ...@@ -190,9 +187,13 @@ module Pod
native_test_target.build_configurations.each do |configuration| native_test_target.build_configurations.each do |configuration|
configuration.build_settings.merge!(custom_build_settings) configuration.build_settings.merge!(custom_build_settings)
# target_installer will automatically add an empth `OTHER_LDFLAGS`. For test # target_installer will automatically add an empty `OTHER_LDFLAGS`. For test
# targets those are set via a test xcconfig file instead. # targets those are set via a test xcconfig file instead.
configuration.build_settings.delete('OTHER_LDFLAGS') configuration.build_settings.delete('OTHER_LDFLAGS')
# target_installer will automatically set the product name to the module name if the target
# requires frameworks. For tests we always use the test target name as the product name
# irrelevant to whether we use frameworks or not.
configuration.build_settings['PRODUCT_NAME'] = name
end end
target.test_native_targets << native_test_target target.test_native_targets << native_test_target
......
...@@ -188,6 +188,9 @@ module Pod ...@@ -188,6 +188,9 @@ module Pod
native_test_target = @project.targets[1] native_test_target = @project.targets[1]
native_test_target.name.should == 'CoconutLib-Unit-Tests' native_test_target.name.should == 'CoconutLib-Unit-Tests'
native_test_target.product_reference.name.should == 'CoconutLib-Unit-Tests' native_test_target.product_reference.name.should == 'CoconutLib-Unit-Tests'
native_test_target.build_configurations.each do |bc|
bc.build_settings['PRODUCT_NAME'].should == 'CoconutLib-Unit-Tests'
end
native_test_target.symbol_type.should == :unit_test_bundle native_test_target.symbol_type.should == :unit_test_bundle
@coconut_pod_target.test_native_targets.count.should == 1 @coconut_pod_target.test_native_targets.count.should == 1
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment