Do not include test spec resources and framework paths of dependent targets into test scripts

parent 88276c47
......@@ -14,6 +14,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes
* Do not include test spec resources and framework paths of dependent targets into test scripts
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#7318](https://github.com/CocoaPods/CocoaPods/pull/7318)
* Restore `development_pod_targets` public method in installer
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#7292](https://github.com/CocoaPods/CocoaPods/pull/7292)
......
......@@ -75,8 +75,8 @@ module Pod
if @test_xcconfig
test_dependent_targets = [target, *target.recursive_test_dependent_targets].uniq
@xcconfig.merge! XCConfigHelper.search_paths_for_dependent_targets(target, test_dependent_targets - recursive_dependent_targets, @test_xcconfig)
XCConfigHelper.generate_vendored_build_settings(nil, target.all_test_dependent_targets, @xcconfig, true, @test_xcconfig)
XCConfigHelper.generate_other_ld_flags(nil, target.all_test_dependent_targets, @xcconfig)
XCConfigHelper.generate_vendored_build_settings(nil, target.all_dependent_targets, @xcconfig, true, @test_xcconfig)
XCConfigHelper.generate_other_ld_flags(nil, target.all_dependent_targets, @xcconfig)
XCConfigHelper.generate_ld_runpath_search_paths(target, false, true, @xcconfig)
end
@xcconfig
......
......@@ -288,7 +288,7 @@ module Pod
private
def add_pod_target_test_dependencies(pod_target, frameworks_group)
test_dependent_targets = pod_target.all_test_dependent_targets
test_dependent_targets = pod_target.all_dependent_targets
pod_target.test_specs_by_native_target.each do |test_native_target, test_specs|
test_dependent_targets.reject(&:should_build?).each do |test_dependent_target|
add_resource_bundles_to_native_target(test_dependent_target, test_native_target)
......
......@@ -242,7 +242,7 @@ module Pod
product_type = target.product_type_for_test_type(test_type)
name = target.test_target_label(test_type)
platform_name = target.platform.name
language = target.all_test_dependent_targets.any?(&:uses_swift?) ? :swift : :objc
language = target.all_dependent_targets.any?(&:uses_swift?) ? :swift : :objc
native_test_target = project.new_target(product_type, name, platform_name, deployment_target, nil, language)
native_test_target.product_reference.name = name
......@@ -401,9 +401,12 @@ module Pod
#
def create_test_target_copy_resources_script(test_type)
path = target.copy_resources_script_path_for_test_type(test_type)
pod_targets = target.all_test_dependent_targets
pod_targets = target.all_dependent_targets
resource_paths_by_config = target.user_build_configurations.keys.each_with_object({}) do |config, resources_by_config|
resources_by_config[config] = pod_targets.flat_map(&:resource_paths)
resources_by_config[config] = pod_targets.flat_map do |pod_target|
include_test_spec_paths = pod_target == target
pod_target.resource_paths(include_test_spec_paths)
end
end
generator = Generator::CopyResourcesScript.new(resource_paths_by_config, target.platform)
update_changed_file(generator, path)
......@@ -419,9 +422,12 @@ module Pod
#
def create_test_target_embed_frameworks_script(test_type)
path = target.embed_frameworks_script_path_for_test_type(test_type)
pod_targets = target.all_test_dependent_targets
pod_targets = target.all_dependent_targets
framework_paths_by_config = target.user_build_configurations.keys.each_with_object({}) do |config, paths_by_config|
paths_by_config[config] = pod_targets.flat_map(&:framework_paths)
paths_by_config[config] = pod_targets.flat_map do |pod_target|
include_test_spec_paths = pod_target == target
pod_target.framework_paths(include_test_spec_paths)
end
end
generator = Generator::EmbedFrameworksScript.new(framework_paths_by_config)
update_changed_file(generator, path)
......@@ -435,7 +441,7 @@ module Pod
#
def test_target_swift_debug_hack(test_target_bc)
return unless test_target_bc.debug?
return unless target.all_test_dependent_targets.any?(&:uses_swift?)
return unless target.all_dependent_targets.any?(&:uses_swift?)
ldflags = test_target_bc.build_settings['OTHER_LDFLAGS'] ||= '$(inherited)'
ldflags << ' -lswiftSwiftOnoneSupport'
end
......
......@@ -52,7 +52,7 @@ module Pod
def add_copy_resources_script_phase(native_target)
test_type = target.test_type_for_product_type(native_target.symbol_type)
script_path = "${PODS_ROOT}/#{target.copy_resources_script_path_for_test_type(test_type).relative_path_from(target.sandbox.root)}"
resource_paths = target.all_test_dependent_targets.flat_map(&:resource_paths)
resource_paths = target.all_dependent_targets.flat_map(&:resource_paths)
input_paths = []
output_paths = []
unless resource_paths.empty?
......@@ -74,7 +74,7 @@ module Pod
def add_embed_frameworks_script_phase(native_target)
test_type = target.test_type_for_product_type(native_target.symbol_type)
script_path = "${PODS_ROOT}/#{target.embed_frameworks_script_path_for_test_type(test_type).relative_path_from(target.sandbox.root)}"
framework_paths = target.all_test_dependent_targets.flat_map(&:framework_paths)
framework_paths = target.all_dependent_targets.flat_map(&:framework_paths)
input_paths = []
output_paths = []
unless framework_paths.empty?
......
......@@ -468,10 +468,10 @@ module Pod
end
end
# @return [Array<PodTarget>] the canonical list of test dependent targets this target has a dependency upon.
# This includes the parent target as well as its transitive dependencies.
# @return [Array<PodTarget>] the canonical list of dependent targets this target has a dependency upon.
# This list includes the target itself as well as its recursive dependent and test dependent targets.
#
def all_test_dependent_targets
def all_dependent_targets
[self, *recursive_dependent_targets, *recursive_test_dependent_targets].uniq
end
......
......@@ -351,7 +351,7 @@ module Pod
test_dependent_target.expects(:should_build?).returns(true)
@pod_target.stubs(:test_native_targets).returns([mock_test_native_target])
@pod_target.stubs(:all_test_dependent_targets).returns([test_dependent_target])
@pod_target.stubs(:all_dependent_targets).returns([test_dependent_target])
@pod_target.stubs(:should_build? => false)
mock_test_native_target.expects(:add_dependency).with(test_dependent_native_target)
......@@ -384,7 +384,7 @@ module Pod
@pod_target.test_specs.first.requires_app_host = true
@pod_target.stubs(:test_native_targets).returns([mock_test_native_target])
@pod_target.stubs(:all_test_dependent_targets).returns([test_dependent_target])
@pod_target.stubs(:all_dependent_targets).returns([test_dependent_target])
@pod_target.stubs(:should_build? => false)
mock_test_native_target.expects(:add_dependency).with(test_dependent_native_target)
......
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