cocoapods-kz 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cocoapods-kz/command/install.rb +8 -6
- data/lib/cocoapods-kz/command/kz.rb +1 -0
- data/lib/cocoapods-kz/command/repair.rb +47 -0
- data/lib/cocoapods-kz/command/update.rb +8 -5
- data/lib/cocoapods-kz/gem_version.rb +1 -1
- data/lib/cocoapods-kz/helpers/build_framework_config.rb +5 -0
- data/lib/cocoapods-kz/helpers/create_hamp.rb +36 -14
- data/lib/cocoapods-kz/helpers/global_helper.rb +47 -4
- data/lib/cocoapods-kz/helpers/kz_analyzer.rb +8 -0
- data/lib/cocoapods-kz/helpers/kz_pod_target.rb +20 -3
- data/lib/cocoapods-kz/helpers/repair_dynamic_swift.rb +373 -0
- data/lib/cocoapods-kz/helpers/repair_module_import.rb +122 -0
- data/lib/cocoapods-kz/helpers/xml_build_config.rb +5 -1
- data/lib/cocoapods-kz/native/acknowledgements.rb +8 -15
- data/lib/cocoapods-kz/native/analyzer.rb +1 -3
- data/lib/cocoapods-kz/native/file_accessor.rb +8 -8
- data/lib/cocoapods-kz/native/installer.rb +9 -7
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f85aeb7b3f3ec7afa4fec40b6509b2f1fa599970068a00532874ba299c96a3c
|
4
|
+
data.tar.gz: eac71cb74fad8e788604563a5c10d087523fdaeee86dcd5e4b9edff9b0b645a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d78c400c79c139d5beb99b5c84e349869abec6507ad4d4b720c3ffd956542e207d34ec55e72273496b074a031fb01299ec79f26959e0611a33fd2a2e7c8d1521
|
7
|
+
data.tar.gz: d5d61fdecfb237ba596539559f560747c3fdd3145324f2f069ad0e9f1c418b70786f19656405a3906992d1decea96718201f15c1103149967bea85b242e1dfc9
|
@@ -22,19 +22,21 @@ module Pod
|
|
22
22
|
['--framework', "后面需要跟上pod名(多个pod,使用英文逗号隔开)"],
|
23
23
|
['--code', "后面需要跟上pod名(多个pod,使用英文逗号隔开)"],
|
24
24
|
['--debug', "debug模式,会打印调试日志或生成调试文件"],
|
25
|
+
['--no-framework-update', "不再生成frameowrk"]
|
25
26
|
].concat(super).reject { |(name, _)| name == '--no-repo-update' }
|
26
27
|
end
|
27
28
|
|
28
29
|
def initialize(argv)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
KZ::KZGlobalHelper.instance.analyze_special_parameters(@use_code_tag, @use_framework_tag, argv.arguments!)
|
30
|
+
use_code_tag = argv.flag?('code')
|
31
|
+
use_framework_tag = argv.flag?('framework')
|
32
|
+
help! if use_code_tag && use_framework_tag
|
33
|
+
KZ::KZGlobalHelper.instance.analyze_special_parameters(use_code_tag, use_framework_tag, argv.arguments!)
|
34
34
|
if Pod.match_version?('~> 1.4')
|
35
35
|
KZ::KZGlobalHelper.instance.kz_pod_enable = true
|
36
|
+
KZ::KZGlobalHelper.instance.generate_kz_pod_targets = true
|
36
37
|
end
|
37
|
-
KZ::KZGlobalHelper.instance.debug = true if
|
38
|
+
KZ::KZGlobalHelper.instance.debug = true if argv.flag?('debug')
|
39
|
+
KZ::KZGlobalHelper.instance.disable_generate_framework = true if argv.flag?('no-framework-update')
|
38
40
|
|
39
41
|
super
|
40
42
|
@additional_args = argv.remainder!
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'cocoapods-kz/helpers/repair_dynamic_swift'
|
2
|
+
require 'cocoapods-kz/helpers/repair_module_import'
|
3
|
+
|
4
|
+
module Pod
|
5
|
+
class Command
|
6
|
+
class Kz < Command
|
7
|
+
class Repair < Kz
|
8
|
+
self.summary = 'pod kz repair,用于修复各种不符合规范的场景'
|
9
|
+
|
10
|
+
self.description = <<-DESC
|
11
|
+
结合可选子命令用于执行各种修补脚本
|
12
|
+
DESC
|
13
|
+
|
14
|
+
def self.options
|
15
|
+
[
|
16
|
+
['--module-import', "修复所有头文件import方式,使其支持module导入,如果后面追加指定Pod名,将只修改该Pod"],
|
17
|
+
['--dynamic-swift', "将项目中所有swift添加上OC动态属性,如果后面追加指定Pod名,将只修改该Pod"]
|
18
|
+
]
|
19
|
+
end
|
20
|
+
|
21
|
+
def initialize(argv)
|
22
|
+
help! if argv.arguments == 0
|
23
|
+
@repair_module_import = argv.flag?('module-import')
|
24
|
+
@repair_dynamic_swift = argv.flag?('dynamic-swift')
|
25
|
+
help! if !@repair_module_import && !@repair_dynamic_swift
|
26
|
+
|
27
|
+
KZ::KZGlobalHelper.instance.analyze_special_parameters(true, false, argv.arguments!)
|
28
|
+
KZ::KZGlobalHelper.instance.generate_kz_pod_targets = true
|
29
|
+
|
30
|
+
super
|
31
|
+
end
|
32
|
+
|
33
|
+
def run
|
34
|
+
installer = installer_for_config
|
35
|
+
installer.prepare
|
36
|
+
installer.resolve_dependencies.analyze
|
37
|
+
|
38
|
+
if @repair_dynamic_swift
|
39
|
+
KZ::KZSwiftAttachOCFeature.new.repair
|
40
|
+
else @repair_module_import
|
41
|
+
KZ::KZRepairModuleImport.new(installer.aggregate_targets.first.user_project).repair
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -22,18 +22,21 @@ module Pod
|
|
22
22
|
['--framework', "后面需要跟上pod名(多个pod,使用英文逗号隔开)"],
|
23
23
|
['--code', "后面需要跟上pod名(多个pod,使用英文逗号隔开)"],
|
24
24
|
['--debug', "debug模式,会打印调试日志或生成调试文件"],
|
25
|
+
['--no-framework-update', "不再生成frameowrk"]
|
25
26
|
].concat(super)
|
26
27
|
end
|
27
28
|
|
28
29
|
def initialize(argv)
|
29
|
-
|
30
|
-
|
31
|
-
help! if
|
32
|
-
KZ::KZGlobalHelper.instance.analyze_special_parameters(
|
30
|
+
use_code_tag = argv.flag?('code')
|
31
|
+
use_framework_tag = argv.flag?('framework')
|
32
|
+
help! if use_code_tag && use_framework_tag
|
33
|
+
KZ::KZGlobalHelper.instance.analyze_special_parameters(use_code_tag, use_framework_tag, argv.arguments!)
|
33
34
|
if Pod.match_version?('~> 1.4')
|
34
35
|
KZ::KZGlobalHelper.instance.kz_pod_enable = true
|
36
|
+
KZ::KZGlobalHelper.instance.generate_kz_pod_targets = true
|
35
37
|
end
|
36
|
-
KZ::KZGlobalHelper.instance.debug = true if
|
38
|
+
KZ::KZGlobalHelper.instance.debug = true if argv.flag?('debug')
|
39
|
+
KZ::KZGlobalHelper.instance.disable_generate_framework = true if argv.flag?('no-framework-update')
|
37
40
|
|
38
41
|
super
|
39
42
|
@additional_args = argv.remainder!
|
@@ -23,6 +23,11 @@ fi
|
|
23
23
|
PRODUCT_DIR=${PODS_BUILD_DIR}/Debug-iphoneos/${TARGET_NAME}/${FULL_PRODUCT_NAME}
|
24
24
|
PRODUCT_SIMULATOR_DIR=${PODS_BUILD_DIR}/Debug-iphonesimulator/${TARGET_NAME}/${FULL_PRODUCT_NAME}
|
25
25
|
CURRENT_PRODUCT_DIR=${PODS_CONFIGURATION_BUILD_DIR}/${TARGET_NAME}
|
26
|
+
|
27
|
+
if [ -d "${KZ_FRAMEWORK_CACHE_PATH}" ]; then
|
28
|
+
rm -r "${KZ_FRAMEWORK_CACHE_PATH}"
|
29
|
+
fi
|
30
|
+
mkdir -p "${KZ_FRAMEWORK_CACHE_PATH}"
|
26
31
|
|
27
32
|
if [ -d "${KZ_FRAMEWORK_CACHE_PATH}/${FULL_PRODUCT_NAME}" ]; then
|
28
33
|
rm -r "${KZ_FRAMEWORK_CACHE_PATH}/${FULL_PRODUCT_NAME}"
|
@@ -22,8 +22,8 @@ module KZ
|
|
22
22
|
if File.file?(file_path)
|
23
23
|
yield(file_path) if file_name.end_with?('.h')
|
24
24
|
elsif File.directory?(file_path)
|
25
|
-
traverse_folder(file_path) do |
|
26
|
-
yield(
|
25
|
+
traverse_folder(file_path) do |path|
|
26
|
+
yield(path)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -60,14 +60,14 @@ module KZ
|
|
60
60
|
private_hmap_hash[header_pathname_basename] = header_hmap_value
|
61
61
|
end
|
62
62
|
|
63
|
-
|
63
|
+
unless private_hmap_hash.empty?
|
64
64
|
save_hmap_file(private_hmap_hash, KZ_POD_CONFIG_ROOT, @main_project.root_object.display_name)
|
65
65
|
end
|
66
66
|
|
67
67
|
@main_project.targets.each do |target|
|
68
68
|
if target.isa == "PBXNativeTarget" and target.product_type == "com.apple.product-type.application"
|
69
69
|
target.build_configurations.each do |config|
|
70
|
-
config.build_settings['HEADER_SEARCH_PATHS'] = "${PODS_ROOT}/#{@main_project.root_object.display_name }.hmap"
|
70
|
+
config.build_settings['HEADER_SEARCH_PATHS'] = "${PODS_ROOT}/KZPodConfigure/#{@main_project.root_object.display_name }.hmap"
|
71
71
|
config.build_settings['USE_HEADERMAP'] = 'NO'
|
72
72
|
end
|
73
73
|
end
|
@@ -85,11 +85,22 @@ module KZ
|
|
85
85
|
all_native_target
|
86
86
|
end
|
87
87
|
|
88
|
-
def
|
88
|
+
def get_all_test_target_from(project)
|
89
|
+
all_native_target = {}
|
90
|
+
|
91
|
+
project.targets.each do |target|
|
92
|
+
if target.isa == "PBXNativeTarget" and target.product_type == "com.apple.product-type.bundle.unit-test"
|
93
|
+
all_native_target[target.name] = target
|
94
|
+
end
|
95
|
+
end
|
96
|
+
all_native_target
|
97
|
+
end
|
98
|
+
|
99
|
+
def get_all_aggregate_target_from(project)
|
89
100
|
all_handle_target = {}
|
90
101
|
|
91
102
|
project.targets.each do |target|
|
92
|
-
if
|
103
|
+
if target.isa == "PBXAggregateTarget"
|
93
104
|
all_handle_target[target.name] = target
|
94
105
|
end
|
95
106
|
end
|
@@ -132,7 +143,15 @@ module KZ
|
|
132
143
|
elsif hmap_content_style == HmapContentStyle::QUOTES_REPAIR
|
133
144
|
header_hmap_value_slash = {}
|
134
145
|
header_hmap_value_slash['suffix'] = header_pathname_basename
|
135
|
-
|
146
|
+
prefix_name = kz_pod_target.name
|
147
|
+
if header_pathname.dirname.to_s.include?('.framework')
|
148
|
+
header_pathname.dirname.to_s.split('/').each do |name|
|
149
|
+
if name.include?('.framework')
|
150
|
+
prefix_name = name.split('.').first
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
header_hmap_value_slash['prefix'] = prefix_name + '/'
|
136
155
|
hmap_info[header_pathname_basename] = header_hmap_value_slash
|
137
156
|
end
|
138
157
|
end
|
@@ -140,7 +159,8 @@ module KZ
|
|
140
159
|
end
|
141
160
|
|
142
161
|
def create_pod_hamp(all_kz_pod_targets)
|
143
|
-
|
162
|
+
all_native_targets = get_all_native_target_from(@pod_project)
|
163
|
+
all_handle_targets = all_native_targets.merge(get_all_aggregate_target_from(@pod_project))
|
144
164
|
all_handle_targets.each do |target_name, target|
|
145
165
|
kz_pod_target = all_kz_pod_targets[target_name]
|
146
166
|
next unless kz_pod_target
|
@@ -161,17 +181,17 @@ module KZ
|
|
161
181
|
end
|
162
182
|
end
|
163
183
|
|
164
|
-
all_native_targets = get_all_native_target_from(@pod_project)
|
165
184
|
all_native_targets.each do |target_name, target|
|
166
|
-
|
185
|
+
target_real_name = target_name.split("-").first
|
186
|
+
kz_pod_target = all_kz_pod_targets[target_real_name]
|
167
187
|
next unless kz_pod_target
|
168
188
|
|
169
189
|
# 添加私有头文件引用
|
170
190
|
private_hamp_info = get_hmap_info_from(kz_pod_target, HmapContentStyle::QUOTES_PRIVATE)
|
171
191
|
if private_hamp_info.count > 0
|
172
192
|
hmap_cache_path = kz_pod_target.pod_config_cache_path(false)
|
173
|
-
save_hmap_file(private_hamp_info, kz_pod_target.pod_config_cache_path(false),
|
174
|
-
kz_pod_target.private_header_search_path = hmap_cache_path + "#{
|
193
|
+
save_hmap_file(private_hamp_info, kz_pod_target.pod_config_cache_path(false), target_real_name)
|
194
|
+
kz_pod_target.private_header_search_path = hmap_cache_path + "#{target_real_name}.hmap"
|
175
195
|
end
|
176
196
|
|
177
197
|
# 修复缺失的依赖
|
@@ -191,8 +211,10 @@ module KZ
|
|
191
211
|
kz_pod_target.framwork_search_paths = framework_search_paths
|
192
212
|
end
|
193
213
|
|
194
|
-
all_native_targets.
|
195
|
-
|
214
|
+
all_config_target = all_native_targets.merge(get_all_test_target_from(@pod_project))
|
215
|
+
all_config_target.each do |target_name, target|
|
216
|
+
target_real_name = target_name.split("-").first
|
217
|
+
kz_pod_target = all_kz_pod_targets[target_real_name]
|
196
218
|
next unless kz_pod_target
|
197
219
|
|
198
220
|
# 添加配置
|
@@ -1,15 +1,19 @@
|
|
1
1
|
require 'cocoapods'
|
2
2
|
require 'fileutils'
|
3
|
+
require 'json'
|
3
4
|
require_relative 'kz_analyzer'
|
4
5
|
require_relative 'kz_framework_manager'
|
5
6
|
require_relative 'kz_config_result'
|
6
7
|
require_relative 'kz_pod_target'
|
7
8
|
|
8
9
|
module KZ
|
9
|
-
KZ_POD_CONFIG_ROOT = Pod::Config.instance.
|
10
|
+
KZ_POD_CONFIG_ROOT = Pod::Config.instance.installation_root + 'Pods/KZPodConfigure'
|
11
|
+
# 修复pod lib报错问题
|
12
|
+
Pod::Config.instance.installation_root = nil
|
10
13
|
|
11
14
|
HMAP_EXECUTE_PATH = File.dirname(__FILE__) + '/../resources/hmap'
|
12
15
|
FLEX_COMPLIER_PATH = KZ_POD_CONFIG_ROOT + 'FlexCompiler'
|
16
|
+
KZ_LOCK_FILE_PATH = KZ_POD_CONFIG_ROOT + 'KZConfigLock'
|
13
17
|
|
14
18
|
class KZGlobalHelper
|
15
19
|
attr_accessor :kz_pod_enable
|
@@ -18,6 +22,9 @@ module KZ
|
|
18
22
|
attr_accessor :specify_pod_names
|
19
23
|
attr_accessor :specify_pod_mode
|
20
24
|
attr_accessor :debug
|
25
|
+
attr_accessor :kz_config_lock
|
26
|
+
attr_accessor :disable_generate_framework
|
27
|
+
attr_accessor :generate_kz_pod_targets
|
21
28
|
|
22
29
|
private_class_method :new
|
23
30
|
|
@@ -26,9 +33,9 @@ module KZ
|
|
26
33
|
@specify_pod_mode = :kz_pod_origin_mode
|
27
34
|
@pods_config_cache = {}
|
28
35
|
@debug = false
|
29
|
-
|
30
|
-
|
31
|
-
|
36
|
+
@kz_config_lock = {}
|
37
|
+
@disable_generate_framework = false
|
38
|
+
@generate_kz_pod_targets = false
|
32
39
|
end
|
33
40
|
|
34
41
|
@@instance = nil
|
@@ -36,6 +43,20 @@ module KZ
|
|
36
43
|
@@instance ||= new
|
37
44
|
end
|
38
45
|
|
46
|
+
def kz_pod_enable=(value)
|
47
|
+
@kz_pod_enable = value
|
48
|
+
FileUtils.rm(KZ_LOCK_FILE_PATH) if File.exist?(KZ_LOCK_FILE_PATH)
|
49
|
+
|
50
|
+
if value
|
51
|
+
FileUtils.mkdir_p(KZ_POD_CONFIG_ROOT) unless File.exist?(KZ_POD_CONFIG_ROOT)
|
52
|
+
|
53
|
+
flex_compiler_de_path = KZ_POD_CONFIG_ROOT + 'FlexCompiler'
|
54
|
+
FileUtils.rm(flex_compiler_de_path) if File.exist?(flex_compiler_de_path)
|
55
|
+
FileUtils.cp_r(File.dirname(__FILE__) + '/../resources/FlexCompiler', KZ_POD_CONFIG_ROOT)
|
56
|
+
system("chmod +x #{flex_compiler_de_path}")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
39
60
|
def analyze_special_parameters(use_code_tag, use_framework_tag, pod_names)
|
40
61
|
specify_pod_names = []
|
41
62
|
if pod_names.count > 0
|
@@ -67,5 +88,27 @@ module KZ
|
|
67
88
|
result
|
68
89
|
end
|
69
90
|
|
91
|
+
def have_flexLib_pod_target
|
92
|
+
@kz_analyzer.kz_pod_targets_with("FlexLib").count > 0
|
93
|
+
end
|
94
|
+
|
95
|
+
def write_lock_file
|
96
|
+
self.kz_analyzer.all_kz_pod_targets.values.each do |kz_pod_target|
|
97
|
+
result = pod_config_result_with_target(kz_pod_target)
|
98
|
+
|
99
|
+
@kz_config_lock[kz_pod_target.name] ||= {}
|
100
|
+
@kz_config_lock[kz_pod_target.name]["dev_pod"] = kz_pod_target.is_dev_pod
|
101
|
+
@kz_config_lock[kz_pod_target.name]["use_framework"] = (result != nil)
|
102
|
+
@kz_config_lock[kz_pod_target.name]["version"] = kz_pod_target.version
|
103
|
+
end
|
104
|
+
|
105
|
+
if @kz_config_lock.count > 0
|
106
|
+
lock_file_content = JSON.pretty_generate(@kz_config_lock)
|
107
|
+
File.open(KZ_LOCK_FILE_PATH, 'w') do |file|
|
108
|
+
file.write(lock_file_content)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
70
113
|
end
|
71
114
|
end
|
@@ -33,6 +33,14 @@ module KZ
|
|
33
33
|
end
|
34
34
|
@all_kz_pod_targets[native_pod_target_name] = kz_pod_target
|
35
35
|
|
36
|
+
if is_dev_pod && native_pod_target.test_dependent_targets_by_spec_name.count > 0
|
37
|
+
test_pod_targets = native_pod_target.test_dependent_targets_by_spec_name.values.flatten
|
38
|
+
test_pod_targets.each do |test_pod_target|
|
39
|
+
kz_test_pod_target = create_kz_pod_target_from(test_pod_target, :kz_pod_framework_mode)
|
40
|
+
@all_kz_pod_targets[test_pod_target.name] = kz_test_pod_target
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
36
44
|
kz_dependent_target_info = {}
|
37
45
|
native_pod_target.dependent_targets.each do |native_dependent_target|
|
38
46
|
kz_dependent_pod_target = create_kz_pod_target_from(native_dependent_target, kz_pod_target.config_pod_mode)
|
@@ -30,7 +30,7 @@ module KZ
|
|
30
30
|
@dependent_target_info = {}
|
31
31
|
@repair_dependent_target_info = {}
|
32
32
|
@repair_import = []
|
33
|
-
@
|
33
|
+
@is_dev_pod = false
|
34
34
|
@config_pod_mode = :kz_pod_origin_mode
|
35
35
|
|
36
36
|
native_pod_target.file_accessors.each do |file_accessor|
|
@@ -47,6 +47,8 @@ module KZ
|
|
47
47
|
|
48
48
|
all_headers = []
|
49
49
|
native_pod_target.file_accessors.each do |file_accessor|
|
50
|
+
next if file_accessor.spec.test_specification
|
51
|
+
|
50
52
|
all_headers.concat(file_accessor.headers)
|
51
53
|
end
|
52
54
|
|
@@ -59,8 +61,9 @@ module KZ
|
|
59
61
|
|
60
62
|
public_headers = []
|
61
63
|
native_pod_target.file_accessors.each do |file_accessor|
|
64
|
+
next if file_accessor.spec.test_specification
|
65
|
+
|
62
66
|
public_headers.concat(file_accessor.origin_public_headers)
|
63
|
-
public_headers.concat(file_accessor.vendored_frameworks_headers)
|
64
67
|
end
|
65
68
|
|
66
69
|
@_public_headers = public_headers
|
@@ -166,9 +169,23 @@ module KZ
|
|
166
169
|
def pod_config_cache_path(concat_version)
|
167
170
|
kz_target_framework_folder = KZ_POD_CONFIG_ROOT + @name
|
168
171
|
kz_target_framework_folder += @version if concat_version
|
169
|
-
FileUtils.mkdir_p(kz_target_framework_folder) unless File.exist?(kz_target_framework_folder)
|
172
|
+
FileUtils.mkdir_p(kz_target_framework_folder) unless File.exist?(kz_target_framework_folder) || concat_version
|
170
173
|
Pathname(kz_target_framework_folder)
|
171
174
|
end
|
172
175
|
|
176
|
+
def kz_module_name
|
177
|
+
return @native_pod_target.product_module_name unless all_headers.count > 0
|
178
|
+
|
179
|
+
one_header_path = all_headers.first.to_s
|
180
|
+
if one_header_path.include?('.framework')
|
181
|
+
one_header_path.split('/').each do |name|
|
182
|
+
if name.include?('.framework')
|
183
|
+
return name.split('.').first
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
return @native_pod_target.product_module_name
|
188
|
+
end
|
189
|
+
|
173
190
|
end
|
174
191
|
end
|
@@ -0,0 +1,373 @@
|
|
1
|
+
require_relative 'global_helper'
|
2
|
+
|
3
|
+
module KZ
|
4
|
+
class KZSwiftContext
|
5
|
+
def initialize(type_contexts)
|
6
|
+
@type_contexts = type_contexts
|
7
|
+
@type_ornament = []
|
8
|
+
@type_header = []
|
9
|
+
@type_str = ""
|
10
|
+
@type_body = []
|
11
|
+
|
12
|
+
if @type_contexts.length == 1
|
13
|
+
element = @type_contexts[0]
|
14
|
+
puts @type_contexts
|
15
|
+
@type_ornament = element.scan(/@\w+[()\w\n]*/)
|
16
|
+
element_info = element.split("{")
|
17
|
+
@type_str = element_info[0] + "{"
|
18
|
+
@type_body << element_info[1].sub("}", "")
|
19
|
+
else
|
20
|
+
# 1 从未扫描到class 2 扫描到class 3 class扫描完毕
|
21
|
+
type_line_tag = 1
|
22
|
+
type_lines = []
|
23
|
+
for type_line in @type_contexts
|
24
|
+
if type_line_tag == 1
|
25
|
+
ornaments = type_line.scan(/@\w+[()\w\n]*/)
|
26
|
+
@type_ornament.concat(ornaments) if ornaments.length > 0
|
27
|
+
|
28
|
+
result = yield(type_line)
|
29
|
+
if result
|
30
|
+
type_line_tag = 2
|
31
|
+
else
|
32
|
+
@type_header << type_line
|
33
|
+
next
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
if type_line_tag == 2
|
38
|
+
type_lines << type_line
|
39
|
+
if type_line.include?("{")
|
40
|
+
type_line_tag = 3
|
41
|
+
@type_str = type_lines.join("")
|
42
|
+
end
|
43
|
+
next
|
44
|
+
end
|
45
|
+
|
46
|
+
@type_body << type_line
|
47
|
+
end
|
48
|
+
|
49
|
+
last_element = @type_body[-1]
|
50
|
+
@type_body.pop()
|
51
|
+
@type_body << last_element.sub("}", "")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def get_oc_feature_contexts
|
56
|
+
@type_contexts
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
class KZSwiftParagraph < KZSwiftContext
|
62
|
+
|
63
|
+
def initialize(type_contexts, need_handle_func)
|
64
|
+
@type_contexts = type_contexts
|
65
|
+
@need_handle_func = need_handle_func
|
66
|
+
end
|
67
|
+
|
68
|
+
def get_oc_feature_contexts
|
69
|
+
if @need_handle_func
|
70
|
+
new_class_context = []
|
71
|
+
|
72
|
+
for context in @type_contexts
|
73
|
+
if context.include?("init()") && !context.include?("override")
|
74
|
+
context = context.sub("init()", "override init()")
|
75
|
+
context = context.sub("{", "{\nsuper.init()")
|
76
|
+
end
|
77
|
+
new_class_context << context
|
78
|
+
end
|
79
|
+
return new_class_context
|
80
|
+
else
|
81
|
+
return @type_contexts
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
class KZSwiftClass < KZSwiftContext
|
87
|
+
|
88
|
+
def initialize(type_contexts)
|
89
|
+
@system_nsobject_class = [
|
90
|
+
"NSObject"
|
91
|
+
]
|
92
|
+
|
93
|
+
super(type_contexts) do |line|
|
94
|
+
KZSwiftClass.check_line_have_class_tag(line)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.check_line_have_class_tag(line)
|
99
|
+
if line =~ /^(?:.*\s)?class\s/ && !line.include?("func") && !line.include?("var") && !line.include?("let")
|
100
|
+
return true
|
101
|
+
else
|
102
|
+
return false
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def get_oc_feature_contexts
|
107
|
+
new_class_context = []
|
108
|
+
|
109
|
+
# 获取类、父类、协议信息
|
110
|
+
class_name = ""
|
111
|
+
superClass_and_protocol = []
|
112
|
+
|
113
|
+
class_line = @type_str.gsub(/\s+/, "")
|
114
|
+
class_line = class_line.split("class")[1]
|
115
|
+
if class_line.include?(":")
|
116
|
+
colon_infos = class_line.split(":")
|
117
|
+
class_name = colon_infos[0]
|
118
|
+
|
119
|
+
colon_right = colon_infos[1]
|
120
|
+
colon_right = colon_right.sub("{", "")
|
121
|
+
superClass_and_protocol = colon_right.split(",")
|
122
|
+
else
|
123
|
+
class_name = class_line.sub("{", "")
|
124
|
+
end
|
125
|
+
|
126
|
+
return @type_contexts if class_name == ""
|
127
|
+
|
128
|
+
# 获取oc特性标识
|
129
|
+
have_super_class = false
|
130
|
+
if superClass_and_protocol.length > 0
|
131
|
+
have_super_class = !superClass_and_protocol[0].end_with?("Protocol")
|
132
|
+
end
|
133
|
+
|
134
|
+
have_objc_class = false
|
135
|
+
have_objc_members = false
|
136
|
+
for ornament in @type_ornament
|
137
|
+
if ornament.start_with?("@objc ") || ornament.start_with?("@objc(") || ornament == "@objc" || ornament == "@objc\n"
|
138
|
+
have_objc_class = true
|
139
|
+
end
|
140
|
+
have_objc_members = true if ornament.start_with?("@objcMembers")
|
141
|
+
end
|
142
|
+
|
143
|
+
# 添加class ornament
|
144
|
+
new_class_context.concat(@type_header)
|
145
|
+
|
146
|
+
if !have_objc_members
|
147
|
+
new_class_context.insert(0, "@objcMembers\n")
|
148
|
+
end
|
149
|
+
|
150
|
+
if !have_objc_class && !have_super_class
|
151
|
+
new_class_context.insert(0, "@objc\n")
|
152
|
+
end
|
153
|
+
|
154
|
+
# 添加class header
|
155
|
+
if !have_objc_class && !have_super_class
|
156
|
+
if superClass_and_protocol.length > 0
|
157
|
+
if !@system_nsobject_class.include?(superClass_and_protocol[0])
|
158
|
+
@type_str = @type_str.sub(":", ": NSObject,")
|
159
|
+
end
|
160
|
+
else
|
161
|
+
@type_str = @type_str.sub("{", ": NSObject {")
|
162
|
+
end
|
163
|
+
end
|
164
|
+
new_class_context << @type_str
|
165
|
+
|
166
|
+
# 添加class body
|
167
|
+
new_swift_types = KZSwiftFileAnalyse.analyse_swift_file(@type_body, !have_super_class)
|
168
|
+
new_swift_types.each do |swift_type|
|
169
|
+
new_class_context.concat(swift_type.get_oc_feature_contexts())
|
170
|
+
end
|
171
|
+
new_class_context << "}\n"
|
172
|
+
|
173
|
+
new_class_context
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
class KZSwiftEnum < KZSwiftContext
|
178
|
+
|
179
|
+
def initialize(type_contexts)
|
180
|
+
super(type_contexts) do |line|
|
181
|
+
return KZSwiftEnum.check_line_have_enum_tag(line)
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
def self.check_line_have_enum_tag(line)
|
186
|
+
if line =~ /^(?:.*\s)?enum\s/
|
187
|
+
return true
|
188
|
+
else
|
189
|
+
return false
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
def get_oc_feature_contexts
|
194
|
+
new_enum_context = []
|
195
|
+
|
196
|
+
have_objc_tag = false
|
197
|
+
for ornament in @type_ornament
|
198
|
+
if ornament.start_with?("@objc ") || ornament.start_with?("@objc(") || ornament == "@objc"
|
199
|
+
have_objc_tag = true
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
return @type_contexts if have_objc_tag
|
204
|
+
|
205
|
+
for enum_line in @type_contexts
|
206
|
+
if KZSwiftEnum.check_line_have_enum_tag(enum_line)
|
207
|
+
raw_value_type = ""
|
208
|
+
raw_value_type = $1 if enum_line =~ /^.*:\s*(\w+)\s*{/
|
209
|
+
|
210
|
+
if raw_value_type == "Int"
|
211
|
+
new_enum_context.insert(0, "@objc\n")
|
212
|
+
else
|
213
|
+
return @type_contexts
|
214
|
+
end
|
215
|
+
end
|
216
|
+
new_enum_context << enum_line
|
217
|
+
end
|
218
|
+
|
219
|
+
new_enum_context
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
class KZSwiftFileAnalyse
|
224
|
+
def self.analyse_swift_file(swift_files, need_handle_func)
|
225
|
+
swift_types = []
|
226
|
+
|
227
|
+
cursor_index = 0
|
228
|
+
swift_files.each_with_index do |line, index|
|
229
|
+
next if line.start_with?("//")
|
230
|
+
next if index < cursor_index
|
231
|
+
|
232
|
+
if KZSwiftClass.check_line_have_class_tag(line)
|
233
|
+
class_begin_line = find_type_begin_index(index, cursor_index, swift_files)
|
234
|
+
class_end_line = find_type_end_index(index, swift_files)
|
235
|
+
|
236
|
+
# 封装无关代码
|
237
|
+
if class_begin_line > cursor_index
|
238
|
+
contexts = swift_files[cursor_index...class_begin_line]
|
239
|
+
swift_types << KZSwiftParagraph.new(contexts, need_handle_func)
|
240
|
+
end
|
241
|
+
|
242
|
+
# 封装类代码
|
243
|
+
contexts = swift_files[class_begin_line..class_end_line]
|
244
|
+
swift_types << KZSwiftClass.new(contexts)
|
245
|
+
|
246
|
+
# 更新游标
|
247
|
+
cursor_index = class_end_line + 1
|
248
|
+
elsif KZSwiftEnum.check_line_have_enum_tag(line)
|
249
|
+
enum_begin_line = find_type_begin_index(index, cursor_index, swift_files)
|
250
|
+
enum_end_line = find_type_end_index(index, swift_files)
|
251
|
+
|
252
|
+
# 封装无关代码
|
253
|
+
if enum_begin_line > cursor_index
|
254
|
+
contexts = swift_files[cursor_index...enum_begin_line]
|
255
|
+
swift_types << KZSwiftParagraph.new(contexts, need_handle_func)
|
256
|
+
end
|
257
|
+
|
258
|
+
# 封装枚举代码
|
259
|
+
contexts = swift_files[enum_begin_line..enum_end_line]
|
260
|
+
swift_types << KZSwiftEnum.new(contexts)
|
261
|
+
|
262
|
+
# 更新游标
|
263
|
+
cursor_index = enum_end_line + 1
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
# 封装无关代码
|
268
|
+
if cursor_index < swift_files.length
|
269
|
+
contexts = swift_files[cursor_index...swift_files.length]
|
270
|
+
swift_types << KZSwiftParagraph.new(contexts, need_handle_func)
|
271
|
+
end
|
272
|
+
|
273
|
+
swift_types
|
274
|
+
end
|
275
|
+
|
276
|
+
def self.find_type_begin_index(current_index, cursor_index, swift_files)
|
277
|
+
class_begin_line = current_index
|
278
|
+
if current_index > 0
|
279
|
+
(cursor_index...current_index).reverse_each do |_index|
|
280
|
+
previous_line = swift_files[_index].lstrip
|
281
|
+
|
282
|
+
next if previous_line == ""
|
283
|
+
|
284
|
+
if previous_line.start_with?("@")
|
285
|
+
class_begin_line = _index
|
286
|
+
else
|
287
|
+
break
|
288
|
+
end
|
289
|
+
end
|
290
|
+
end
|
291
|
+
class_begin_line
|
292
|
+
end
|
293
|
+
|
294
|
+
def self.find_type_end_index(current_index, swift_files)
|
295
|
+
class_end_line = current_index
|
296
|
+
if current_index < swift_files.length
|
297
|
+
left_bracket_count = -1
|
298
|
+
(current_index...swift_files.length).each do |_index|
|
299
|
+
next_line = swift_files[_index]
|
300
|
+
|
301
|
+
left_brackets = next_line.scan(/{/)
|
302
|
+
right_brackets = next_line.scan(/}/)
|
303
|
+
|
304
|
+
if left_brackets.length > 0
|
305
|
+
left_bracket_count = 0 if left_bracket_count == -1
|
306
|
+
left_bracket_count += left_brackets.length
|
307
|
+
end
|
308
|
+
|
309
|
+
if right_brackets.length > 0
|
310
|
+
left_bracket_count -= right_brackets.length
|
311
|
+
|
312
|
+
if left_bracket_count == 0
|
313
|
+
class_end_line = _index
|
314
|
+
break
|
315
|
+
end
|
316
|
+
end
|
317
|
+
end
|
318
|
+
end
|
319
|
+
class_end_line
|
320
|
+
end
|
321
|
+
end
|
322
|
+
|
323
|
+
class KZSwiftAttachOCFeature
|
324
|
+
|
325
|
+
def initialize
|
326
|
+
@all_kz_pod_targets = KZ::KZGlobalHelper.instance.kz_analyzer.all_kz_pod_targets
|
327
|
+
@specify_pod_names = KZ::KZGlobalHelper.instance.specify_pod_names
|
328
|
+
end
|
329
|
+
|
330
|
+
def repair
|
331
|
+
@all_kz_pod_targets.values.each do |kz_pod_target|
|
332
|
+
next unless kz_pod_target.is_dev_pod
|
333
|
+
next if @specify_pod_names.count > 0 && !@specify_pod_names.include?(kz_pod_target.name)
|
334
|
+
|
335
|
+
need_repair_files = []
|
336
|
+
kz_pod_target.native_pod_target.file_accessors.each do |file_accessor|
|
337
|
+
next if file_accessor.spec.test_specification
|
338
|
+
|
339
|
+
file_accessor.source_files.each do |source_file|
|
340
|
+
if source_file.extname == ".swift"
|
341
|
+
need_repair_files << source_file
|
342
|
+
end
|
343
|
+
end
|
344
|
+
end
|
345
|
+
|
346
|
+
puts "Start reair '#{kz_pod_target.name}' swfit files..."
|
347
|
+
need_repair_files.each do |swift_file_path|
|
348
|
+
swift_file = File.open(swift_file_path, 'r')
|
349
|
+
swift_files = swift_file.readlines
|
350
|
+
swift_file.close
|
351
|
+
swift_types = KZSwiftFileAnalyse.analyse_swift_file(swift_files, false)
|
352
|
+
|
353
|
+
new_swift_contexts = []
|
354
|
+
swift_types.each do |swift_type|
|
355
|
+
new_swift_contexts.concat(swift_type.get_oc_feature_contexts())
|
356
|
+
end
|
357
|
+
# puts new_swift_contexts
|
358
|
+
write_swift_file(swift_file_path, new_swift_contexts)
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
362
|
+
end
|
363
|
+
|
364
|
+
def write_swift_file(file_path, contexts)
|
365
|
+
swift_file = File.open(file_path, 'w')
|
366
|
+
contexts.each do |new_line|
|
367
|
+
swift_file.write(new_line)
|
368
|
+
end
|
369
|
+
swift_file.close
|
370
|
+
end
|
371
|
+
|
372
|
+
end
|
373
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
require_relative 'global_helper'
|
2
|
+
|
3
|
+
module KZ
|
4
|
+
class KZRepairModuleImport
|
5
|
+
def initialize(main_project)
|
6
|
+
@main_project = main_project
|
7
|
+
@all_kz_pod_targets = KZ::KZGlobalHelper.instance.kz_analyzer.all_kz_pod_targets
|
8
|
+
@specify_pod_names = KZ::KZGlobalHelper.instance.specify_pod_names
|
9
|
+
end
|
10
|
+
|
11
|
+
def repair
|
12
|
+
if @specify_pod_names.count == 0
|
13
|
+
main_project_file_folder = @main_project.project_dir + @main_project.root_object.display_name
|
14
|
+
main_project_files = []
|
15
|
+
main_project_headers = []
|
16
|
+
Dir.glob(File.join(main_project_file_folder, '**', '*')).each do |file|
|
17
|
+
if File.file?(file) and (file.end_with?(".h") or file.end_with?(".m"))
|
18
|
+
if file.end_with?(".h")
|
19
|
+
main_project_headers << Pathname.new(file)
|
20
|
+
main_project_files << Pathname.new(file)
|
21
|
+
elsif file.end_with?(".m")
|
22
|
+
main_project_files << Pathname.new(file)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
puts "Start reair main project..."
|
27
|
+
main_project_files.each do |file_path|
|
28
|
+
repair_file(file_path, main_project_headers)
|
29
|
+
end
|
30
|
+
|
31
|
+
@all_kz_pod_targets.values.each do |kz_pod_target|
|
32
|
+
next unless kz_pod_target.is_dev_pod
|
33
|
+
|
34
|
+
puts "Start reair '#{kz_pod_target.name}' header files..."
|
35
|
+
kz_pod_target.all_headers.each do |header_path|
|
36
|
+
repair_file(header_path, kz_pod_target.all_headers, kz_pod_target.recursive_dependent_targets)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
else
|
40
|
+
@all_kz_pod_targets.values.each do |kz_pod_target|
|
41
|
+
next unless kz_pod_target.is_dev_pod
|
42
|
+
next unless @specify_pod_names.include?(kz_pod_target.name)
|
43
|
+
|
44
|
+
need_repair_files = []
|
45
|
+
kz_pod_target.native_pod_target.file_accessors.each do |file_accessor|
|
46
|
+
next if file_accessor.spec.test_specification
|
47
|
+
|
48
|
+
file_accessor.source_files.each do |source_file|
|
49
|
+
if [".h", ".m", ".mm"].include?(source_file.extname)
|
50
|
+
need_repair_files << source_file
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
puts "Start reair '#{kz_pod_target.name}' files..."
|
56
|
+
need_repair_files.each do |file_path|
|
57
|
+
repair_file(file_path, kz_pod_target.all_headers, kz_pod_target.recursive_dependent_targets)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def repair_file(file_path, current_module_headers, sub_pods = nil)
|
64
|
+
new_header_content = []
|
65
|
+
|
66
|
+
file = File.open(file_path)
|
67
|
+
contents = file.readlines
|
68
|
+
file.close
|
69
|
+
|
70
|
+
contents.each do |line|
|
71
|
+
if line =~ /#import\s*["<]([a-zA-Z\+]+\.h)[">]/
|
72
|
+
heaer_name = $1
|
73
|
+
other_module_name = find_other_module_name(heaer_name, current_module_headers, sub_pods)
|
74
|
+
if other_module_name
|
75
|
+
if other_module_name == ""
|
76
|
+
new_header_content << line
|
77
|
+
else
|
78
|
+
new_header_content << "#import <#{other_module_name}/#{heaer_name}>\n"
|
79
|
+
end
|
80
|
+
else
|
81
|
+
new_header_content << "#warning '#{heaer_name}' is not included in the current pod or its subpods\n"
|
82
|
+
new_header_content << line
|
83
|
+
end
|
84
|
+
else
|
85
|
+
new_header_content << line
|
86
|
+
end
|
87
|
+
end
|
88
|
+
write_swift_file(file_path, new_header_content)
|
89
|
+
end
|
90
|
+
|
91
|
+
def write_swift_file(file_path, contexts)
|
92
|
+
swift_file = File.open(file_path, 'w')
|
93
|
+
contexts.each do |new_line|
|
94
|
+
swift_file.write(new_line)
|
95
|
+
end
|
96
|
+
swift_file.close
|
97
|
+
end
|
98
|
+
|
99
|
+
def find_other_module_name(header_name, current_module_headers, sub_pods)
|
100
|
+
current_module_headers.each do |header_path|
|
101
|
+
if header_path.basename.to_s == header_name
|
102
|
+
return ""
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
if sub_pods == nil
|
107
|
+
sub_pods = @all_kz_pod_targets.values
|
108
|
+
end
|
109
|
+
sub_pods.each do |sub_kz_pod_target|
|
110
|
+
sub_headers = sub_kz_pod_target.all_headers
|
111
|
+
sub_headers.each do |header_path|
|
112
|
+
if header_path.basename.to_s == header_name
|
113
|
+
return sub_kz_pod_target.kz_module_name
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
return nil
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
122
|
+
end
|
@@ -39,7 +39,11 @@ fi}
|
|
39
39
|
|
40
40
|
def config_project
|
41
41
|
@pod_project.targets.each do |target|
|
42
|
-
if target.isa == "PBXNativeTarget" && target.product_type == "com.apple.product-type.framework"
|
42
|
+
if target.isa == "PBXNativeTarget" && target.product_type == "com.apple.product-type.framework"
|
43
|
+
kz_pod_target = KZGlobalHelper.instance.kz_analyzer.all_kz_pod_targets[target.name]
|
44
|
+
next unless kz_pod_target
|
45
|
+
next unless kz_pod_target.is_dev_pod
|
46
|
+
|
43
47
|
target.build_configurations.each do |config|
|
44
48
|
config.build_settings["KZ_XML_FLEX_COMPILER"] = FLEX_COMPLIER_PATH.to_s
|
45
49
|
config.build_settings["KZ_XML_FLEX_DIR"] = "${TARGET_TEMP_DIR}/XmlFlexs"
|
@@ -3,23 +3,16 @@ require 'cocoapods-kz/native/acknowledgements'
|
|
3
3
|
module Pod
|
4
4
|
module Generator
|
5
5
|
class Acknowledgements
|
6
|
+
|
7
|
+
alias_method :origin_license_text, :license_text
|
6
8
|
def license_text(spec)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
text = IO.read(license_path)
|
14
|
-
else
|
15
|
-
# UI.warn "Unable to read the license file `#{license_file}` " \
|
16
|
-
# "for the spec `#{spec}`"
|
17
|
-
end
|
18
|
-
elsif license_file = file_accessor(spec).license
|
19
|
-
text = IO.read(license_file)
|
20
|
-
end
|
9
|
+
if KZ::KZGlobalHelper.instance.kz_pod_enable
|
10
|
+
return nil unless spec.license
|
11
|
+
text = spec.license[:text]
|
12
|
+
text
|
13
|
+
else
|
14
|
+
origin_license_text(spec)
|
21
15
|
end
|
22
|
-
text
|
23
16
|
end
|
24
17
|
end
|
25
18
|
end
|
@@ -7,13 +7,11 @@ module Pod
|
|
7
7
|
|
8
8
|
def generate_targets(resolver_specs_by_target, target_inspections)
|
9
9
|
aggregate_targets, pod_targets = original_generate_targets(resolver_specs_by_target, target_inspections)
|
10
|
-
|
11
|
-
if KZ::KZGlobalHelper.instance.kz_pod_enable
|
10
|
+
if KZ::KZGlobalHelper.instance.generate_kz_pod_targets
|
12
11
|
kz_analyer = KZ::KZAnalyzer.new(pod_targets, self.sandbox.development_pods)
|
13
12
|
kz_analyer.analyer
|
14
13
|
KZ::KZGlobalHelper.instance.kz_analyzer = kz_analyer
|
15
14
|
end
|
16
|
-
|
17
15
|
[aggregate_targets, pod_targets]
|
18
16
|
end
|
19
17
|
|
@@ -8,7 +8,7 @@ module Pod
|
|
8
8
|
|
9
9
|
alias_method :origin_public_headers, :public_headers
|
10
10
|
def public_headers(include_frameworks = false)
|
11
|
-
if KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
11
|
+
if !self.spec.test_specification && KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
12
12
|
[]
|
13
13
|
else
|
14
14
|
origin_public_headers(include_frameworks)
|
@@ -16,7 +16,7 @@ module Pod
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def project_headers
|
19
|
-
if KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
19
|
+
if !self.spec.test_specification && KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
20
20
|
[]
|
21
21
|
else
|
22
22
|
project_header_files
|
@@ -24,7 +24,7 @@ module Pod
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def private_headers
|
27
|
-
if KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
27
|
+
if !self.spec.test_specification && KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
28
28
|
[]
|
29
29
|
else
|
30
30
|
private_header_files
|
@@ -33,7 +33,7 @@ module Pod
|
|
33
33
|
|
34
34
|
alias_method :origin_source_files, :source_files
|
35
35
|
def source_files
|
36
|
-
if KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
36
|
+
if !self.spec.test_specification && KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
37
37
|
[]
|
38
38
|
else
|
39
39
|
origin_source_files
|
@@ -42,7 +42,7 @@ module Pod
|
|
42
42
|
|
43
43
|
alias_method :origin_arc_source_files, :arc_source_files
|
44
44
|
def arc_source_files
|
45
|
-
if KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
45
|
+
if !self.spec.test_specification && KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
46
46
|
[]
|
47
47
|
else
|
48
48
|
origin_arc_source_files
|
@@ -51,7 +51,7 @@ module Pod
|
|
51
51
|
|
52
52
|
alias_method :origin_resource_bundles, :resource_bundles
|
53
53
|
def resource_bundles
|
54
|
-
if KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
54
|
+
if !self.spec.test_specification && KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
55
55
|
{}
|
56
56
|
else
|
57
57
|
origin_resource_bundles
|
@@ -61,7 +61,7 @@ module Pod
|
|
61
61
|
alias_method :origin_resources, :resources
|
62
62
|
def resources
|
63
63
|
result = KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
64
|
-
if result
|
64
|
+
if !self.spec.test_specification && result
|
65
65
|
resources = origin_resources
|
66
66
|
resources.concat(result.get_bundle_paths)
|
67
67
|
resources
|
@@ -73,7 +73,7 @@ module Pod
|
|
73
73
|
alias_method :origin_vendored_frameworks, :vendored_frameworks
|
74
74
|
def vendored_frameworks
|
75
75
|
result = KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
76
|
-
if result
|
76
|
+
if !self.spec.test_specification && result
|
77
77
|
frameworks = origin_vendored_frameworks
|
78
78
|
frameworks.concat(result.get_framework_paths)
|
79
79
|
frameworks
|
@@ -14,21 +14,23 @@ module Pod
|
|
14
14
|
main_project = self.aggregate_targets.first.user_project
|
15
15
|
pods_project = self.pods_project
|
16
16
|
|
17
|
-
puts '
|
18
|
-
KZ::
|
17
|
+
puts 'Start KZPlugin Config'
|
18
|
+
if KZ::KZGlobalHelper.instance.have_flexLib_pod_target
|
19
|
+
KZ::XmlBuildConfig.new(main_project, pods_project).config_project
|
20
|
+
end
|
19
21
|
|
20
|
-
puts 'Config Framework Strip'
|
21
22
|
KZ::StripFrameworkConfig.new(main_project, pods_project).config_project
|
22
23
|
|
23
|
-
|
24
|
-
|
24
|
+
unless KZ::KZGlobalHelper.instance.disable_generate_framework
|
25
|
+
KZ::BuildFrameworkConfig.new(main_project, pods_project).config_project
|
26
|
+
end
|
25
27
|
|
26
|
-
puts 'Config Hmap'
|
27
28
|
KZ::CreateHmap.new(main_project, pods_project).config_project
|
28
29
|
|
29
30
|
main_project.save
|
30
31
|
pods_project.save
|
31
|
-
|
32
|
+
|
33
|
+
KZ::KZGlobalHelper.instance.write_lock_file
|
32
34
|
end
|
33
35
|
end
|
34
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-kz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yixiong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
description:
|
41
|
+
description: Kanzhun's cocoapods manage tools.
|
42
42
|
email:
|
43
43
|
- yixiong@kanzhun.com
|
44
44
|
executables: []
|
@@ -49,6 +49,7 @@ files:
|
|
49
49
|
- lib/cocoapods-kz/command.rb
|
50
50
|
- lib/cocoapods-kz/command/install.rb
|
51
51
|
- lib/cocoapods-kz/command/kz.rb
|
52
|
+
- lib/cocoapods-kz/command/repair.rb
|
52
53
|
- lib/cocoapods-kz/command/update.rb
|
53
54
|
- lib/cocoapods-kz/gem_version.rb
|
54
55
|
- lib/cocoapods-kz/helpers/build_framework_config.rb
|
@@ -58,6 +59,8 @@ files:
|
|
58
59
|
- lib/cocoapods-kz/helpers/kz_config_result.rb
|
59
60
|
- lib/cocoapods-kz/helpers/kz_framework_manager.rb
|
60
61
|
- lib/cocoapods-kz/helpers/kz_pod_target.rb
|
62
|
+
- lib/cocoapods-kz/helpers/repair_dynamic_swift.rb
|
63
|
+
- lib/cocoapods-kz/helpers/repair_module_import.rb
|
61
64
|
- lib/cocoapods-kz/helpers/strip_framework_config.rb
|
62
65
|
- lib/cocoapods-kz/helpers/xml_build_config.rb
|
63
66
|
- lib/cocoapods-kz/native.rb
|
@@ -92,5 +95,5 @@ requirements: []
|
|
92
95
|
rubygems_version: 3.4.13
|
93
96
|
signing_key:
|
94
97
|
specification_version: 4
|
95
|
-
summary:
|
98
|
+
summary: Kanzhun's cocoapods manage tools.
|
96
99
|
test_files: []
|