cocoapods-mapfile 0.2.6.2 → 0.2.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3413fccd914b1bc1a758ef738dc08b60601ec6070f9559789489434d7f28922f
4
- data.tar.gz: 1d8f09ac5c6d105fa64c9b15e7a634106fd640795752911781930bec64965ce0
3
+ metadata.gz: e976ef653409840f3071bf38d444adde2bf7fd3c3c3b4b5cf3306749e481e204
4
+ data.tar.gz: 76a41c0215836e6865cb3b8f4de6ac455a4698c1d86e3cc864dc52288c1a1581
5
5
  SHA512:
6
- metadata.gz: 92916dac70c8cc47fb01673cecaab625a34c59a395f52c136d124a4de3cd3e89f81489797680da8bbc05ded32883f6f89eb3a565e92fc9fa06de814e9306d434
7
- data.tar.gz: ef1fe10382fd8522fd96da6cd9dce26e6590f2348ef3b7ab178b4e6989d76b9e8481208ad1694899da7deb30d5967903ce1223e86b579d5d51da02069f170d17
6
+ metadata.gz: f778fbad37bf41df0f26bd337c54babc8af7adb887cc64947aa90a00b3cb998c9fcae367c2ae3b3ab852e2213e08c15d0afe1c07dcccbd6d6808b1a2b4fe7979
7
+ data.tar.gz: 49a92092bdd8ea77ca0c22a8d251bf168b36eb17f0b10f1b6609e7d7cf914f124c3d25016f8b392dd4b1e4370821fe1c9a9f2ecb0eb0abe476d1056ad0114d8a
@@ -39,8 +39,8 @@ module HMap
39
39
  # PROJECT_TEMP_DIR, CONFIGURATION_EFFECTIVE_PLATFORM,
40
40
  # TARGET_TEMP_DIR].join('/')
41
41
  HMAP_TARGET_ROOT = [SRCROOT, HMAP_DIR,
42
- PROJECT_TEMP_DIR, CONFIGURATION_EFFECTIVE_PLATFORM,
43
- TARGET_TEMP_DIR].join('/')
42
+ PROJECT_TEMP_DIR, CONFIGURATION_EFFECTIVE_PLATFORM,
43
+ TARGET_TEMP_DIR].join('/')
44
44
 
45
45
  HMAP_GEN_DIR_ATTRIBUTE = { HMAP_GEN_DIR => HMAP_TARGET_ROOT }
46
46
 
@@ -101,23 +101,23 @@ module HMap
101
101
  xc_filenames[type]
102
102
  end
103
103
 
104
- def hmap_build_settings(build_as_framework)
105
- build_settings(build_as_framework)
104
+ def hmap_build_settings
105
+ build_settings
106
106
  end
107
107
 
108
108
  private
109
109
 
110
- def build_settings(build_as_framework)
111
- return @build_as_framework[build_as_framework] unless @build_as_framework[build_as_framework].nil?
110
+ def build_settings
111
+ return @build_settings if defined? @build_settings
112
112
 
113
113
  attributes = HMAP_GEN_DIR_ATTRIBUTE
114
- attributes[HEADER_SEARCH_PATHS] = build_setting_values_i(build_as_framework)
114
+ attributes[HEADER_SEARCH_PATHS] = build_setting_values_i
115
115
  attributes[OTHER_CFLAGS] = build_setting_values_c
116
116
  attributes[OTHER_CPLUSPLUSFLAGS] = build_setting_values_c
117
117
  attributes[OTHER_SWIFT_FLAGS] = build_setting_values_s
118
- attributes[USER_HEADER_SEARCH_PATHS] = build_setting_values_iquote
118
+ # attributes[USER_HEADER_SEARCH_PATHS] = build_setting_values_iquote
119
119
  attributes[USE_HEADERMAP] = 'NO'
120
- @build_as_framework[build_as_framework] = attributes
120
+ @build_settings = attributes
121
121
  end
122
122
 
123
123
  def filenames
@@ -137,12 +137,16 @@ module HMap
137
137
  %i[all_non_framework_target_headers own_target_headers all_product_headers project_headers].map do |type|
138
138
  key = build_setting_keys[type]
139
139
  value = xc_filenames[type]
140
- ["-Xcc -#{key}", "-Xcc \"#{HMAP_GEN_DIR_VALUE}/#{value}\""].join(' ')
140
+ if key == :I
141
+ "-Xcc -#{key}\"#{HMAP_GEN_DIR_VALUE}/#{value}\""
142
+ else
143
+ "-Xcc -#{key} -Xcc \"#{HMAP_GEN_DIR_VALUE}/#{value}\""
144
+ end
141
145
  end.join(' ')
