cocoapods-hmap-prebuilt 0.0.4 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5b9e2273c9a41c3d7d56211f1571629d9c63708ae26355f2e72e88e8d587e9f
4
- data.tar.gz: 355cd33f067bdbde3352e02c383a7d0af592affa3a8a56b20d659400c805175e
3
+ metadata.gz: fe4c3bd3405bef59144321942032ab36d23823c8e2f504da5734464c01d6deb8
4
+ data.tar.gz: 5b7236e35e1f8e783a2907abd218f090fb0fdb9652e4b9b050665492528372fb
5
5
  SHA512:
6
- metadata.gz: b589b8cca0e612543344468054d5ed3271d2b349134e8a965fc2bef6387b5f7781423a9c4e29e3c02002b89c0ea1b05ee65280e8202063a52038b90ba5b9952e
7
- data.tar.gz: 2cb10dfe6b16e2940624dd34010911a5180c54b718e70259d1ab4dc432c89538c980f9bb0fa3dad84f25315ab15e52f1a7e88bdee136cd03acbdd7158e1d0328
6
+ metadata.gz: fafbb86fe22016979fd023261779b69e5a02d0b9bb8f502bfb11c069fd1aa2438e9251628699bb5a5c09bec4ce3853082e9b7be794673fdeb01077862c4fc49c
7
+ data.tar.gz: 5e50af503a030938dc92ca43b618788a3e3fd944b9a9477187c8fb99e69997488936b175fead468fa709a44eb50b60f5ef2d76f7efe6313d086e008a7a9d4dbd
@@ -1,3 +1,3 @@
1
1
  module CocoapodsHmapPrebuilt
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -10,32 +10,45 @@ module HMap
10
10
  def initialize(context)
11
11
  hmap_dir = context.sandbox_root + '/Headers/HMap'
12
12
  aggregate_targets = context.aggregate_targets
13
- Dir.mkdir(hmap_dir) if !File.exist?(hmap_dir)
13
+ FileUtils.rm_rf(hmap_dir) if File.exist?(hmap_dir)
14
+ Dir.mkdir(hmap_dir)
14
15
  gen_hmapfile(aggregate_targets, hmap_dir)
15
16
  end
16
17
 
17
18
  def gen_hmapfile(aggregate_targets, hmap_dir)
18
19
  aggregate_targets.each do |aggregate_target|
19
20
  pods_hmap = HMap::HMapConstructor.new
20
- puts "- generate hmapfile of aggregate target :#{aggregate_target.name}".green
21
- aggregate_target.pod_targets.each do |target|
22
- puts "- generate hmapfile of pod target :#{target.name}".yellow
23
- public_header_mapping = target.public_header_mappings_by_file_accessor
24
- pods_hmap.add_hmap_with_header_mapping(public_header_mapping, target.name)
25
21
 
22
+ aggregate_target.pod_targets.each do |target|
23
+ pods_hmap.add_hmap_with_header_mapping(target.public_header_mappings_by_file_accessor, target.name)
26
24
  unless $skip_hmap_for_pods.include?(target.name)
27
25
  target_hmap = HMap::HMapConstructor.new
28
- header_mappings = target.header_mappings_by_file_accessor
29
- target_hmap.add_hmap_with_header_mapping(header_mappings, target.name)
26
+ dependent_target_header_search_path_setting = Array.new
27
+ target_hmap.add_hmap_with_header_mapping(target.header_mappings_by_file_accessor, target.name)
28
+
30
29
  target.dependent_targets.each do |dependent_target|
31
30
  target_hmap.add_hmap_with_header_mapping(dependent_target.public_header_mappings_by_file_accessor, dependent_target.name)
31
+
32
+ dependent_target.build_settings.each do |config, setting|
33
+ dependent_target_xcconfig = setting.xcconfig
34
+ dependent_target_header_search_paths = dependent_target_xcconfig.attributes['HEADER_SEARCH_PATHS']
35
+ dependent_target_header_search_paths.split(' ').each do |path|
36
+ unless (path.include?('${PODS_ROOT}/Headers') || path.include?('$(inherited)'))
37
+ dependent_target_header_search_path_setting << path
38
+ end
39
+ end
40
+ end
41
+ target.dependent_target_header_search_path_setting = dependent_target_header_search_path_setting.uniq
32
42
  end
33
43
 
34
44
  target_hmap_name = "#{target.name}-prebuilt.hmap"
35
45
  target_hmap_path = hmap_dir + "/#{target_hmap_name}"
36
46
  relative_hmap_path = "Headers/HMap/#{target_hmap_name}"
37
47
  if target_hmap.save_to(target_hmap_path)
48
+ puts "- hmapfile of target :#{target.name} save to :#{target_hmap_path}".yellow
38
49
  target.reset_header_search_with_relative_hmap_path(relative_hmap_path)
50
+ else
51
+ $fail_generate_hmap_pods << target.name
39
52
  end
40
53
  else
41
54
  puts "- skip generate hmapfile of target :#{target.name}"
@@ -46,6 +59,7 @@ module HMap
46
59
  pods_hmap_path = hmap_dir + "/#{pods_hmap_name}"
47
60
  relative_hmap_path = "Headers/HMap/#{pods_hmap_name}"
48
61
  if pods_hmap.save_to(pods_hmap_path)
62
+ puts "- hmapfile of target :#{aggregate_target.name} save to :#{pods_hmap_path}".green
49
63
  aggregate_target.reset_header_search_with_relative_hmap_path(relative_hmap_path)
50
64
  end
