Class: HMap::HMapFileWriter
- Inherits:
-
Object
- Object
- HMap::HMapFileWriter
- Defined in:
- lib/cocoapods-hmap-prebuilt/hmap_writer.rb
Instance Method Summary collapse
- #gen_hmapfile(aggregate_targets, hmap_dir) ⇒ Object
-
#initialize(context) ⇒ HMapFileWriter
constructor
A new instance of HMapFileWriter.
Constructor Details
#initialize(context) ⇒ HMapFileWriter
Returns a new instance of HMapFileWriter.
10 11 12 13 14 15 |
# File 'lib/cocoapods-hmap-prebuilt/hmap_writer.rb', line 10 def initialize(context) hmap_dir = context.sandbox_root + '/Headers/HMap' aggregate_targets = context.aggregate_targets Dir.mkdir(hmap_dir) if !File.exist?(hmap_dir) gen_hmapfile(aggregate_targets, hmap_dir) end |
Instance Method Details
#gen_hmapfile(aggregate_targets, hmap_dir) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/cocoapods-hmap-prebuilt/hmap_writer.rb', line 17 def gen_hmapfile(aggregate_targets, hmap_dir) aggregate_targets.each do |aggregate_target| pods_hmap = HMap::HMapConstructor.new puts "- generate hmapfile of aggregate target :#{aggregate_target.name}".green aggregate_target.pod_targets.each do |target| puts "- generate hmapfile of pod target :#{target.name}".yellow public_header_mapping = target.public_header_mappings_by_file_accessor pods_hmap.add_hmap_with_header_mapping(public_header_mapping, target.name) unless $skip_hmap_for_pods.include?(target.name) target_hmap = HMap::HMapConstructor.new header_mappings = target.header_mappings_by_file_accessor target_hmap.add_hmap_with_header_mapping(header_mappings, target.name) target.dependent_targets.each do |dependent_target| target_hmap.add_hmap_with_header_mapping(dependent_target.public_header_mappings_by_file_accessor, dependent_target.name) end target_hmap_name = "#{target.name}-prebuilt.hmap" target_hmap_path = hmap_dir + "/#{target_hmap_name}" relative_hmap_path = "Headers/HMap/#{target_hmap_name}" if target_hmap.save_to(target_hmap_path) target.reset_header_search_with_relative_hmap_path(relative_hmap_path) end else puts "- skip generate hmapfile of target :#{target.name}" end end pods_hmap_name = "#{aggregate_target.name}-prebuilt.hmap" pods_hmap_path = hmap_dir + "/#{pods_hmap_name}" relative_hmap_path = "Headers/HMap/#{pods_hmap_name}" if pods_hmap.save_to(pods_hmap_path) aggregate_target.reset_header_search_with_relative_hmap_path(relative_hmap_path) end end end |