Class: Xcodeproj::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-hmap-prebuilt/pod_xcconfig.rb

Instance Method Summary collapse

Instance Method Details

#remove_attr_with_key(key) ⇒ Object



5
6
7
8
9
# File 'lib/cocoapods-hmap-prebuilt/pod_xcconfig.rb', line 5

def remove_attr_with_key(key)
  if key != nil
    @attributes.delete(key)
  end
end

#remove_header_search_pathObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/cocoapods-hmap-prebuilt/pod_xcconfig.rb', line 11

def remove_header_search_path
  header_search_paths = @attributes['HEADER_SEARCH_PATHS']
  if header_search_paths
    new_paths = Array.new
    header_search_paths.split(' ').each do |path|
      unless path.include?('${PODS_ROOT}/Headers')
        new_paths << p
      end
    end
    if new_paths.size > 0
      @attributes['HEADER_SEARCH_PATHS'] = new_paths.join(' ')
    else
      remove_attr_with_key('HEADER_SEARCH_PATHS')
    end
  end
  remove_system_options_in_other_cflags
end

#remove_system_options_in_other_cflagsObject



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
# File 'lib/cocoapods-hmap-prebuilt/pod_xcconfig.rb', line 29

def remove_system_options_in_other_cflags
  flags = @attributes['OTHER_CFLAGS']
  if flags
    new_flags = ''
    skip = false
    flags.split(' ').each do |substr|
      if skip
        skip = false
        next
      end
      if substr == '-isystem'
        skip = true
        next
      end
      if new_flags.length > 0
        new_flags += ' '
      end
      new_flags += substr
    end
    if new_flags.length > 0
      @attributes['OTHER_CFLAGS'] = new_flags
    else
      remove_attr_with_key('OTHER_CFLAGS')
    end
  end
end

#reset_header_search_with_relative_hmap_path(hmap_path) ⇒ Object



56
57
58
59
60
61
62
63
64
65
# File 'lib/cocoapods-hmap-prebuilt/pod_xcconfig.rb', line 56

def reset_header_search_with_relative_hmap_path(hmap_path)
  remove_header_search_path
  # add build flags
  new_paths = Array["${PODS_ROOT}/#{hmap_path}"]
  header_search_paths = @attributes['HEADER_SEARCH_PATHS']
  if header_search_paths
    new_paths.concat(header_search_paths.split(' '))
  end
  @attributes['HEADER_SEARCH_PATHS'] = new_paths.join(' ')
end

#set_use_hmap(use_hmap = false) ⇒ Object



67
68
69
# File 'lib/cocoapods-hmap-prebuilt/pod_xcconfig.rb', line 67

def set_use_hmap(use_hmap = false)
  @attributes['USE_HEADERMAP'] = (use_hmap ? 'YES' : 'NO')
end