142
146
  end
143
147
 
144
- def build_setting_values_i(build_as_framework)
145
- %i[all_non_framework_target_headers own_target_headers].map do |type|
148
+ def build_setting_values_i
149
+ %i[all_non_framework_target_headers own_target_headers project_headers].map do |type|
146
150
  value = xc_filenames[type]
147
151
  "\"#{HMAP_GEN_DIR_VALUE}/#{value}\""
148
152
  end.join(' ')
@@ -199,8 +203,8 @@ module HMap
199
203
  [type, case type
200
204
  when :all_product_headers then file_name
201
205
  else
202
- "#{file_name}"
203
- # "#{Constants::PRODUCT_NAME_VALUE}-#{file_name}"
206
+ # file_name.to_s
207
+ "#{Constants::PRODUCT_NAME_VALUE}-#{file_name}"
204
208
  end]
205
209
  end]
206
210
  end
@@ -1,5 +1,5 @@
1
1
  module HMap
2
2
  # The version of the hmapfile command line tool.
3
3
  #
4
- VERSION = '0.2.6.2'.freeze unless defined? HMap::VERSION
4
+ VERSION = '0.2.7.0'.freeze unless defined? HMap::VERSION
5
5
  end
@@ -53,7 +53,7 @@ module HMap
53
53
  return @file_name if defined? @file_name
54
54
 
55
55
  product_name = @context.product_name if @context.respond_to? :product_name
56
- @file_name = Constants.instance.full_hmap_filename(type)
56
+ @file_name = Constants.instance.full_hmap_filename(type, product_name)
57
57
  end
58
58
 
59
59
  def hmap_filepath(need_platform)
@@ -28,7 +28,7 @@ module HMap
28
28
 
29
29
  def save_hmap_settings!
30
30
  xcconfig_paths.each do |path|
31
- settings = Constants.instance.hmap_build_settings(build_as_framework?)
31
+ settings = Constants.instance.hmap_build_settings
32
32
  XcodeprojHelper.new(path).add_build_settings_and_save(settings, use_origin: Resolver.instance.use_origin)
33
33
  end
34
34
  end
@@ -42,24 +42,38 @@ module HMap
42
42
  def xcconfig_paths
43
43
  return @xcconfig_paths if defined?(@xcconfig_paths)
44
44
 
45
- @xcconfig_paths = target.build_configuration_list.build_configurations.flat_map do |configuration|
45
+ @xcconfig_paths = target.build_configurations.flat_map do |configuration|
46
46
  if configuration.is_a?(Constants::XCBuildConfiguration)
47
47
  bcr = configuration.base_configuration_reference
48
- # if bcr.nil?
49
- # ab_path = Pathname(project.project_dir + "hmap-#{target_name}.#{configuration.name}.xcconfig")
50
- # File.new(ab_path, 'w') unless ab_path.exist?
51
- # xc_ref = target.project.new_file(ab_path)
52
- # configuration.base_configuration_reference = xc_ref
53
- # target.project.save
54
- # ab_path
55
- # else
56
48
  unless bcr.nil?
57
49
  s_path = PBXHelper.group_paths(bcr)
58
50
  x = bcr.instance_variable_get('@simple_attributes_hash')['path'] || ''
59
- File.expand_path File.join(project.project_dir, s_path, x)
51
+ path = File.expand_path(File.join(project.project_dir, s_path, x))
52
+ xc = XCConfig.new(path)
53
+ inc = xc.includes_paths
54
+ path if inc.empty? || project.workspace.xcconfig_paths.none? { |pa| inc.include?(pa) }
60
55
  end
61
56
  end
62
57
  end.compact
58
+
59
+ # @xcconfig_paths = target.build_configuration_list.build_configurations.flat_map do |configuration|
60
+ # if configuration.is_a?(Constants::XCBuildConfiguration)
61
+ # bcr = configuration.base_configuration_reference
62
+ # # if bcr.nil?
63
+ # # ab_path = Pathname(project.project_dir + "hmap-#{target_name}.#{configuration.name}.xcconfig")
64
+ # # File.new(ab_path, 'w') unless ab_path.exist?
65
+ # # xc_ref = target.project.new_file(ab_path)
66
+ # # configuration.base_configuration_reference = xc_ref
67
+ # # target.project.save
68
+ # # ab_path
69
+ # # else
70
+ # unless bcr.nil?
71
+ # s_path = PBXHelper.group_paths(bcr)
72
+ # x = bcr.instance_variable_get('@simple_attributes_hash')['path'] || ''
73
+ # File.expand_path File.join(project.project_dir, s_path, x)
74
+ # end
75
+ # end
76
+ # end.compact
63
77
  end
