module Pod class JxedtPrebuildInstaller < Installer # rubocop:disable Metrics/ClassLength def installation_options # Skip integrating user targets for prebuild Pods project. @installation_options ||= Pod::Installer::InstallationOptions.new( super.to_h.merge(:integrate_targets => false) ) end def generate_pods_index_project! return unless Jxedt.config.create_index_project? Pod::UI.puts "-----------------------------------------" Pod::UI.puts "🚖 生成Pods-Index.xcodeproj,可以直接把工程拖入workspace来查看源码或进行二进制调试" Pod::UI.puts "-----------------------------------------" # 生成index project开始标识 sandbox.index_project_create_stage = true # 只生成pods target工程 cache_analysis_result = analyze_project_cache # 获取缓存中需要生成的pod_targets pod_targets_to_generate = cache_analysis_result.pod_targets_to_generate.clone # 修改标识,这个标识用于修改Target的productName pod_targets_to_generate.each { |target| target.binary_index_enabled = true } # 调用生成project的方法,aggregate_targets传空 create_and_save_projects(pod_targets_to_generate, [], cache_analysis_result.build_configurations, cache_analysis_result.project_object_version) # 恢复sandbox标识 sandbox.index_project_create_stage = false end end end module Pod class Installer # Cleans up the sandbox directory by removing stale target support files and headers. # class SandboxDirCleaner alias_method :old_sandbox_project_dir_names, :sandbox_project_dir_names def sandbox_project_dir_names project_dir_names = old_sandbox_project_dir_names if sandbox.is_a?(Pod::JxedtPrebuildSandbox) # 如果允许生成Pods-Index.xcodeproj,排除这个文件 project_dir_names.reject! { |d| d.basename.to_s =~ /#{sandbox.index_project_name}$/ } if Jxedt.config.create_index_project? end project_dir_names end end end class PodTarget < Target attr_accessor :binary_index_enabled # 修改product module name alias_method :old_product_module_name, :product_module_name def product_module_name name_ = old_product_module_name return "#{name_}_Source" if binary_index_enabled name_ end end end