class Pod::DyInstaller::Xcode::PodsProjectGenerator::PodTargetIntegrator
This class is responsible for integrating a pod target. This includes integrating the test targets included by each pod target.
Attributes
target[R]
@return [PodTarget] the target that should be integrated.
Public Class Methods
new(target)
click to toggle source
Init a new PodTargetIntegrator
.
@param [PodTarget] target @see target
# File lib/pod/installer/xcode/pods_project_generator/pod_target_integrator.rb, line 17 def initialize(target) @target = target end
Public Instance Methods
inspect()
click to toggle source
@return [String] a string representation suitable for debugging.
# File lib/pod/installer/xcode/pods_project_generator/pod_target_integrator.rb, line 39 def inspect "#<#{self.class} for target `#{target.label}'>" end
integrate!()
click to toggle source
Integrates the pod target.
@return [void]
# File lib/pod/installer/xcode/pods_project_generator/pod_target_integrator.rb, line 25 def integrate! UI.section(integration_message) do target.test_specs_by_native_target.each do |native_target, test_specs| add_embed_frameworks_script_phase(native_target) add_copy_resources_script_phase(native_target) UserProjectIntegrator::TargetIntegrator.create_or_update_user_script_phases(script_phases_for_specs(test_specs), native_target) end specs = target.non_test_specs UserProjectIntegrator::TargetIntegrator.create_or_update_user_script_phases(script_phases_for_specs(specs), target.native_target) end end
Private Instance Methods
add_copy_resources_script_phase(native_target)
click to toggle source
Find or create a 'Copy Pods Resources' build phase
@return [void]
# File lib/pod/installer/xcode/pods_project_generator/pod_target_integrator.rb, line 52 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_dependent_targets.flat_map do |dependent_target| include_test_spec_paths = dependent_target == target dependent_target.resource_paths(include_test_spec_paths) end input_paths = [] output_paths = [] unless resource_paths.empty? resource_paths_flattened = resource_paths.flatten.uniq input_paths = [script_path, *resource_paths_flattened] output_paths = UserProjectIntegrator::TargetIntegrator.resource_output_paths(resource_paths_flattened) end UserProjectIntegrator::TargetIntegrator.validate_input_output_path_limit(input_paths, output_paths) UserProjectIntegrator::TargetIntegrator.create_or_update_copy_resources_script_phase_to_target(native_target, script_path, input_paths, output_paths) end
add_embed_frameworks_script_phase(native_target)
click to toggle source
Find or create a 'Embed Pods Frameworks' Copy Files Build Phase
@return [void]
# File lib/pod/installer/xcode/pods_project_generator/pod_target_integrator.rb, line 74 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)}" all_dependent_targets = target.all_dependent_targets framework_paths = all_dependent_targets.flat_map do |dependent_target| include_test_spec_paths = dependent_target == target dependent_target.framework_paths(include_test_spec_paths) end input_paths = [] output_paths = [] unless framework_paths.empty? input_paths = [script_path, *framework_paths.flat_map { |fw| [fw[:input_path], fw[:dsym_input_path]] }.compact] output_paths = framework_paths.flat_map { |fw| [fw[:output_path], fw[:dsym_output_path]] }.compact end UserProjectIntegrator::TargetIntegrator.validate_input_output_path_limit(input_paths, output_paths) UserProjectIntegrator::TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths, output_paths) end
integration_message()
click to toggle source
@return [String] the message that should be displayed for the target
integration.
# File lib/pod/installer/xcode/pods_project_generator/pod_target_integrator.rb, line 95 def integration_message "Integrating target `#{target.name}`" end
script_phases_for_specs(specs)
click to toggle source
@param [Array<Specification] specs
the specs to return script phrases from.
@return [Array<Hash<Symbol=>String>] an array of all combined script phases from the specs.
# File lib/pod/installer/xcode/pods_project_generator/pod_target_integrator.rb, line 104 def script_phases_for_specs(specs) specs.flat_map { |spec| spec.consumer(target.platform).script_phases } end