Class: Pod::Installer::UserProjectIntegrator::TargetIntegrator

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-kz/native/target_integrator.rb

Instance Method Summary collapse

Instance Method Details

#handle_on_demand_resources_script_phaseObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cocoapods-kz/native/target_integrator.rb', line 13

def handle_on_demand_resources_script_phase
  phase_name = "[KZ] On Demand Resources Build"
  native_targets.each do |native_target|
    phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, phase_name)
    if KZ::KZGlobalHelper.instance.on_demand_resources_info.odr_target_names.include?(native_target.name)
      native_target.build_phases.push(phase).uniq! unless native_target.build_phases.include?(phase)
      # Xcode会默认给脚本内容增加换行,为了避免频繁的git变动,这里主动加上\n
      phase.shell_script = "#{KZ.deal_path_for_xcconfig(KZ::KZ_ON_DEMAND_RESOURCES_SHELL, true)}\n"
      phase.shell_path = '/bin/zsh'
      phase.input_paths = Array["#{KZ::KZ_POD_CONFIG_ROOT_STR}/KZOnDemandResourcesAllConfig.plist"]
      phase.output_paths = Array['${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/KZOnDemandResourcesAllConfig.plist']
    else
      native_target.build_phases.delete(phase) if native_target.build_phases.include?(phase)
    end
  end
end

#integrate!Object



8
9
10
11
# File 'lib/cocoapods-kz/native/target_integrator.rb', line 8

def integrate!
  origin_integrate!
  handle_on_demand_resources_script_phase
end

#origin_integrate!Object



7
# File 'lib/cocoapods-kz/native/target_integrator.rb', line 7

alias_method :origin_integrate!, :integrate!