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 16 |
# 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 FileUtils.rm_rf(hmap_dir) if File.exist?(hmap_dir) Dir.mkdir(hmap_dir) gen_hmapfile(aggregate_targets, hmap_dir) end |
Instance Method Details
#gen_hmapfile(aggregate_targets, hmap_dir) ⇒ Object
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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/cocoapods-hmap-prebuilt/hmap_writer.rb', line 18 def gen_hmapfile(aggregate_targets, hmap_dir) aggregate_targets.each do |aggregate_target| pods_hmap = HMap::HMapConstructor.new aggregate_target.pod_targets.each do |target| pods_hmap.add_hmap_with_header_mapping(target.public_header_mappings_by_file_accessor, target.name) unless $skip_hmap_for_pods.include?(target.name) target_hmap = HMap::HMapConstructor.new dependent_target_header_search_path_setting = Array.new target_hmap.add_hmap_with_header_mapping(target.header_mappings_by_file_accessor, 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) dependent_target.build_settings.each do |config, setting| dependent_target_xcconfig = setting.xcconfig dependent_target_header_search_paths = dependent_target_xcconfig.attributes['HEADER_SEARCH_PATHS'] dependent_target_header_search_paths.split(' ').each do |path| unless (path.include?('${PODS_ROOT}/Headers') || path.include?('$(inherited)')) dependent_target_header_search_path_setting << path end end end target.dependent_target_header_search_path_setting = dependent_target_header_search_path_setting.uniq 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) puts "- hmapfile of target :#{target.name} save to :#{target_hmap_path}".yellow target.reset_header_search_with_relative_hmap_path(relative_hmap_path) else $fail_generate_hmap_pods << target.name 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) puts "- hmapfile of target :#{aggregate_target.name} save to :#{pods_hmap_path}".green aggregate_target.reset_header_search_with_relative_hmap_path(relative_hmap_path) end end end |