Unverified Commit da431d33 authored by D. Koutsogiorgas's avatar D. Koutsogiorgas Committed by GitHub

Merge pull request #7695 from dnkoutso/app_host_plist_path_stable

Do not overwrite App host info plist path for multiple test specs
parents d1086378 eef65ae6
......@@ -24,6 +24,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#7698](https://github.com/CocoaPods/CocoaPods/pull/7698)
* Do not overwrite App host info plist path for multiple test specs
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#7695](https://github.com/CocoaPods/CocoaPods/pull/7695)
* Do not include test dependencies input and output paths
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#7688](https://github.com/CocoaPods/CocoaPods/pull/7688)
......
......@@ -243,10 +243,11 @@ module Pod
#
def add_test_app_host_targets(test_native_targets)
target.test_specs.map do |test_spec|
spec_consumer = test_spec.consumer(target.platform)
platform = target.platform
spec_consumer = test_spec.consumer(platform)
next unless spec_consumer.requires_app_host?
name = target.app_host_label(spec_consumer.test_type)
platform_name = target.platform.name
platform_name = platform.name
app_host_target = project.targets.find { |t| t.name == name }
if app_host_target.nil?
app_host_target = Pod::Generator::AppTargetHelper.add_app_target(project, platform_name, deployment_target, name)
......@@ -254,17 +255,18 @@ module Pod
configuration.build_settings.merge!(custom_build_settings)
configuration.build_settings['PRODUCT_NAME'] = name
configuration.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] = 'org.cocoapods.${PRODUCT_NAME:rfc1034identifier}'
configuration.build_settings['CODE_SIGN_IDENTITY'] = '' if target.platform == :osx
configuration.build_settings['CODE_SIGN_IDENTITY'] = '' if platform == :osx
end
Pod::Generator::AppTargetHelper.add_app_host_main_file(project, app_host_target, platform_name, name)
app_host_info_plist_path = target.app_host_info_plist_path_for_test_type(spec_consumer.test_type)
create_info_plist_file(app_host_info_plist_path, app_host_target, '1.0.0', target.platform, :appl)
app_host_info_plist_path = app_host_info_plist_path_for_test_type(name, spec_consumer.test_type)
create_info_plist_file(app_host_info_plist_path, app_host_target, '1.0.0', platform, :appl, false)
project[name].new_file(app_host_info_plist_path)
end
# Wire all test native targets with the app host.
test_native_target = test_native_target_from_spec_consumer(spec_consumer, test_native_targets)
test_native_target.build_configurations.each do |configuration|
test_host = "$(BUILT_PRODUCTS_DIR)/#{name}.app/"
test_host << 'Contents/MacOS/' if target.platform == :osx
test_host << 'Contents/MacOS/' if platform == :osx
test_host << name.to_s
configuration.build_settings['TEST_HOST'] = test_host
end
......@@ -704,6 +706,18 @@ module Pod
project.pod_support_files_group(pod_name, dir)
end
# @param [String] name
# The name of the app host.
# @param [Symbol] test_type
# The test type this Info.plist path is for.
#
# @return [Pathname] The absolute path of the Info.plist to use for an app host.
#
def app_host_info_plist_path_for_test_type(name, test_type)
project.path.dirname.+("#{name}/#{target.app_host_label(test_type)}-Info.plist")
end
def test_native_target_from_spec_consumer(spec_consumer, test_native_targets)
test_native_targets.find do |native_target|
native_target.symbol_type == target.product_type_for_test_type(spec_consumer.test_type)
......
......@@ -157,13 +157,17 @@ module Pod
# @param [Symbol] bundle_package_type
# the CFBundlePackageType of the target this Info.plist file is for.
#
# @param [Boolean] add_to_support_group
# Whether to add the generated file into the support files group by default.
#
# @return [void]
#
def create_info_plist_file(path, native_target, version, platform, bundle_package_type = :fmwk)
def create_info_plist_file(path, native_target, version, platform, bundle_package_type = :fmwk,
add_to_support_group = true)
UI.message "- Generating Info.plist file at #{UI.path(path)}" do
generator = Generator::InfoPlistFile.new(version, platform, bundle_package_type)
update_changed_file(generator, path)
add_file_to_support_group(path)
add_file_to_support_group(path) if add_to_support_group
native_target.build_configurations.each do |c|
relative_path = path.relative_path_from(sandbox.root)
......
......@@ -386,15 +386,6 @@ module Pod
"AppHost-#{Platform.string_name(platform.symbolic_name)}-#{test_type.capitalize}-Tests"
end
# @param [Symbol] test_type
# The test type this Info.plist path is for.
#
# @return [Pathname] The absolute path of the Info.plist to use for an app host.
#
def app_host_info_plist_path_for_test_type(test_type)
support_files_dir + "#{app_host_label(test_type)}-Info.plist"
end
# @param [Symbol] test_type
# The test type this embed frameworks script path is for.
#
......
......@@ -343,6 +343,11 @@ module Pod
},
}
end
it 'returns correct app host info plist path for test type' do
expected = 'Pods/AppHost/AppHost-iOS-Unit-Tests-Info.plist'
@installer.send(:app_host_info_plist_path_for_test_type, 'AppHost', :unit).to_s.should.include expected
end
end
end
......
......@@ -539,10 +539,6 @@ module Pod
exception.message.should.include 'Unknown product type `weird_product_type`'
end
it 'returns correct app host info plist path for test type' do
@test_pod_target.app_host_info_plist_path_for_test_type(:unit).to_s.should.include 'Pods/Target Support Files/CoconutLib/AppHost-iOS-Unit-Tests-Info.plist'
end
it 'returns correct copy resources script path for test unit test type' do
@test_pod_target.copy_resources_script_path_for_test_type(:unit).to_s.should.include 'Pods/Target Support Files/CoconutLib/CoconutLib-Unit-Tests-resources.sh'
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