cocoapods-project-hmap 0.0.3 → 0.0.4
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 +4 -4
- data/README_en.md +1 -1
- data/lib/cocoapods-project-hmap/gem_version.rb +1 -1
- data/lib/cocoapods-project-hmap/hmap_generator.rb +9 -4
- data/lib/cocoapods-project-hmap/pod_target.rb +8 -0
- data/lib/cocoapods-project-hmap/post_install_hook_context.rb +1 -1
- data/lib/cocoapods_plugin.rb +10 -6
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 719f141210db21b4b5c6da7306e89b80a26d95f79dc76200a7cc8fbdb3fca4dd
|
4
|
+
data.tar.gz: f7b5dbe63c8608e2bb799f398b67600511200a54dd451ecd1147cd3d9453a998
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32c4d89413493dd1e3fe8dc60ea3889b88fec1a80d1e454843ed802a1c7c61a0eaa3b731454fdc614d37d5f9fbe1dcd5e7ed608d5a363241d3a9d1ede305298a
|
7
|
+
data.tar.gz: 04146c01179a02613cb925fa838d044867b59149729ca90d7cc0e39e37c33f54697138e36be3282fcc0170873514dcaedde943e90a72211ab1e4c2982e884d8f
|
data/README_en.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# cocoapods-project-hmap
|
2
2
|
|
3
|
-
|
3
|
+
A cocoapods plugin to improve compilation speed at preprosessor phase by using hmap instead of file paths for header searching. The idea comes from [《一款可以让大型iOS工程编译速度提升50%的工具》](https://tech.meituan.com/2021/02/25/cocoapods-hmap-prebuilt.html)
|
4
4
|
|
5
5
|
## Benchmark
|
6
6
|
|
@@ -9,7 +9,7 @@ module ProjectHeaderMap
|
|
9
9
|
@hmap = Hash.new
|
10
10
|
end
|
11
11
|
# header_mapping : [Hash{FileAccessor => Hash}] Hash of file accessors by header mappings.
|
12
|
-
def add_hmap_with_header_mapping(header_mapping, type, target_name=nil)
|
12
|
+
def add_hmap_with_header_mapping(header_mapping, type, target_name=nil, module_name=nil)
|
13
13
|
header_mapping.each do |facc, headers|
|
14
14
|
headers.each do |key, value|
|
15
15
|
value.each do |path|
|
@@ -22,9 +22,14 @@ module ProjectHeaderMap
|
|
22
22
|
# import with quote
|
23
23
|
@hmap[name] = path_info
|
24
24
|
end
|
25
|
-
if type & ANGLE_BRACKET > 0
|
26
|
-
|
27
|
-
|
25
|
+
if type & ANGLE_BRACKET > 0
|
26
|
+
if target_name != nil
|
27
|
+
# import with angle bracket
|
28
|
+
@hmap["#{target_name}/#{name}"] = path_info
|
29
|
+
end
|
30
|
+
if module_name != nil && module_name != target_name
|
31
|
+
@hmap["#{module_name}/#{name}"] = path_info
|
32
|
+
end
|
28
33
|
end
|
29
34
|
end
|
30
35
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# !/usr/bin/env ruby
|
2
2
|
require 'cocoapods-project-hmap/xcconfig'
|
3
|
+
require 'cocoapods-project-hmap/hmap_generator'
|
3
4
|
|
4
5
|
module Pod
|
5
6
|
class PodTarget
|
@@ -26,6 +27,13 @@ module Pod
|
|
26
27
|
puts 'Unknown build settings'.red
|
27
28
|
end
|
28
29
|
end
|
30
|
+
def recursively_add_dependent_headers_to_hmap(hmap, generate_type)
|
31
|
+
dependent_targets.each do |depend_target|
|
32
|
+
# set public header for dependent target
|
33
|
+
hmap.add_hmap_with_header_mapping(depend_target.public_header_mappings_by_file_accessor, generate_type, depend_target.name, depend_target.product_module_name)
|
34
|
+
depend_target.recursively_add_dependent_headers_to_hmap(hmap, generate_type)
|
35
|
+
end
|
36
|
+
end
|
29
37
|
end
|
30
38
|
class AggregateTarget
|
31
39
|
def reset_header_search_with_relative_hmap_path(hmap_path)
|
@@ -28,7 +28,7 @@ module Pod
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
else
|
31
|
-
# PostInstallHooksContext
|
31
|
+
# PostInstallHooksContext inherited from BaseContext, just override `generate`
|
32
32
|
def self.generate(sandbox, pods_project, aggregate_targets)
|
33
33
|
context = super
|
34
34
|
UI.info "- generate method of post install hook context override"
|
data/lib/cocoapods_plugin.rb
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
require 'cocoapods-project-hmap/podfile_dsl'
|
4
4
|
require 'cocoapods-project-hmap/pod_target'
|
5
5
|
require 'cocoapods-project-hmap/post_install_hook_context'
|
6
|
-
require 'cocoapods-project-hmap/hmap_generator'
|
7
6
|
|
8
7
|
module ProjectHeaderMap
|
9
8
|
Pod::HooksManager.register('cocoapods-project-hmap', :post_install) do |post_context|
|
@@ -18,14 +17,19 @@ module ProjectHeaderMap
|
|
18
17
|
Pod::UI.message "- hanlding headers of aggregate target :#{one.name}".green
|
19
18
|
one.pod_targets.each do |target|
|
20
19
|
Pod::UI.message "- hanlding headers of target :#{target.name}"
|
21
|
-
|
20
|
+
# There is no need to add headers of dynamic framework to hmap.
|
21
|
+
unless target.defines_module? && target.requires_frameworks?
|
22
|
+
pods_hmap.add_hmap_with_header_mapping(target.public_header_mappings_by_file_accessor, generate_type, target.name, target.product_module_name)
|
23
|
+
else
|
24
|
+
Pod::UI.message "- skip dynamic framework: #{target.name}"
|
25
|
+
end
|
26
|
+
|
22
27
|
unless $hmap_black_pod_list.include?(target.name) || $prebuilt_hmap_for_pod_targets == false
|
23
28
|
target_hmap = HmapGenerator.new
|
24
29
|
# set project header for current target
|
25
|
-
target_hmap.add_hmap_with_header_mapping(target.header_mappings_by_file_accessor, HmapGenerator::BOTH, target.name)
|
26
|
-
target.
|
27
|
-
|
28
|
-
target_hmap.add_hmap_with_header_mapping(depend_target.public_header_mappings_by_file_accessor, generate_type, depend_target.name)
|
30
|
+
target_hmap.add_hmap_with_header_mapping(target.header_mappings_by_file_accessor, HmapGenerator::BOTH, target.name, target.product_module_name)
|
31
|
+
if target.respond_to?(:recursively_add_dependent_headers_to_hmap)
|
32
|
+
target.recursively_add_dependent_headers_to_hmap(target_hmap, generate_type)
|
29
33
|
end
|
30
34
|
|
31
35
|
target_hmap_name="#{target.name}.hmap"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-project-hmap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- chenxGen
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -65,7 +65,7 @@ homepage: https://github.com/chenxGen/cocoapods-project-hmap
|
|
65
65
|
licenses:
|
66
66
|
- MIT
|
67
67
|
metadata: {}
|
68
|
-
post_install_message:
|
68
|
+
post_install_message:
|
69
69
|
rdoc_options: []
|
70
70
|
require_paths:
|
71
71
|
- lib
|
@@ -80,8 +80,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: '0'
|
82
82
|
requirements: []
|
83
|
-
rubygems_version: 3.
|
84
|
-
signing_key:
|
83
|
+
rubygems_version: 3.1.4
|
84
|
+
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: A cocoapods plugin which using hmap instead of header search paths to improve
|
87
87
|
preprocess time.
|