64
78
  end
65
79
  end
@@ -16,37 +16,45 @@ module HMap
16
16
  define_method(:all_non_framework_target_headers) do
17
17
  return if build_as_framework?
18
18
 
19
+ return @all_non_framework_target_headers if defined? @all_non_framework_target_headers
20
+
19
21
  p_h = public_entrys + private_entrys
20
- p_h.inject({}) do |sum, entry|
22
+ @all_non_framework_target_headers = p_h.inject({}) do |sum, entry|
21
23
  sum.merge!(entry.full_module_buckets(product_name)) { |_, v1, _| v1 }
22
24
  end
23
25
  end
24
26
 
25
27
  # all_targets include header full module path
26
28
  define_method(:all_target_headers) do
29
+ return @all_target_headers if defined? @all_target_headers
30
+
27
31
  p_h = public_entrys + private_entrys
28
- p_h.inject({}) do |sum, entry|
32
+ @all_target_headers = p_h.inject({}) do |sum, entry|
29
33
  sum.merge!(entry.module_buckets(product_name)) { |_, v1, _| v1 }
30
34
  sum.merge!(entry.full_module_buckets(product_name)) { |_, v1, _| v1 }
31
35
  end
32
36
  end
33
37
 
34
38
  define_method(:project_headers) do
39
+ return @project_headers if defined? @project_headers
40
+
35
41
  p_h = public_entrys + private_entrys
36
42
  hs = p_h.inject({}) do |sum, entry|
37
43
  sum.merge!(entry.module_buckets(product_name)) { |_, v1, _| v1 }
38
44
  end
39
- project_entrys.inject(hs) do |sum, entry|
45
+ @project_headers = project_entrys.inject(hs) do |sum, entry|
40
46
  sum.merge!(entry.project_buckets_extra) { |_, v1, _| v1 }
41
47
  end
42
48
  end
43
49
 
44
50
  define_method(:own_target_headers) do
51
+ return @own_target_headers if defined? @own_target_headers
52
+
45
53
  headers = public_entrys + private_entrys
46
54
  hs = headers.inject({}) do |sum, entry|
47
55
  sum.merge!(entry.module_buckets(product_name)) { |_, v1, _| v1 }
48
56
  end
49
- project_entrys.inject(hs) do |sum, entry|
57
+ @own_target_headers = project_entrys.inject(hs) do |sum, entry|
50
58
  sum.merge!(entry.project_buckets) { |_, v1, _| v1 }
51
59
  sum.merge!(entry.full_module_buckets(product_name)) { |_, v1, _| v1 }
52
60
  end
@@ -65,7 +73,10 @@ module HMap
65
73
  end
66
74
 
67
75
  def product_name
68
- target.product_name.gsub(/[-]/, '_')
76
+ product_name = target.build_settings(target.build_configurations.first.name)['PRODUCT_NAME']
77
+ return target_name.gsub(/-/, '_') if product_name.nil? || product_name.include?('TARGET_NAME')
78
+
79
+ product_name
69
80
  end
70
81
 
71
82
  def full_product_name
@@ -83,13 +94,14 @@ module HMap
83
94
  def build_dir
84
95
  return @build_dir if defined?(@build_dir)
85
96
 
86
- b_d = xcconfig_paths.any? do |path|
87
- xc = XCConfig.new(path)
88
- !xc.attributes[Constants::CONFIGURATION_BUILD_DIR].nil?
89
- end
97
+ b_d = xcconfig_paths.none? { |path| XCConfig.new(path).attributes[Constants::CONFIGURATION_BUILD_DIR].nil? }
90
98
  @build_dir = target_name if b_d
91
99
  end
92
100
 
101
+ def app_target?
102
+ Xcodeproj::Constants::PRODUCT_UTI_EXTENSIONS[target.symbol_type] == 'app'
103
+ end
104
+
93
105
  def build_as_framework?
94
106
  PBXHelper.build_as_framework?(target)
95
107
  end
@@ -37,6 +37,11 @@ module HMap
37
37
  #
38
38
  attr_accessor :attributes
39
39
 
40
+ # @return [Array] The list of the configuration files included by this
41
+ # configuration file (`#include "SomeConfig"`).
42
+ #
43
+ attr_accessor :includes_paths
44
+
40
45
  # @return [Hash{Symbol => Set<String>}] The other linker flags by key.
41
46
  # Xcodeproj handles them in a dedicated way to prevent duplication
42
47
  # of the libraries and of the frameworks.
