Class: Pod::Installer

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-kz/native/installer.rb,
lib/cocoapods-kz/native/target_integrator.rb,
lib/cocoapods-kz/native/pods_project_writer.rb,
lib/cocoapods-kz/native/pod_target_installer.rb,
lib/cocoapods-kz/native/pod_target_integrator.rb,
lib/cocoapods-kz/native/target_installer_helper.rb

Defined Under Namespace

Classes: UserProjectIntegrator, Xcode

Instance Method Summary collapse

Instance Method Details

#download_dependenciesObject



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

def download_dependencies
  original_download_dependencies

  # 因为kz_pod_target提供不少方法,需要判断pod文件情况,所以依赖分析需要挪到download之后
  if KZ::KZGlobalHelper.instance.generate_kz_pod_targets
    main_project = aggregate_targets.first.user_project
    main_project.targets.each do |main_target|
      if main_target.display_name == KZ::KZGlobalHelper.instance.on_demand_resources_info.odr_target_name
        bundle_id = main_target.build_configurations.first.kz_simple_attributes_buildSettings_hash["PRODUCT_BUNDLE_IDENTIFIER"]
        KZ::KZGlobalHelper.instance.on_demand_resources_info.bundle_id = bundle_id unless bundle_id.nil?
      end
    end

    kz_analyer = KZ::KZAnalyzer.new(pod_targets, self.sandbox.development_pods)
    kz_analyer.analyer
    KZ::KZGlobalHelper.instance.kz_analyzer = kz_analyer
    KZ::KZGlobalHelper.instance.kz_generator = KZ::KZGenerator.new(main_project)
    KZ::KZGlobalHelper.instance.handle_flexCompiler
  end
end

#install!Object



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/cocoapods-kz/native/installer.rb', line 45

def install!
  original_install!

  if KZ::KZGlobalHelper.instance.kz_pod_enable
    KZ::KZGlobalHelper.instance.write_lock_file

    current_pods_pbxproj_path = self.pods_project.path + 'project.pbxproj'
    temp_pods_pbxproj_path = KZ::KZ_POD_CONFIG_POD_TEMPDIR + 'project.pbxproj'
    system("(sleep 1 && ruby '#{KZ::KZ_FEFRESH_PODS_PBXPROJ}' '#{current_pods_pbxproj_path}' '#{temp_pods_pbxproj_path}') &")
  end
end

#integrateObject



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/cocoapods-kz/native/installer.rb', line 31

def integrate
  if KZ::KZGlobalHelper.instance.kz_pod_enable
    # hmap的创建需要在download之后,integrate之前
    KZ::KZGlobalHelper.instance.kz_generator.create_hamp

    if KZ::KZGlobalHelper.instance.on_demand_resources_info.enable
      KZ::KZGlobalHelper.instance.kz_generator.create_on_demand_resources
    end
  end
  original_integrate
end

#original_download_dependenciesObject



8
# File 'lib/cocoapods-kz/native/installer.rb', line 8

alias_method :original_download_dependencies, :download_dependencies

#original_install!Object

pod结束



44
# File 'lib/cocoapods-kz/native/installer.rb', line 44

alias_method :original_install!, :install!

#original_integrateObject



30
# File 'lib/cocoapods-kz/native/installer.rb', line 30

alias_method :original_integrate, :integrate