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.



68
69
70
71
72
73
# File 'lib/hmap/xc/target/target_vfs.rb', line 68

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



94
95
96
97
98
# File 'lib/hmap/xc/target/target_vfs.rb', line 94

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

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

#add_headers_modules(config) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/hmap/xc/target/target_vfs.rb', line 75

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



100
101
102
103
104
105
# File 'lib/hmap/xc/target/target_vfs.rb', line 100

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