Class: Xcodeproj::Config
- Inherits:
-
Object
- Object
- Xcodeproj::Config
- Defined in:
- lib/cocoapods-project-hmap/xcconfig.rb
Instance Method Summary collapse
- #remove_attr_with_key(key) ⇒ Object
- #remove_header_search_path(prebuilt_hmap_target_names = nil) ⇒ Object
- #remove_system_option_in_other_cflags(prebuilt_hmap_target_names = nil) ⇒ Object
- #reset_header_search_with_relative_hmap_path(hmap_path, prebuilt_hmap_target_names = nil) ⇒ Object
- #search_path_should_be_deleted?(search_path, prebuilt_hmap_target_names = nil) ⇒ Boolean
- #set_use_hmap(use = false) ⇒ Object
Instance Method Details
#remove_attr_with_key(key) ⇒ Object
5 6 7 8 9 |
# File 'lib/cocoapods-project-hmap/xcconfig.rb', line 5 def remove_attr_with_key(key) unless key == nil @attributes.delete(key) end end |
#remove_header_search_path(prebuilt_hmap_target_names = nil) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/cocoapods-project-hmap/xcconfig.rb', line 10 def remove_header_search_path(prebuilt_hmap_target_names=nil) header_search_paths = @attributes['HEADER_SEARCH_PATHS'] if header_search_paths new_paths = Array.new header_search_paths.split(' ').each do |p| unless search_path_should_be_deleted?(p, prebuilt_hmap_target_names) 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_option_in_other_cflags(prebuilt_hmap_target_names) end |
#remove_system_option_in_other_cflags(prebuilt_hmap_target_names = nil) ⇒ Object
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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/cocoapods-project-hmap/xcconfig.rb', line 39 def remove_system_option_in_other_cflags(prebuilt_hmap_target_names=nil) # ---------------------------------------------- # -I<dir>, --include-directory <arg>, --include-directory=<arg> # Add directory to include search path. For C++ inputs, if there are multiple -I options, # these directories are searched in the order they are given before the standard system directories are searched. # If the same directory is in the SYSTEM include search paths, for example if also specified with -isystem, the -I option will be ignored # # -isystem<directory> # Add directory to SYSTEM include search path # ---------------------------------------------- flags = @attributes['OTHER_CFLAGS'] if flags new_flags = '' is_isystem_flag = false flags.split(' ').each do |substr| append_str = substr # Previous flag is `isystem` if is_isystem_flag is_isystem_flag = false if search_path_should_be_deleted?(append_str, prebuilt_hmap_target_names) next else # recover append_str = "-isystem #{append_str}" end end if append_str == '-isystem' is_isystem_flag = true next end if new_flags.length > 0 new_flags += ' ' end new_flags += append_str 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, prebuilt_hmap_target_names = nil) ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/cocoapods-project-hmap/xcconfig.rb', line 84 def reset_header_search_with_relative_hmap_path(hmap_path, prebuilt_hmap_target_names=nil) # Delete associate search paths remove_header_search_path(prebuilt_hmap_target_names) # Add hmap file to search path 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 |
#search_path_should_be_deleted?(search_path, prebuilt_hmap_target_names = nil) ⇒ Boolean
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/cocoapods-project-hmap/xcconfig.rb', line 27 def search_path_should_be_deleted?(search_path, prebuilt_hmap_target_names=nil) # Check if the path should be deleted from search list # 1. It must be at the ${PODS_ROOT} directory # 2. It has generated hmap ret = false if search_path.include?('${PODS_ROOT}/Headers') if prebuilt_hmap_target_names ret = prebuilt_hmap_target_names.select { |name| search_path.include?(name) }.empty? == false end end ret end |
#set_use_hmap(use = false) ⇒ Object
95 96 97 |
# File 'lib/cocoapods-project-hmap/xcconfig.rb', line 95 def set_use_hmap(use=false) @attributes['USE_HEADERMAP'] = (use ? 'YES' : 'NO') end |