Commit 4563109b authored by Nickolay Tarbayev's avatar Nickolay Tarbayev

Install resource bundles and embed frameworks for every test target's configuration

parent 71211b50
......@@ -18,6 +18,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes
* Install resource bundles and embed frameworks for every test target's configuration
[Nickolay Tarbayev](https://github.com/tarbayev)
[#7012](https://github.com/CocoaPods/CocoaPods/issues/7012)
* Set `SWIFT_VERSION` to test native targets during validation
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#7216](https://github.com/CocoaPods/CocoaPods/pull/7216)
......
......@@ -402,7 +402,9 @@ 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
resource_paths_by_config = { 'Debug' => pod_targets.flat_map(&:resource_paths) }
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)
end
generator = Generator::CopyResourcesScript.new(resource_paths_by_config, target.platform)
update_changed_file(generator, path)
add_file_to_support_group(path)
......@@ -418,7 +420,9 @@ 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
framework_paths_by_config = { 'Debug' => pod_targets.flat_map(&:framework_paths) }
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)
end
generator = Generator::EmbedFrameworksScript.new(framework_paths_by_config)
update_changed_file(generator, path)
add_file_to_support_group(path)
......
......@@ -277,6 +277,34 @@ module Pod
end
end
it 'creates embed frameworks script for test target' do
@coconut_pod_target.stubs(:requires_frameworks? => true)
@installer.install!
script_path = @coconut_pod_target.embed_frameworks_script_path_for_test_type(:unit)
script = script_path.read
@coconut_pod_target.user_build_configurations.keys.each do |configuration|
script.should.include <<-eos.strip_heredoc
if [[ "$CONFIGURATION" == "#{configuration}" ]]; then
install_framework "${BUILT_PRODUCTS_DIR}/CoconutLib/CoconutLib.framework"
fi
eos
end
end
it 'adds the resources bundles for to the copy resources script for test target' do
@coconut_spec.test_specs.first.resource_bundle = { 'CoconutLibTestResources' => ['Tests/*.xib'] }
@installer.install!
script_path = @coconut_pod_target.copy_resources_script_path_for_test_type(:unit)
script = script_path.read
@coconut_pod_target.user_build_configurations.keys.each do |configuration|
script.should.include <<-eos.strip_heredoc
if [[ "$CONFIGURATION" == "#{configuration}" ]]; then
install_resource "${PODS_CONFIGURATION_BUILD_DIR}/CoconutLibTestResources.bundle"
fi
eos
end
end
describe 'app host generation' do
before do
@coconut_spec.test_specs.first.requires_app_host = true
......
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