cocoapods-kz 0.0.6 → 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 +4 -4
- data/lib/cocoapods-kz/command/clean.rb +61 -0
- data/lib/cocoapods-kz/command/install.rb +5 -4
- data/lib/cocoapods-kz/command/kz.rb +1 -0
- data/lib/cocoapods-kz/command/repair.rb +8 -5
- data/lib/cocoapods-kz/command/update.rb +5 -4
- data/lib/cocoapods-kz/gem_version.rb +1 -1
- data/lib/cocoapods-kz/helpers/kz_analyzer.rb +1 -1
- data/lib/cocoapods-kz/helpers/kz_config_result.rb +2 -2
- data/lib/cocoapods-kz/helpers/kz_framework_manager.rb +3 -3
- data/lib/cocoapods-kz/helpers/kz_generator.rb +59 -48
- data/lib/cocoapods-kz/helpers/kz_global_helper.rb +2 -2
- data/lib/cocoapods-kz/helpers/kz_pod_target.rb +43 -21
- data/lib/cocoapods-kz/native/target_installer_helper.rb +9 -7
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb92acb138de5800f2049f30ca3347f49b1bc5952c484c9b5b97d32f80fe9106
|
4
|
+
data.tar.gz: 400c7a82a87498befbeb380b8e1970a8b79fbd8349db1f02dfa4eaad031e31fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e0d474d119d503d083458b5460a88f05b4e66d4bd65bbbd81b4c5fcef0e403eb515218b76f6883001c88743e20ce93041ef623a71eddb030bb76bfa3434a2a1
|
7
|
+
data.tar.gz: 21c976ce340e46d45e51869f06b7ea13b8277fd5c52aa8b62e9d4533665b4179c983c63dbd37798ea29368246aa7c1fb9e09d541f6e861d8884cfe46ad0315a1
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class Kz < Command
|
6
|
+
class Clean < Kz
|
7
|
+
self.summary = 'pod kz clean 用于清理缓存以一些报错文件'
|
8
|
+
|
9
|
+
self.description = <<-DESC
|
10
|
+
在pod update过程中由于代码变动,module缓存容易产生签名过期的问题,部分属性文件,跳转也会存在路径不对的情况,需要清理老旧缓存文件,
|
11
|
+
让Xcode重新生成
|
12
|
+
DESC
|
13
|
+
|
14
|
+
self.arguments = [
|
15
|
+
CLAide::Argument.new('1', false)
|
16
|
+
]
|
17
|
+
|
18
|
+
def self.options
|
19
|
+
[
|
20
|
+
%w[--xcode 清除module缓存与头文件索引问题],
|
21
|
+
]
|
22
|
+
end
|
23
|
+
|
24
|
+
def initialize(argv)
|
25
|
+
clean_xcode = argv.flag?('xcode')
|
26
|
+
banner! unless clean_xcode
|
27
|
+
|
28
|
+
super
|
29
|
+
end
|
30
|
+
|
31
|
+
def run
|
32
|
+
xcodeproj_path = Pathname.new(Dir[Pod::Config.instance.installation_root + "*.xcodeproj"].first)
|
33
|
+
return unless xcodeproj_path
|
34
|
+
|
35
|
+
xcode_derived_data_path = Pathname.new(Dir.home + "/Library/Developer/Xcode/DerivedData")
|
36
|
+
module_cache_noindex_path = xcode_derived_data_path + "ModuleCache.noindex"
|
37
|
+
FileUtils.rm_rf(module_cache_noindex_path) if module_cache_noindex_path.exist?
|
38
|
+
|
39
|
+
project_name = xcodeproj_path.basename.to_s.split(".").first
|
40
|
+
Dir.foreach(xcode_derived_data_path) do |file_name|
|
41
|
+
next if file_name == '.' || file_name == '..' || file_name == '.DS_Store'
|
42
|
+
|
43
|
+
if file_name.start_with?(project_name)
|
44
|
+
project_path = xcode_derived_data_path + file_name
|
45
|
+
index_noindex_path = project_path + "Index.noindex"
|
46
|
+
FileUtils.rm_rf(index_noindex_path) if index_noindex_path.exist?
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
default_xcode_path = Pathname.new('/Applications/Xcode.app')
|
51
|
+
if default_xcode_path.exist?
|
52
|
+
system("osascript -e 'quit app \"Xcode\"'")
|
53
|
+
sleep 1
|
54
|
+
workspace_path = Dir[Pod::Config.instance.installation_root + "*.xcworkspace"].first
|
55
|
+
system("open \"#{workspace_path}\"")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -8,9 +8,9 @@ module Pod
|
|
8
8
|
self.summary = 'pod kz install,用于指定pod是否开启framework模式'
|
9
9
|
|
10
10
|
self.description = <<-DESC
|
11
|
-
pod kz install 通过 --
|
12
|
-
通过 --
|
13
|
-
如果不添加任何参数,则默认所有pod为code模式,--
|
11
|
+
pod kz install 通过 --framework与指定pod名(多个pod,使用英文逗号隔开),尝试开启这些pod的framework模式,如果framwork不存在则仍然会使用code模式
|
12
|
+
通过 --code 与指定pod名(多个pod,使用英文逗号隔开),尝试开启这些pod的code模式,其余pod将尝试使用framework模式,如果framwork不存在则仍然会使用code模式
|
13
|
+
如果不添加任何参数,则默认所有pod为code模式,--framework与--code不能同时使用
|
14
14
|
DESC
|
15
15
|
|
16
16
|
def self.options
|
@@ -29,7 +29,8 @@ module Pod
|
|
29
29
|
def initialize(argv)
|
30
30
|
use_code_tag = argv.flag?('code')
|
31
31
|
use_framework_tag = argv.flag?('framework')
|
32
|
-
|
32
|
+
banner! if use_code_tag && use_framework_tag
|
33
|
+
|
33
34
|
KZ::KZGlobalHelper.instance.analyze_special_parameters(use_code_tag, use_framework_tag, argv.arguments!)
|
34
35
|
if Pod.match_version?('~> 1.11')
|
35
36
|
KZ::KZGlobalHelper.instance.kz_pod_enable = true
|
@@ -14,15 +14,16 @@ module Pod
|
|
14
14
|
def self.options
|
15
15
|
[
|
16
16
|
['--module-import', "指定组件名(只针对开发组件),修复该组件所有文件头文件导入方式,壳工程使用“Main”,如果不指定,默认对所有开发组件进行修复"],
|
17
|
-
['--dynamic-swift', "指定组件名(只针对开发组件),将该组件中所有swift文件添加OC特性,壳工程使用“Main”,如果不指定,默认对所有开发组件进行修复"]
|
17
|
+
['--dynamic-swift', "指定组件名(只针对开发组件),将该组件中所有swift文件添加OC特性,壳工程使用“Main”,如果不指定,默认对所有开发组件进行修复"],
|
18
|
+
['--private-hmap', "重新生成组件私有hamp"],
|
18
19
|
]
|
19
20
|
end
|
20
21
|
|
21
22
|
def initialize(argv)
|
22
|
-
help! if argv.arguments == 0
|
23
23
|
@repair_module_import = argv.flag?('module-import')
|
24
24
|
@repair_dynamic_swift = argv.flag?('dynamic-swift')
|
25
|
-
|
25
|
+
@repair_private_hmap = argv.flag?('private-hmap')
|
26
|
+
banner! unless @repair_module_import || @repair_dynamic_swift || @repair_private_hmap
|
26
27
|
|
27
28
|
KZ::KZGlobalHelper.instance.analyze_special_parameters(true, false, argv.arguments!)
|
28
29
|
KZ::KZGlobalHelper.instance.generate_kz_pod_targets = true
|
@@ -33,12 +34,14 @@ module Pod
|
|
33
34
|
def run
|
34
35
|
installer = installer_for_config
|
35
36
|
installer.prepare
|
36
|
-
installer.resolve_dependencies
|
37
|
+
installer.resolve_dependencies
|
37
38
|
|
38
39
|
if @repair_dynamic_swift
|
39
40
|
KZ::KZSwiftAttachOCFeature.new.repair
|
40
|
-
|
41
|
+
elsif @repair_module_import
|
41
42
|
KZ::KZRepairModuleImport.new(installer.aggregate_targets.first.user_project).repair
|
43
|
+
else @repair_private_hmap
|
44
|
+
KZ::KZGlobalHelper.instance.kz_generator.create_hamp
|
42
45
|
end
|
43
46
|
end
|
44
47
|
end
|
@@ -7,9 +7,9 @@ module Pod
|
|
7
7
|
self.summary = 'pod kz update,用于指定pod是否开启framework模式'
|
8
8
|
|
9
9
|
self.description = <<-DESC
|
10
|
-
pod kz update 通过 --
|
11
|
-
通过 --
|
12
|
-
如果不添加任何参数,则默认所有pod为code模式,--
|
10
|
+
pod kz update 通过 --framework与指定pod名(多个pod,使用英文逗号隔开),尝试开启这些pod的framework模式,如果framwork不存在则仍然会使用code模式
|
11
|
+
通过 --code 与指定pod名(多个pod,使用英文逗号隔开),尝试开启这些pod的code模式,其余pod将尝试使用framework模式,如果framwork不存在则仍然会使用code模式
|
12
|
+
如果不添加任何参数,则默认所有pod为code模式,--framework与--code不能同时使用
|
13
13
|
DESC
|
14
14
|
|
15
15
|
def self.options
|
@@ -29,7 +29,8 @@ module Pod
|
|
29
29
|
def initialize(argv)
|
30
30
|
use_code_tag = argv.flag?('code')
|
31
31
|
use_framework_tag = argv.flag?('framework')
|
32
|
-
|
32
|
+
banner! if use_code_tag && use_framework_tag
|
33
|
+
|
33
34
|
KZ::KZGlobalHelper.instance.analyze_special_parameters(use_code_tag, use_framework_tag, argv.arguments!)
|
34
35
|
if Pod.match_version?('~> 1.11')
|
35
36
|
KZ::KZGlobalHelper.instance.kz_pod_enable = true
|
@@ -134,7 +134,7 @@ module KZ
|
|
134
134
|
if File.exist?(KZ_LOCK_FILE_PATH)
|
135
135
|
@lock_file ||= JSON.parse(File.read(KZ_LOCK_FILE_PATH))
|
136
136
|
pod_lock_config = @lock_file[kz_pod_target.name]
|
137
|
-
return :kz_pod_framework_mode if pod_lock_config['use_framework']
|
137
|
+
return :kz_pod_framework_mode if pod_lock_config && pod_lock_config['use_framework']
|
138
138
|
end
|
139
139
|
:kz_pod_code_mode
|
140
140
|
end
|
@@ -14,7 +14,7 @@ module KZ
|
|
14
14
|
def get_bundle_paths
|
15
15
|
bundle_paths = []
|
16
16
|
Dir.foreach(@resource_path) do |bundle_name|
|
17
|
-
next if bundle_name == '.' || bundle_name == '..'
|
17
|
+
next if bundle_name == '.' || bundle_name == '..' || bundle_name == '.DS_Store'
|
18
18
|
|
19
19
|
bundle_path = @resource_path + bundle_name
|
20
20
|
if File.directory?(bundle_path) && bundle_name.end_with?(".bundle")
|
@@ -27,7 +27,7 @@ module KZ
|
|
27
27
|
def get_framework_paths
|
28
28
|
framework_paths = []
|
29
29
|
Dir.foreach(@resource_path) do |framework_name|
|
30
|
-
next if framework_name == '.' || framework_name == '..'
|
30
|
+
next if framework_name == '.' || framework_name == '..' || framework_name == '.DS_Store'
|
31
31
|
|
32
32
|
framework_path = @resource_path + framework_name
|
33
33
|
if File.directory?(framework_path) && framework_name.end_with?(".framework")
|
@@ -22,18 +22,18 @@ module KZ
|
|
22
22
|
end
|
23
23
|
|
24
24
|
Dir.foreach(KZ_POD_CONFIG_ROOT) do |folder_name|
|
25
|
-
next if folder_name == '.' || folder_name == '..'
|
25
|
+
next if folder_name == '.' || folder_name == '..' || folder_name == '.DS_Store'
|
26
26
|
|
27
27
|
config_folder = KZ_POD_CONFIG_ROOT + folder_name
|
28
28
|
if File.directory?(config_folder)
|
29
29
|
Dir.foreach(config_folder) do |version|
|
30
|
-
next if version == '.' || version == '..'
|
30
|
+
next if version == '.' || version == '..' || version == '.DS_Store'
|
31
31
|
|
32
32
|
version_folder = config_folder + version
|
33
33
|
if File.directory?(version_folder)
|
34
34
|
have_framework = false
|
35
35
|
Dir.foreach(version_folder) do |file_name|
|
36
|
-
next if file_name == '.' || file_name == '..'
|
36
|
+
next if file_name == '.' || file_name == '..' || file_name == '.DS_Store'
|
37
37
|
|
38
38
|
if file_name.end_with?(".framework") && File.directory?(version_folder + file_name)
|
39
39
|
have_framework = true
|
@@ -2,10 +2,6 @@ require 'xcodeproj'
|
|
2
2
|
require 'fileutils'
|
3
3
|
|
4
4
|
module KZ
|
5
|
-
class HmapContentStyle
|
6
|
-
QUOTES_PRIVATE = 1
|
7
|
-
QUOTES_REPAIR = 2
|
8
|
-
end
|
9
5
|
|
10
6
|
class KZGenerator
|
11
7
|
|
@@ -132,7 +128,7 @@ fi}
|
|
132
128
|
need_repair_import_targets = kz_pod_target.repair_import
|
133
129
|
if need_repair_import_targets.count > 0
|
134
130
|
need_repair_import_targets.each { |need_repair_import_target|
|
135
|
-
repair_hmap_info =
|
131
|
+
repair_hmap_info = repair_hmap_info(need_repair_import_target)
|
136
132
|
all_repair_hmap_info.merge!(repair_hmap_info)
|
137
133
|
}
|
138
134
|
end
|
@@ -159,7 +155,7 @@ fi}
|
|
159
155
|
|
160
156
|
# 添加私有头文件引用
|
161
157
|
if kz_pod_target.should_build?
|
162
|
-
private_hamp_info =
|
158
|
+
private_hamp_info = private_hmap_info(kz_pod_target)
|
163
159
|
if private_hamp_info.count > 0
|
164
160
|
hmap_cache_path = kz_pod_target.pod_config_cache_path(false)
|
165
161
|
save_hmap_file(private_hamp_info, hmap_cache_path, target_name)
|
@@ -171,7 +167,7 @@ fi}
|
|
171
167
|
|
172
168
|
def traverse_folder(folder_path)
|
173
169
|
Dir.foreach(folder_path) do |file_name|
|
174
|
-
next if file_name == '.' || file_name == '..'
|
170
|
+
next if file_name == '.' || file_name == '..' || file_name == '.DS_Store'
|
175
171
|
|
176
172
|
file_path = File.join(folder_path, file_name)
|
177
173
|
if File.file?(file_path)
|
@@ -187,7 +183,7 @@ fi}
|
|
187
183
|
def clean_hmap_cache(kz_pod_target)
|
188
184
|
hmap_cache_path = kz_pod_target.pod_config_cache_path(false)
|
189
185
|
Dir.foreach(hmap_cache_path) do |file_name|
|
190
|
-
next if file_name == '.' || file_name == '..'
|
186
|
+
next if file_name == '.' || file_name == '..' || file_name == '.DS_Store'
|
191
187
|
|
192
188
|
if file_name.end_with?(".hmap", ".json")
|
193
189
|
FileUtils.rm(hmap_cache_path + file_name) if File.exist?(hmap_cache_path + file_name)
|
@@ -195,11 +191,9 @@ fi}
|
|
195
191
|
end
|
196
192
|
end
|
197
193
|
|
198
|
-
def
|
194
|
+
def repair_hmap_info(kz_pod_target)
|
199
195
|
header_paths = kz_pod_target.public_headers
|
200
|
-
header_paths
|
201
|
-
hmap_info = {}
|
202
|
-
header_paths.each do |header_pathname|
|
196
|
+
header_paths.each_with_object({}) do |header_pathname, hmap_info|
|
203
197
|
header_pathname_basename = header_pathname.basename.to_s
|
204
198
|
|
205
199
|
header_hmap_value_quotes = {}
|
@@ -207,48 +201,65 @@ fi}
|
|
207
201
|
header_hmap_value_quotes['prefix'] = header_pathname.dirname.to_s + '/'
|
208
202
|
hmap_info[header_pathname_basename] = header_hmap_value_quotes
|
209
203
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
204
|
+
header_hmap_value_slash = {}
|
205
|
+
header_hmap_value_slash['suffix'] = header_pathname_basename
|
206
|
+
prefix_name = kz_pod_target.product_basename
|
207
|
+
if header_pathname.dirname.to_s.include?('.framework')
|
208
|
+
header_pathname.dirname.to_s.split('/').each do |name|
|
209
|
+
if name.include?('.framework')
|
210
|
+
prefix_name = name.split('.').first
|
211
|
+
end
|
216
212
|
end
|
213
|
+
end
|
214
|
+
header_hmap_value_slash['prefix'] = prefix_name + '/'
|
215
|
+
hmap_info[header_pathname_basename] = header_hmap_value_slash
|
216
|
+
end
|
217
|
+
end
|
217
218
|
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
219
|
+
def private_hmap_info(kz_pod_target)
|
220
|
+
header_paths = kz_pod_target.all_headers
|
221
|
+
# 更新Headers
|
222
|
+
if kz_pod_target.is_dev_pod && kz_pod_target.should_build?
|
223
|
+
header_paths.each do |header_pathname|
|
224
|
+
symlink_path = kz_pod_target.local_private_headers_path + header_pathname.basename
|
225
|
+
File.symlink(header_pathname, symlink_path) unless File.symlink?(symlink_path) || File.exist?(symlink_path)
|
226
|
+
end
|
227
|
+
kz_pod_target.use_local_private_headers_path = true
|
228
|
+
end
|
229
|
+
header_paths.each_with_object({}) do |header_pathname, hmap_info|
|
230
|
+
header_pathname_basename = header_pathname.basename.to_s
|
222
231
|
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
232
|
+
header_hmap_value_quotes = {}
|
233
|
+
header_hmap_value_quotes['suffix'] = header_pathname_basename
|
234
|
+
header_hmap_value_quotes['prefix'] = header_pathname.dirname.to_s + '/'
|
235
|
+
hmap_info[header_pathname_basename] = header_hmap_value_quotes
|
236
|
+
|
237
|
+
# pch
|
238
|
+
pchfile_path = kz_pod_target.prefix_header_path
|
239
|
+
if pchfile_path.exist?
|
240
|
+
suffix = pchfile_path.basename.to_s
|
241
|
+
hmap_info[suffix] = { 'suffix' => suffix, 'prefix' => "#{pchfile_path.dirname.to_s}/" }
|
242
|
+
end
|
243
|
+
|
244
|
+
unless kz_pod_target.is_dev_pod
|
245
|
+
# 个别第三方在使用自己组件文件时,会使用#import <xx/xx.h>的方式
|
246
|
+
hmap_info[kz_pod_target.product_basename + '/' + header_pathname_basename] = header_hmap_value_quotes
|
247
|
+
end
|
248
|
+
|
249
|
+
if kz_pod_target.uses_swift && kz_pod_target.is_dev_pod
|
250
|
+
# 修改SPBoss-Swift.h文件的导入方式
|
251
|
+
swift_bridge_file_name = "#{kz_pod_target.name}-Swift.h"
|
252
|
+
hmap_info[swift_bridge_file_name] = { 'suffix' => swift_bridge_file_name, 'prefix' => "#{kz_pod_target.name}/" }
|
253
|
+
|
254
|
+
# 以SPBoss为例,在混编模式中,SPBoss-Swift.h会使用#import <SPBoss/SPBoss.h>方式导入swift需要使用的OC头文件
|
255
|
+
# SPBoss中头文件会存在当前组件与framework的Headers中,有两份。SPBoss-Swift.h只在framework中
|
256
|
+
# 编译默认从SPBoss-Swift.h找SPBoss.h,然后找SPBoss.h中的头文件也都会在framework中寻在,会造成与当前组件头文件重复
|
257
|
+
# 需要重新将#import <SPBoss/SPBoss.h>方式修复为寻找当前组件中的SPBoss.h文件,而不是framework中的SPBoss.h
|
258
|
+
if header_pathname_basename == "#{kz_pod_target.name}.h"
|
259
|
+
hmap_info[kz_pod_target.name + '/' + header_pathname_basename] = header_hmap_value_quotes
|
246
260
|
end
|
247
|
-
header_hmap_value_slash['prefix'] = prefix_name + '/'
|
248
|
-
hmap_info[header_pathname_basename] = header_hmap_value_slash
|
249
261
|
end
|
250
262
|
end
|
251
|
-
hmap_info
|
252
263
|
end
|
253
264
|
|
254
265
|
def save_hmap_file(hmap_hash, save_path, file_name)
|
@@ -56,13 +56,12 @@ module KZ
|
|
56
56
|
|
57
57
|
@@instance = nil
|
58
58
|
def self.instance
|
59
|
+
FileUtils.mkdir_p(KZ_POD_CONFIG_ROOT) unless File.exist?(KZ_POD_CONFIG_ROOT)
|
59
60
|
@@instance ||= new
|
60
61
|
end
|
61
62
|
|
62
63
|
def prepare
|
63
64
|
if Pod::Config.instance.podfile && Pod::Config.instance.podfile.plugins.has_key?("cocoapods-kz")
|
64
|
-
FileUtils.mkdir_p(KZ_POD_CONFIG_ROOT) unless File.exist?(KZ_POD_CONFIG_ROOT)
|
65
|
-
|
66
65
|
flex_compiler_de_path = KZ_POD_CONFIG_ROOT + 'FlexCompiler'
|
67
66
|
FileUtils.rm(flex_compiler_de_path) if File.exist?(flex_compiler_de_path)
|
68
67
|
FileUtils.cp_r(File.dirname(__FILE__) + '/../resources/FlexCompiler', KZ_POD_CONFIG_ROOT)
|
@@ -70,6 +69,7 @@ module KZ
|
|
70
69
|
FileUtils.cp_r(File.dirname(__FILE__) + '/../resources/kz_merge_swift_h.rb', KZ_MERGE_SWIFT_H_PATH)
|
71
70
|
|
72
71
|
Pod::Config.instance.podfile.use_frameworks!(:linkage => :static)
|
72
|
+
Pod::Config.instance.podfile.install!("cocoapods", :deterministic_uuids => false)
|
73
73
|
else
|
74
74
|
@kz_pod_enable = false
|
75
75
|
@generate_kz_pod_targets = false
|
@@ -36,6 +36,8 @@ module KZ
|
|
36
36
|
# 当手动修改PRODUCT_NAME之后,#import<xx/xxx.h>需要修复为原使用方式,使用hmap进行映射
|
37
37
|
attr_accessor :need_repair_module_import
|
38
38
|
|
39
|
+
attr_accessor :use_local_private_headers_path
|
40
|
+
|
39
41
|
def initialize(native_pod_target)
|
40
42
|
@native_pod_target = native_pod_target
|
41
43
|
@name = native_pod_target.name
|
@@ -50,6 +52,7 @@ module KZ
|
|
50
52
|
@product_name = native_pod_target.origin_product_name
|
51
53
|
@product_basename = native_pod_target.origin_product_basename
|
52
54
|
@need_repair_module_import = false
|
55
|
+
@use_local_private_headers_path = false
|
53
56
|
|
54
57
|
native_pod_target.file_accessors.each do |file_accessor|
|
55
58
|
file_accessor.kz_pod_target = self
|
@@ -63,31 +66,30 @@ module KZ
|
|
63
66
|
end
|
64
67
|
|
65
68
|
def all_headers
|
66
|
-
return
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
@_all_headers
|
69
|
+
return [] unless have_download_pod?
|
70
|
+
@all_headers ||= begin
|
71
|
+
all_headers = []
|
72
|
+
native_pod_target.file_accessors.each do |file_accessor|
|
73
|
+
next if file_accessor.spec.test_specification
|
74
|
+
|
75
|
+
all_headers.concat(file_accessor.kz_headers)
|
76
|
+
end
|
77
|
+
all_headers
|
78
|
+
end
|
77
79
|
end
|
78
80
|
|
79
81
|
def public_headers
|
80
|
-
return
|
81
|
-
|
82
|
-
public_headers = []
|
83
|
-
native_pod_target.file_accessors.each do |file_accessor|
|
84
|
-
next if file_accessor.spec.test_specification
|
82
|
+
return [] unless have_download_pod?
|
85
83
|
|
86
|
-
|
87
|
-
|
84
|
+
@public_headers ||= begin
|
85
|
+
public_headers = []
|
86
|
+
native_pod_target.file_accessors.each do |file_accessor|
|
87
|
+
next if file_accessor.spec.test_specification
|
88
88
|
|
89
|
-
|
90
|
-
|
89
|
+
public_headers.concat(file_accessor.kz_public_headers)
|
90
|
+
end
|
91
|
+
public_headers
|
92
|
+
end
|
91
93
|
end
|
92
94
|
|
93
95
|
# 重些config_pod_mode的set方法,kz_pod_framework_mode优先级最高
|
@@ -173,6 +175,9 @@ module KZ
|
|
173
175
|
if repair_header_search_paths.length > 0
|
174
176
|
header_search_paths += (' ' + repair_header_search_paths)
|
175
177
|
end
|
178
|
+
if @use_local_private_headers_path
|
179
|
+
header_search_paths += (' ' + KZ.deal_path_for_xcconfig(local_private_headers_path, true))
|
180
|
+
end
|
176
181
|
header_search_paths
|
177
182
|
end
|
178
183
|
|
@@ -237,8 +242,25 @@ module KZ
|
|
237
242
|
@native_pod_target.prefix_header_path
|
238
243
|
end
|
239
244
|
|
245
|
+
def have_download_pod?
|
246
|
+
native_pod_dir = @native_pod_target.sandbox.pod_dir(@root_name)
|
247
|
+
File.exist?(native_pod_dir) && !File.empty?(native_pod_dir)
|
248
|
+
end
|
249
|
+
|
240
250
|
def should_build?
|
241
|
-
@native_pod_target.should_build?
|
251
|
+
have_download_pod? ? @native_pod_target.should_build? : false
|
252
|
+
end
|
253
|
+
|
254
|
+
def uses_swift?
|
255
|
+
@native_pod_target.uses_swift?
|
256
|
+
end
|
257
|
+
|
258
|
+
def local_private_headers_path
|
259
|
+
@local_private_headers_path ||= begin
|
260
|
+
path = KZ_POD_CONFIG_ROOT + @name + "Headers"
|
261
|
+
FileUtils.mkdir_p(path) unless File.exist?(path)
|
262
|
+
path
|
263
|
+
end
|
242
264
|
end
|
243
265
|
|
244
266
|
end
|
@@ -27,7 +27,7 @@ module Pod
|
|
27
27
|
if kz_pod_target.repair_header_search_path
|
28
28
|
main_hamp_search_path += (' ' + KZ.deal_path_for_xcconfig(kz_pod_target.repair_header_search_path, true))
|
29
29
|
end
|
30
|
-
add_repair_modulemap(xcconfig, kz_pod_target.all_repair_modulemap_paths)
|
30
|
+
add_repair_modulemap(xcconfig, kz_pod_target.all_repair_modulemap_paths, self.target.uses_swift?)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
xcconfig.attributes['HEADER_SEARCH_PATHS'] = main_hamp_search_path
|
@@ -50,7 +50,7 @@ module Pod
|
|
50
50
|
xcconfig.attributes['KZ_FRAMEWORK_CACHE_PATH'] = framework_cache_path
|
51
51
|
xcconfig.attributes['KZ_MERGE_SWIFT_H_PATH'] = KZ::KZGlobalHelper.instance.kz_merge_swift_h_path
|
52
52
|
|
53
|
-
add_repair_modulemap(xcconfig, kz_pod_target.all_repair_modulemap_paths)
|
53
|
+
add_repair_modulemap(xcconfig, kz_pod_target.all_repair_modulemap_paths, kz_pod_target.uses_swift?)
|
54
54
|
kz_update_xcconfig_file(xcconfig, path)
|
55
55
|
return
|
56
56
|
end
|
@@ -58,16 +58,18 @@ module Pod
|
|
58
58
|
origin_update_changed_file(generator, path)
|
59
59
|
end
|
60
60
|
|
61
|
-
def add_repair_modulemap(xcconfig, repair_modulemap_paths)
|
61
|
+
def add_repair_modulemap(xcconfig, repair_modulemap_paths, uses_swift = false)
|
62
62
|
if repair_modulemap_paths.count > 0
|
63
63
|
repair_modulemap_paths.each do |repair_modulemap_path|
|
64
64
|
fmodule_map = ' -fmodule-map-file=' + KZ.deal_path_for_xcconfig(repair_modulemap_path, true)
|
65
65
|
unless xcconfig.attributes['OTHER_CFLAGS'].include?(fmodule_map)
|
66
66
|
xcconfig.attributes['OTHER_CFLAGS'] += fmodule_map
|
67
67
|
end
|
68
|
-
|
69
|
-
|
70
|
-
xcconfig.attributes['OTHER_SWIFT_FLAGS']
|
68
|
+
if uses_swift
|
69
|
+
xfmodule_map = ' -Xcc -fmodule-map-file=' + KZ.deal_path_for_xcconfig(repair_modulemap_path, true)
|
70
|
+
unless xcconfig.attributes['OTHER_SWIFT_FLAGS'].include?(xfmodule_map)
|
71
|
+
xcconfig.attributes['OTHER_SWIFT_FLAGS'] += xfmodule_map
|
72
|
+
end
|
71
73
|
end
|
72
74
|
end
|
73
75
|
end
|
@@ -107,7 +109,7 @@ module Pod
|
|
107
109
|
|
108
110
|
def check_default_xcode_version_for_ld64
|
109
111
|
default_xcode_path = Pathname.new('/Applications/Xcode.app')
|
110
|
-
return false unless
|
112
|
+
return false unless default_xcode_path.exist?
|
111
113
|
|
112
114
|
xcode_info_plist = default_xcode_path + 'Contents/Info.plist'
|
113
115
|
_xcode_info_plist = KZ::KZ_POD_CONFIG_ROOT + 'Xcode_Info.plist'
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yixiong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -47,6 +47,7 @@ extra_rdoc_files: []
|
|
47
47
|
files:
|
48
48
|
- lib/cocoapods-kz.rb
|
49
49
|
- lib/cocoapods-kz/command.rb
|
50
|
+
- lib/cocoapods-kz/command/clean.rb
|
50
51
|
- lib/cocoapods-kz/command/install.rb
|
51
52
|
- lib/cocoapods-kz/command/kz.rb
|
52
53
|
- lib/cocoapods-kz/command/repair.rb
|