Class: HMap::TargetVFS

Inherits:
Object
  • Object
show all
Defined in:
lib/hmap/xc/target/target_vfs.rb

Overview

A collection of Each TargetVFSEntry

Instance Method Summary collapse

Constructor Details

#initialize(public_headers, private_headers, platforms, setting) ⇒ TargetVFS

Returns a new instance of TargetVFS.



64
65
66
67
68
69
# File 'lib/hmap/xc/target/target_vfs.rb', line 64

def initialize(public_headers, private_headers, platforms, setting)
  @setting = setting
  @platforms = platforms
  @public_headers = public_headers
  @private_headers = private_headers
end

Instance Method Details

#add_files(files, virtual_dir) ⇒ Object



90
91
92
93
94
# File 'lib/hmap/xc/target/target_vfs.rb', line 90

def add_files(files, virtual_dir)
  return if files.nil?

  files.map { |file| TargetVFSEntry.new(virtual_dir, file) }
end

#add_headers_modules(config) ⇒ Object



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/hmap/xc/target/target_vfs.rb', line 71

def add_headers_modules(config)
  r_public_paths = []
  r_public_paths += @public_headers
  s_h = config.swift_header_path
  r_public_paths << s_h unless s_h.nil?
  r_private_paths = []
  r_private_paths += @private_headers
  headers = []
  headers += add_files(r_public_paths, config.public_headers_dir)
  headers += add_files(r_private_paths, config.private_headers_dir)
  modules_real_paths = []
  if config.defines_modules?
    modules_real_paths << config.module_path
    modules_real_paths << config.private_module_path unless r_private_paths.empty?
  end
  headers += add_files(modules_real_paths, config.module_dir) || []
  headers
end

#vfs_entrysObject



96
97
98
99
100
101
# File 'lib/hmap/xc/target/target_vfs.rb', line 96

def vfs_entrys
  Hash[@platforms.map do |platform|
    config = TargetPlatformVFS.new(platform, @setting)
    [platform.to_s, add_headers_modules(config)]
  end]
end