Module: HMap::Target::Helper

Includes:
HeaderType
Included in:
HMap::Target
Defined in:
lib/hmap/xc/target/target_helper.rb

Instance Method Summary collapse

Methods included from HeaderType

#headers_hash, #private_entrys, #project_entrys, #public_entrys, #use_vfs?

Instance Method Details

#app_target?Boolean

Returns:

  • (Boolean)


101
102
103
# File 'lib/hmap/xc/target/target_helper.rb', line 101

def app_target?
  Xcodeproj::Constants::PRODUCT_UTI_EXTENSIONS[target.symbol_type] == 'app'
end

#build_as_framework?Boolean

Returns:

  • (Boolean)


105
106
107
# File 'lib/hmap/xc/target/target_helper.rb', line 105

def build_as_framework?
  PBXHelper.build_as_framework?(target)
end

#build_as_framework_swift?Boolean

Returns:

  • (Boolean)


109
110
111
# File 'lib/hmap/xc/target/target_helper.rb', line 109

def build_as_framework_swift?
  uses_swift? && build_as_framework?
end

#build_dirObject



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

def build_dir
  return @build_dir if defined?(@build_dir)

  b_d = build_setting_paths.none? { |path| XCConfig.new(path).attributes[Constants::CONFIGURATION_BUILD_DIR].nil? }
  @build_dir = target_name if b_d
end

#build_rootObject



63
64
65
# File 'lib/hmap/xc/target/target_helper.rb', line 63

def build_root
  project.build_root
end

#contextObject



126
127
128
129
130
131
132
133
134
135
136
# File 'lib/hmap/xc/target/target_helper.rb', line 126

def context
  TargetContext.new(build_root,
                    temp_dir,
                    hmap_root,
                    temp_name,
                    build_dir,
                    product_name,
                    full_product_name,
                    defines_module?,
                    build_as_framework_swift?)
end

#defines_module?Boolean

Returns:

  • (Boolean)


119
120
121
122
123
124
# File 'lib/hmap/xc/target/target_helper.rb', line 119

def defines_module?
  return @defines_module if defined?(@defines_module)
  return @defines_module = true if build_as_framework?

  @defines_module = PBXHelper.defines_module?(target)
end

#full_product_nameObject



82
83
84
# File 'lib/hmap/xc/target/target_helper.rb', line 82

def full_product_name
  target.product_reference.instance_variable_get('@simple_attributes_hash')['path'] || ''
end

#hmap_rootObject



67
68
69
# File 'lib/hmap/xc/target/target_helper.rb', line 67

def hmap_root
  project.hmap_root
end

#product_nameObject



75
76
77
78
79
80
# File 'lib/hmap/xc/target/target_helper.rb', line 75

def product_name
  product_name = target.build_settings(target.build_configurations.first.name)['PRODUCT_NAME']
  return target_name.gsub(/-/, '_') if product_name.nil? || product_name.include?('TARGET_NAME')

  product_name
end

#target_nameObject



71
72
73
# File 'lib/hmap/xc/target/target_helper.rb', line 71

def target_name
  target.name
end

#temp_dirObject



90
91
92
# File 'lib/hmap/xc/target/target_helper.rb', line 90

def temp_dir
  project.temp_dir
end

#temp_nameObject



86
87
88
# File 'lib/hmap/xc/target/target_helper.rb', line 86

def temp_name
  "#{target_name}.build"
end

#uses_swift?Boolean

Returns:

  • (Boolean)


113
114
115
116
117
# File 'lib/hmap/xc/target/target_helper.rb', line 113

def uses_swift?
  return @uses_swift if defined?(@uses_swift)

  @uses_swift = PBXHelper.uses_swift?(target)
end