@@ -44,7 +49,9 @@ module HMap
44
49
  def initialize(xcconfig_hash_or_file = {})
45
50
  @attributes = {}
46
51
  @includes = []
52
+ @include_attributes = {}
47
53
  merge!(extract_hash(xcconfig_hash_or_file))
54
+ @includes_paths = @includes.map { |i| File.expand_path(i, @filepath.dirname) }
48
55
  end
49
56
 
50
57
  def inspect
@@ -52,7 +59,7 @@ module HMap
52
59
  end
53
60
 
54
61
  def ==(other)
55
- other.attributes == attributes
62
+ other.attributes == attributes && other.includes_paths = @includes_paths
56
63
  end
57
64
 
58
65
  # @!group Serialization
@@ -98,8 +105,6 @@ module HMap
98
105
  # @return [Hash] The hash representation
99
106
  #
100
107
  def to_hash(prefix = nil)
101
- list = []
102
-
103
108
  result = attributes.dup
104
109
  result.reject! { |_, v| INHERITED.any? { |i| i == v.to_s.strip } }
105
110
  if prefix
@@ -191,14 +196,14 @@ module HMap
191
196
  hash = {}
192
197
  string.split("\n").each do |line|
193
198
  uncommented_line = strip_comment(line)
194
- if include = extract_include(uncommented_line)
195
- @includes.push normalized_xcconfig_path(include)
196
- else
199
+ e = extract_include(uncommented_line)
200
+ if e.nil?
197
201
  key, value = extract_key_value(uncommented_line)
198
202
  next unless key
199
-
200
203
  value.gsub!(INHERITED_REGEXP) { |m| hash.fetch(key, m) }
201
204
  hash[key] = value
205
+ else
206
+ @includes.push normalized_xcconfig_path(e)
202
207
  end
203
208
  end
204
209
  hash
@@ -40,10 +40,11 @@ module HMap
40
40
  @xcconfig.attributes[key] = value
41
41
  else
42
42
  save_origin = save_build_setting(key)
43
- e_value = value
44
- e_value = "#{e_value} ${#{save_xckey(key)}} " if use_origin && !save_origin.nil?
45
- @xcconfig.attributes[hmap_xckey(key)] = e_value
46
- @xcconfig.attributes[key] = "$(inherited) ${#{hmap_xckey(key)}}"
43
+ value = "#{value} ${#{save_xckey(key)}} " if use_origin && !save_origin.nil?
44
+ @xcconfig.attributes[hmap_xckey(key)] = value
45
+ h_value = "${#{hmap_xckey(key)}}"
46
+ h_value += ' $(inherited)' unless key == Constants::USE_HEADERMAP
47
+ @xcconfig.attributes[key] = h_value
47
48
  end
48
49
  end
49
50
 
@@ -37,6 +37,13 @@ module HMap
37
37
  hs = targets.inject({}) do |sum, entry|
38
38
  sum.merge!(entry.project_headers) { |_, v1, _| v1 }
39
39
  end
40
+ # if targets.any?(&:app_target?)
41
+ # workspace.projects.each do |pr|
42
+ # next if pr == self
43
+
44
+ # hs.merge!(pr.project_headers) { |_, v1, _| v1 }
45
+ # end
46
+ # end
40
47
  @project_headers = project_entrys.inject(hs) do |sum, entry|
41
48
  sum.merge!(entry.project_buckets_extra) { |_, v1, _| v1 }
42
49
  end
@@ -82,5 +82,24 @@ module HMap
82
82
  sum.merge!(entry.all_target_headers) { |_, v1, _| v1 }
83
83
  end
84
84
  end
85
+
86
+ def xcconfig_paths
87
+ return @xcconfig_paths if defined?(@xcconfig_paths)
88
+
89
+ @xcconfig_paths = projects.flat_map do |project|
90
+ project.targets.flat_map do |target|
91
+ target.target.build_configurations.map do |configuration|
92
+ next unless configuration.is_a?(Constants::XCBuildConfiguration)
93
+
94
+ bcr = configuration.base_configuration_reference
95
+ next if bcr.nil?
96
+
97
+ s_path = PBXHelper.group_paths(bcr)
98
+ x = bcr.instance_variable_get('@simple_attributes_hash')['path'] || ''
99
+ File.expand_path(File.join(project.project_dir, s_path, x))
100
+ end.compact
101
+ end
102
+ end.uniq
103
+ end
85
104
  end
86
105
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-mapfile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6.2
4
+ version: 0.2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cat1237
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-02 00:00:00.000000000 Z
11
+ date: 2022-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler