class HMap::MapFileWriter

Helper module which returns handle method from MapFileWriter.

Public Class Methods

new(save_origin_header_search_paths, clean_hmap) click to toggle source

@param save_origin_header_search_paths save_origin_header_search_paths @param clean_hmap clean up all hmap setup

# File lib/cocoapods-hmap/hmap_writer.rb, line 36
def initialize(save_origin_header_search_paths, clean_hmap)
  @save_origin_header_search_paths = save_origin_header_search_paths
  @hmap_saver = HMapSaver.new
  @hmap_saver_iquote = HMapSaver.new
  create_mapfile(clean_hmap)
end

Private Instance Methods

create_hmap_vfs_files(pod_targets, hmap_name, hmap_type = :public_header_files) click to toggle source

Cteate hmap files and vfs files

@param [pod_targets] Pods project all target @see Pod#PodTarget @param [hmap_name] -I hmap file name and -iquote hmap file name @param [hmap_type] hmap file contains pod targets header type

# File lib/cocoapods-hmap/hmap_writer.rb, line 92
def create_hmap_vfs_files(pod_targets, hmap_name, hmap_type = :public_header_files)
  pod_targets.each { |target| from_header_mappings(target, hmap_type) }
  Helper::Pods.write_vfs_yaml(pod_targets)
  write_hmap_files(*Helper::Pods.hmap_files_paths(hmap_name))
end
create_mapfile(clean) click to toggle source

Integrates the projects mapfile associated with the App project and Pods project.

@param [clean] clean hmap dir @see podfile @return [void]

# File lib/cocoapods-hmap/hmap_writer.rb, line 51
def create_mapfile(clean)
  puts "Current hmap files dir: #{Helper::Pods.hmap_files_dir}"
  puts "Current vfs files dir: #{Helper::Pods.vfs_files_dir}"
  analyze = PodsSpecification.instance.analyze
  targets = analyze.targets
  pod_targets = analyze.pod_targets
  return if BuildSettingHelper.clean_hmap(clean, targets, pod_targets)

  merge_all_pods_target_headers_mapfile(pod_targets)
  merge_all_target_public_headers_mapfile(targets)
end
from_header_mappings(target, type = :source_files) click to toggle source
# File lib/cocoapods-hmap/hmap_writer.rb, line 63
def from_header_mappings(target, type = :source_files)
  headers = Helper::Pods.header_mappings(target, type)
  headers[HEAD_SEARCH_IQUOTE].each { |value| @hmap_saver_iquote.add_to_buckets(*value) }
  headers[HEAD_SEARCH_I].each { |value| @hmap_saver.add_to_buckets(*value) }
end
merge_all_pods_target_headers_mapfile(pod_targets) click to toggle source
# File lib/cocoapods-hmap/hmap_writer.rb, line 79
def merge_all_pods_target_headers_mapfile(pod_targets)
  hmap_name = 'all-pods-all-header'
  create_hmap_vfs_files(pod_targets, hmap_name, :source_files)
  BuildSettingHelper.change_other_c_flags_xcconfig_build_settings([hmap_name], pod_targets,
                                              save_origin: @save_origin_header_search_paths)
end
merge_all_target_public_headers_mapfile(targets) click to toggle source
# File lib/cocoapods-hmap/hmap_writer.rb, line 69
def merge_all_target_public_headers_mapfile(targets)
  names = targets.map do |target|
    hmap_name = "all-public-#{target.name}"
    create_hmap_vfs_files(target.pod_targets, hmap_name, :public_header_files)
    hmap_name
  end
  BuildSettingHelper.change_other_c_flags_xcconfig_build_settings(names, targets,
                                              save_origin: @save_origin_header_search_paths)
end
write_hmap_files(hmap_path_i, hmap_path_iquote) click to toggle source
# File lib/cocoapods-hmap/hmap_writer.rb, line 98
def write_hmap_files(hmap_path_i, hmap_path_iquote)
  print "\t - Save hmap file to path: "
  puts hmap_path_i.to_s.yellow
  print "\t - Save hmap file to path: "
  puts hmap_path_iquote.to_s.yellow
  @hmap_saver.write_to(hmap_path_i)
  @hmap_saver_iquote.write_to(hmap_path_iquote)
end