51
65
  end
@@ -1,23 +1,26 @@
1
1
  # !/usr/bin/env ruby
2
2
 
3
3
  require_relative 'pod_xcconfig'
4
+ require_relative 'podfile_dsl'
5
+
6
+ $fail_generate_hmap_pods = []
4
7
 
5
8
  module Pod
6
9
  class PodTarget
10
+ attr_accessor :dependent_target_header_search_path_setting
11
+
7
12
  def reset_header_search_with_relative_hmap_path(hmap_path)
8
13
  if build_settings.instance_of?(Hash)
9
14
  build_settings.each do |config_name, setting|
10
15
  config_file = setting.xcconfig
11
- config_file.reset_header_search_with_relative_hmap_path(hmap_path)
12
- # https://github.com/CocoaPods/CocoaPods/issues/1216
16
+ config_file.reset_header_search_with_relative_hmap_path(hmap_path, @dependent_target_header_search_path_setting)
13
17
  config_file.set_use_hmap(false)
14
18
  config_path = xcconfig_path(config_name)
15
19
  config_file.save_as(config_path)
16
20
  end
17
21
  elsif build_settings.instance_of?(BuildSettings::PodTargetSettings)
18
22
  config_file = build_settings.xcconfig
19
- config_file.reset_header_search_with_relative_hmap_path(hmap_path)
20
- # https://github.com/CocoaPods/CocoaPods/issues/1216
23
+ config_file.reset_header_search_with_relative_hmap_path(hmap_path, @dependent_target_header_search_path_setting)
21
24
  config_file.set_use_hmap(false)
22
25
  config_path = xcconfig_path
23
26
  config_file.save_as(config_path)
@@ -25,16 +28,38 @@ module Pod
25
28
  puts 'Unknown build settings'.red
26
29
  end
27
30
  end
31
+
32
+ def addition_aggregate_hmapfile_to_pod_target(hmap_path)
33
+ if build_settings.instance_of?(Hash)
34
+ build_settings.each do |name, setting|
35
+ config_file = setting.xcconfig
36
+ config_file.addition_aggregate_hmapfile_to_pod_target(hmap_path)
37
+ config_file.save_as(xcconfig_path(name))
38
+ end
39
+ elsif build_settings.instance_of?(BuildSettings::PodTargetSettings)
40
+ config_file = build_settings.xcconfig
41
+ config_file.addition_aggregate_hmapfile_to_pod_target(hmap_path)
42
+ config_file.save_as(xcconfig_path)
43
+ else
44
+ puts 'Unknown build settings'.red
45
+ end
46
+ end
47
+
28
48
  end
29
49
 
30
50
  class AggregateTarget
31
51
  def reset_header_search_with_relative_hmap_path(hmap_path)
32
- # override xcconfig
33
52
  xcconfigs.each do |config_name, config_file|
34
53
  config_file.reset_header_search_with_relative_hmap_path(hmap_path)
35
54
  config_path = xcconfig_path(config_name)
36
55
  config_file.save_as(config_path)
37
56
  end
57
+
58
+ pod_targets.each do |target|
59
+ unless ($skip_hmap_for_pods.include?(target.name) || $fail_generate_hmap_pods.include?(target.name))
60
+ target.addition_aggregate_hmapfile_to_pod_target(hmap_path)
61
+ end
62
+ end
38
63
  end
39
64
  end
40
65
  end
@@ -13,8 +13,8 @@ module Xcodeproj
13
13
  if header_search_paths
14
14
  new_paths = Array.new
15
15
  header_search_paths.split(' ').each do |path|
16
- unless path.include?('${PODS_ROOT}/Headers')
17
- new_paths << p
16
+ unless (path.include?('${PODS_ROOT}/Headers/Public') || path.include?('${PODS_ROOT}/Headers/Private') || path.include?('$(inherited)'))
17
+ new_paths << path
18
18
  end
19
19
  end
20
20
  if new_paths.size > 0
@@ -53,14 +53,26 @@ module Xcodeproj
53
53
  end
54
54
  end
55
55
 
56
- def reset_header_search_with_relative_hmap_path(hmap_path)
56
+ def reset_header_search_with_relative_hmap_path(hmap_path, dependent_header_search_path_setting = nil)
57
57
  remove_header_search_path
58
58
  # add build flags
59
- new_paths = Array["${PODS_ROOT}/#{hmap_path}"]
59
+ new_paths = Array.new
60
+ new_paths << "${PODS_ROOT}/#{hmap_path}"
60
61
  header_search_paths = @attributes['HEADER_SEARCH_PATHS']
61
62
  if header_search_paths
62
63
  new_paths.concat(header_search_paths.split(' '))
63
64
  end
65
+ new_paths.concat(dependent_header_search_path_setting) if dependent_header_search_path_setting
66
+ @attributes['HEADER_SEARCH_PATHS'] = new_paths.join(' ')
67
+ end
68
+
69
+ def addition_aggregate_hmapfile_to_pod_target(hmap_path)
70
+ new_paths = Array.new
71
+ header_search_paths = @attributes['HEADER_SEARCH_PATHS']
72
+ if header_search_paths
73
+ new_paths.concat(header_search_paths.split(' '))
74
+ end
75
+ new_paths << "${PODS_ROOT}/#{hmap_path}"
64
76
  @attributes['HEADER_SEARCH_PATHS'] = new_paths.join(' ')
65
77
  end
66
78
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-hmap-prebuilt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - EricLou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-05 00:00:00.000000000 Z
11
+ date: 2021-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler