cocoapods-kz 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f85aeb7b3f3ec7afa4fec40b6509b2f1fa599970068a00532874ba299c96a3c
4
- data.tar.gz: eac71cb74fad8e788604563a5c10d087523fdaeee86dcd5e4b9edff9b0b645a6
3
+ metadata.gz: 2f8cee909ef575acab6b79cbcc8bb35111b0828bdac5b60ff697e09f72939373
4
+ data.tar.gz: 71d9afa7f5b11a7e517c4e2a59fcf91d8b1f9f5ff1e55656187fe23468eb86ab
5
5
  SHA512:
6
- metadata.gz: d78c400c79c139d5beb99b5c84e349869abec6507ad4d4b720c3ffd956542e207d34ec55e72273496b074a031fb01299ec79f26959e0611a33fd2a2e7c8d1521
7
- data.tar.gz: d5d61fdecfb237ba596539559f560747c3fdd3145324f2f069ad0e9f1c418b70786f19656405a3906992d1decea96718201f15c1103149967bea85b242e1dfc9
6
+ metadata.gz: b313218bd5b0dddd59a8f757306c9d1075d4269867b4f092d643fec4d91640d775c496e18ed35936b5a634daf70ed629cd780e55b1962d88ef4707fc5784137b
7
+ data.tar.gz: 0dfbce6a258f4d94eec260e16856088d9f97533a63f394be0e9cff6ca66e47f4af68048015c0970454b235d72bbd12e55d65054abbd75c000005f484cc656b2b
@@ -1,4 +1,4 @@
1
- require 'cocoapods-kz/helpers/global_helper'
1
+ require 'cocoapods-kz/helpers/kz_global_helper'
2
2
  require 'cocoapods-kz/gem_version'
3
3
 
4
4
  module Pod
@@ -19,10 +19,10 @@ module Pod
19
19
  ['--deployment', 'Disallow any changes to the Podfile or the Podfile.lock during installation'],
20
20
  ['--clean-install', 'Ignore the contents of the project cache and force a full pod installation. This only ' \
21
21
  'applies to projects that have enabled incremental installation'],
22
- ['--framework', "后面需要跟上pod名(多个pod,使用英文逗号隔开)"],
23
- ['--code', "后面需要跟上pod名(多个pod,使用英文逗号隔开)"],
22
+ ['--framework', "后面需要跟上pod名(多个pod,使用英文逗号隔开),支持追加*匹配任意内容"],
23
+ ['--code', "后面需要跟上pod名(多个pod,使用英文逗号隔开),支持追加*匹配任意内容"],
24
24
  ['--debug', "debug模式,会打印调试日志或生成调试文件"],
25
- ['--no-framework-update', "不再生成frameowrk"]
25
+ ['--no-framework-update', "build后不再生成frameowrk"]
26
26
  ].concat(super).reject { |(name, _)| name == '--no-repo-update' }
27
27
  end
28
28
 
@@ -36,13 +36,14 @@ module Pod
36
36
  KZ::KZGlobalHelper.instance.generate_kz_pod_targets = true
37
37
  end
38
38
  KZ::KZGlobalHelper.instance.debug = true if argv.flag?('debug')
39
- KZ::KZGlobalHelper.instance.disable_generate_framework = true if argv.flag?('no-framework-update')
39
+ KZ::KZGlobalHelper.instance.disable_generate_framework = true if argv.flag?('framework-update') != nil
40
40
 
41
41
  super
42
42
  @additional_args = argv.remainder!
43
43
  end
44
44
 
45
45
  def run
46
+ KZ::KZGlobalHelper.instance.prepare
46
47
  install = Pod::Command::Install.new(CLAide::ARGV.new([*@additional_args]))
47
48
  install.validate!
48
49
  install.run
@@ -13,8 +13,8 @@ module Pod
13
13
 
14
14
  def self.options
15
15
  [
16
- ['--module-import', "修复所有头文件import方式,使其支持module导入,如果后面追加指定Pod名,将只修改该Pod"],
17
- ['--dynamic-swift', "将项目中所有swift添加上OC动态属性,如果后面追加指定Pod名,将只修改该Pod"]
16
+ ['--module-import', "指定组件名(只针对开发组件),修复该组件所有文件头文件导入方式,壳工程使用“Main”,如果不指定,默认对所有开发组件进行修复"],
17
+ ['--dynamic-swift', "指定组件名(只针对开发组件),将该组件中所有swift文件添加OC特性,壳工程使用“Main”,如果不指定,默认对所有开发组件进行修复"]
18
18
  ]
19
19
  end
20
20
 
@@ -1,4 +1,4 @@
1
- require 'cocoapods-kz/helpers/global_helper'
1
+ require 'cocoapods-kz/helpers/kz_global_helper'
2
2
 
3
3
  module Pod
4
4
  class Command
@@ -19,10 +19,10 @@ module Pod
19
19
  ['--exclude-pods=podName', 'Pods to exclude during update. Multiple pods must be comma-delimited'],
20
20
  ['--clean-install', 'Ignore the contents of the project cache and force a full pod installation. This only ' \
21
21
  'applies to projects that have enabled incremental installation'],
22
- ['--framework', "后面需要跟上pod名(多个pod,使用英文逗号隔开)"],
23
- ['--code', "后面需要跟上pod名(多个pod,使用英文逗号隔开)"],
22
+ ['--framework', "后面需要跟上pod名(多个pod,使用英文逗号隔开),支持追加*匹配任意内容"],
23
+ ['--code', "后面需要跟上pod名(多个pod,使用英文逗号隔开),支持追加*匹配任意内容"],
24
24
  ['--debug', "debug模式,会打印调试日志或生成调试文件"],
25
- ['--no-framework-update', "不再生成frameowrk"]
25
+ ['--no-framework-update', "build后不再生成frameowrk"]
26
26
  ].concat(super)
27
27
  end
28
28
 
@@ -36,13 +36,14 @@ module Pod
36
36
  KZ::KZGlobalHelper.instance.generate_kz_pod_targets = true
37
37
  end
38
38
  KZ::KZGlobalHelper.instance.debug = true if argv.flag?('debug')
39
- KZ::KZGlobalHelper.instance.disable_generate_framework = true if argv.flag?('no-framework-update')
39
+ KZ::KZGlobalHelper.instance.disable_generate_framework = true if argv.flag?('framework-update') != nil
40
40
 
41
41
  super
42
42
  @additional_args = argv.remainder!
43
43
  end
44
44
 
45
45
  def run
46
+ KZ::KZGlobalHelper.instance.prepare
46
47
  update = Pod::Command::Update.new(CLAide::ARGV.new([*@additional_args]))
47
48
  update.validate!
48
49
  update.run
@@ -1,5 +1,5 @@
1
1
  module CocoapodsKz
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
4
4
 
5
5
  module Pod
@@ -1,6 +1,8 @@
1
1
  require_relative 'kz_pod_target'
2
+ require_relative 'kz_global_helper'
2
3
 
3
4
  module KZ
5
+
4
6
  class KZAnalyzer
5
7
  attr_accessor :all_kz_pod_targets
6
8
 
@@ -14,6 +16,24 @@ module KZ
14
16
  @native_pod_targets.each { |native_pod_target|
15
17
  create_kz_pod_target_from(native_pod_target, :kz_pod_origin_mode)
16
18
  }
19
+
20
+ # 检测是否有product名称相同的target
21
+ temp_repeat_product_name = []
22
+ @all_kz_pod_targets.each do |name, kz_pod_target|
23
+ if temp_repeat_product_name.include?(kz_pod_target.product_name)
24
+ kz_pod_target.product_name = "#{kz_pod_target.name}.framework"
25
+ kz_pod_target.product_basename = kz_pod_target.name
26
+ result = KZGlobalHelper.instance.pod_config_result_with_target(kz_pod_target)
27
+ if result
28
+ kz_pod_target.repair_modulemap_path = result.resource_path + kz_pod_target.product_name + "Modules/module.modulemap"
29
+ else
30
+ kz_pod_target.repair_modulemap_path = "${PODS_CONFIGURATION_BUILD_DIR}/#{kz_pod_target.name}/#{kz_pod_target.product_name}/Modules/module.modulemap"
31
+ end
32
+ kz_pod_target.need_repair_module_import = true
33
+ else
34
+ temp_repeat_product_name << kz_pod_target.product_name
35
+ end
36
+ end
17
37
  end
18
38
 
19
39
  def create_kz_pod_target_from(native_pod_target, config_pod_mode)
@@ -76,7 +96,7 @@ module KZ
76
96
  end
77
97
 
78
98
  def get_real_config_pod_mode(kz_pod_target)
79
- if KZGlobalHelper.instance.specify_pod_names.include?(kz_pod_target.name)
99
+ if specify_pod_names_contain(kz_pod_target.name)
80
100
  return KZGlobalHelper.instance.specify_pod_mode
81
101
  end
82
102
  :kz_pod_origin_mode
@@ -84,11 +104,26 @@ module KZ
84
104
 
85
105
  def get_use_config_pod_mode(kz_pod_target)
86
106
  if KZGlobalHelper.instance.specify_pod_mode == :kz_pod_framework_mode
87
- KZGlobalHelper.instance.specify_pod_names.include?(kz_pod_target.name) ? :kz_pod_framework_mode : :kz_pod_code_mode
107
+ specify_pod_names_contain(kz_pod_target.name) ? :kz_pod_framework_mode : :kz_pod_code_mode
88
108
  elsif KZGlobalHelper.instance.specify_pod_mode == :kz_pod_code_mode
89
- KZGlobalHelper.instance.specify_pod_names.include?(kz_pod_target.name) ? :kz_pod_code_mode : :kz_pod_framework_mode
109
+ specify_pod_names_contain(kz_pod_target.name) ? :kz_pod_code_mode : :kz_pod_framework_mode
90
110
  end
91
111
  end
92
112
 
113
+ def specify_pod_names_contain(target_name)
114
+ if KZGlobalHelper.instance.specify_pod_names.count > 0
115
+ KZGlobalHelper.instance.specify_pod_names.each do |specify_pod_name|
116
+ if specify_pod_name.end_with?("*")
117
+ _specify_pod_name = specify_pod_name.sub('*', '')
118
+ return true if target_name.start_with?(_specify_pod_name)
119
+ else
120
+ return true if specify_pod_name == target_name
121
+ end
122
+ end
123
+ false
124
+ else
125
+ true
126
+ end
127
+ end
93
128
  end
94
129
  end
@@ -1,5 +1,5 @@
1
1
  require_relative 'kz_pod_target'
2
- require_relative 'global_helper'
2
+ require_relative 'kz_global_helper'
3
3
  require_relative 'kz_config_result'
4
4
 
5
5
  module KZ
@@ -0,0 +1,256 @@
1
+ require 'xcodeproj'
2
+ require 'fileutils'
3
+
4
+ module KZ
5
+ class HmapContentStyle
6
+ QUOTES_PRIVATE = 1
7
+ QUOTES_REPAIR = 2
8
+ end
9
+
10
+ class KZGenerator
11
+
12
+ def initialize(main_project)
13
+ @all_kz_pod_targets = KZGlobalHelper.instance.kz_analyzer.all_kz_pod_targets
14
+ @main_project = main_project
15
+ end
16
+
17
+ def add_framework_generator_build_phase(native_target)
18
+ return if KZ::KZGlobalHelper.instance.disable_generate_framework
19
+
20
+ build_phase = native_target.new_shell_script_build_phase('[KZ] Generate Framework')
21
+ build_phase.show_env_vars_in_log = '0'
22
+ build_phase.output_paths = ['${KZ_FRAMEWORK_CACHE_PATH}/${FULL_PRODUCT_NAME}']
23
+ build_phase.shell_script = %q{
24
+ if [ "${MACH_O_TYPE}" != "staticlib" ]; then
25
+ exit 0
26
+ fi
27
+
28
+ PRODUCT_DIR=${PODS_BUILD_DIR}/Debug-iphoneos/${TARGET_NAME}/${FULL_PRODUCT_NAME}
29
+ PRODUCT_SIMULATOR_DIR=${PODS_BUILD_DIR}/Debug-iphonesimulator/${TARGET_NAME}/${FULL_PRODUCT_NAME}
30
+ CURRENT_PRODUCT_DIR=${PODS_CONFIGURATION_BUILD_DIR}/${TARGET_NAME}
31
+
32
+ if [ -d "${KZ_FRAMEWORK_CACHE_PATH}" ]; then
33
+ rm -r "${KZ_FRAMEWORK_CACHE_PATH}"
34
+ fi
35
+ mkdir -p "${KZ_FRAMEWORK_CACHE_PATH}"
36
+
37
+ if [ -d "${KZ_FRAMEWORK_CACHE_PATH}/${FULL_PRODUCT_NAME}" ]; then
38
+ rm -r "${KZ_FRAMEWORK_CACHE_PATH}/${FULL_PRODUCT_NAME}"
39
+ fi
40
+ cp -r ${CURRENT_PRODUCT_DIR}/${FULL_PRODUCT_NAME} "${KZ_FRAMEWORK_CACHE_PATH}"
41
+
42
+ find "${CURRENT_PRODUCT_DIR}" -iname "*.bundle" | while read -r BUNDLE_FILE; do
43
+ BUNDLE_NAME=$(basename ${BUNDLE_FILE})
44
+ if [ -d "${KZ_FRAMEWORK_CACHE_PATH}/${BUNDLE_NAME}" ]; then
45
+ rm -r "${KZ_FRAMEWORK_CACHE_PATH}/${BUNDLE_NAME}"
46
+ fi
47
+ cp -r ${BUNDLE_FILE} "${KZ_FRAMEWORK_CACHE_PATH}"
48
+ done
49
+
50
+ if [ -f ${PRODUCT_DIR}/${PRODUCT_NAME} ] && [ -f ${PRODUCT_SIMULATOR_DIR}/${PRODUCT_NAME} ]; then
51
+ lipo -create ${PRODUCT_DIR}/${PRODUCT_NAME} ${PRODUCT_SIMULATOR_DIR}/${PRODUCT_NAME} -output "${KZ_FRAMEWORK_CACHE_PATH}/${PRODUCT_NAME}.framework/${PRODUCT_NAME}"
52
+ fi
53
+ }
54
+ end
55
+
56
+ def add_flexlib_xml_build_rules(project, native_target)
57
+ return unless KZ::KZGlobalHelper.instance.have_flexLib_pod_target
58
+
59
+ native_target.build_configurations.each do |config|
60
+ config.build_settings["KZ_XML_FLEX_COMPILER"] = FLEX_COMPLIER_PATH.to_s
61
+ config.build_settings["KZ_XML_FLEX_DIR"] = "${TARGET_TEMP_DIR}/XmlFlexs"
62
+ config.build_settings["KZ_XML_FLEX_BUILD_DIR"] = "${TARGET_BUILD_DIR}/${PRODUCT_NAME}.bundle"
63
+ end
64
+
65
+ xml_rule = new_build_rule(project, native_target, '[KZ] Custom Xml Build')
66
+ xml_rule.file_type = 'text.xml'
67
+ xml_rule.output_files = Array['${KZ_XML_FLEX_DIR}/${INPUT_FILE_BASE}.flex']
68
+ xml_rule.script = %Q{FLEX_PATH=${KZ_XML_FLEX_DIR}/${INPUT_FILE_BASE}.flex
69
+ rm -rf ${FLEX_PATH}
70
+ $KZ_XML_FLEX_COMPILER $INPUT_FILE_PATH $FLEX_PATH
71
+ if [ -f $FLEX_PATH ] ; then
72
+ cp $FLEX_PATH $KZ_XML_FLEX_BUILD_DIR
73
+ exit 0
74
+ else
75
+ exit 1
76
+ fi}
77
+ end
78
+
79
+ def new_build_rule(project, native_target, name)
80
+ new_rule = nil
81
+ native_target.build_rules.each do |build_rule|
82
+ new_rule = build_rule if build_rule.name == name
83
+ end
84
+
85
+ if new_rule == nil
86
+ new_rule = project.new(Xcodeproj::Project::PBXBuildRule)
87
+ native_target.build_rules << new_rule
88
+ end
89
+
90
+ new_rule.name = name
91
+ new_rule.compiler_spec = 'com.apple.compilers.proxy.script'
92
+ new_rule
93
+ end
94
+
95
+ def create_hamp
96
+ # 创建壳工程hmap
97
+ main_sources_path = @main_project.project_dir + @main_project.root_object.display_name
98
+ private_hmap_hash = {}
99
+ traverse_folder(main_sources_path) do |header_path|
100
+ header_pathname = Pathname.new(header_path)
101
+ header_pathname_basename = header_pathname.basename.to_s
102
+
103
+ header_hmap_value = {}
104
+ header_hmap_value['suffix'] = header_pathname_basename
105
+ header_hmap_value['prefix'] = header_pathname.dirname.to_s + '/'
106
+
107
+ private_hmap_hash[header_pathname_basename] = header_hmap_value
108
+ end
109
+
110
+ unless private_hmap_hash.empty?
111
+ save_hmap_file(private_hmap_hash, KZ_POD_CONFIG_ROOT, @main_project.root_object.display_name)
112
+ end
113
+
114
+ # 创建pod hmap
115
+ @all_kz_pod_targets.each do |target_name, kz_pod_target|
116
+ clean_hmap_cache(kz_pod_target)
117
+
118
+ # 修复头文件导入方式
119
+ all_repair_hmap_info = {}
120
+ need_repair_import_targets = kz_pod_target.repair_import
121
+ if need_repair_import_targets.count > 0
122
+ need_repair_import_targets.each { |need_repair_import_target|
123
+ repair_hmap_info = get_hmap_info_from(need_repair_import_target, HmapContentStyle::QUOTES_REPAIR)
124
+ all_repair_hmap_info.merge!(repair_hmap_info)
125
+ }
126
+ end
127
+
128
+ kz_pod_target.recursive_dependent_targets.each do |recursive_dependent_target|
129
+ if recursive_dependent_target.need_repair_module_import
130
+ header_paths = recursive_dependent_target.public_headers
131
+ header_paths.each do |header_pathname|
132
+ header_pathname_basename = header_pathname.basename.to_s
133
+
134
+ header_hmap_value_quotes = {}
135
+ header_hmap_value_quotes['suffix'] = header_pathname_basename
136
+ header_hmap_value_quotes['prefix'] = recursive_dependent_target.product_basename + '/'
137
+ all_repair_hmap_info["#{recursive_dependent_target.root_name}/#{header_pathname_basename}"] = header_hmap_value_quotes
138
+ end
139
+ end
140
+ end
141
+
142
+ if all_repair_hmap_info.count > 0
143
+ hmap_cache_path = kz_pod_target.pod_config_cache_path(false)
144
+ save_hmap_file(all_repair_hmap_info, hmap_cache_path, target_name + '_repair')
145
+ kz_pod_target.repair_header_search_path = hmap_cache_path + "#{target_name}_repair.hmap"
146
+ end
147
+
148
+ # 添加私有头文件引用
149
+ if kz_pod_target.should_build?
150
+ private_hamp_info = get_hmap_info_from(kz_pod_target, HmapContentStyle::QUOTES_PRIVATE)
151
+ if private_hamp_info.count > 0
152
+ hmap_cache_path = kz_pod_target.pod_config_cache_path(false)
153
+ save_hmap_file(private_hamp_info, hmap_cache_path, target_name)
154
+ kz_pod_target.private_header_search_path = hmap_cache_path + "#{target_name}.hmap"
155
+ end
156
+ end
157
+ end
158
+ end
159
+
160
+ def traverse_folder(folder_path)
161
+ Dir.foreach(folder_path) do |file_name|
162
+ next if file_name == '.' || file_name == '..'
163
+
164
+ file_path = File.join(folder_path, file_name)
165
+ if File.file?(file_path)
166
+ yield(file_path) if file_name.end_with?('.h')
167
+ elsif File.directory?(file_path)
168
+ traverse_folder(file_path) do |path|
169
+ yield(path)
170
+ end
171
+ end
172
+ end
173
+ end
174
+
175
+ def clean_hmap_cache(kz_pod_target)
176
+ hmap_cache_path = kz_pod_target.pod_config_cache_path(false)
177
+ Dir.foreach(hmap_cache_path) do |file_name|
178
+ next if file_name == '.' || file_name == '..'
179
+
180
+ if file_name.end_with?(".hmap", ".json")
181
+ FileUtils.rm(hmap_cache_path + file_name) if File.exist?(hmap_cache_path + file_name)
182
+ end
183
+ end
184
+ end
185
+
186
+ def get_hmap_info_from(kz_pod_target, hmap_content_style)
187
+ header_paths = kz_pod_target.public_headers
188
+ header_paths = kz_pod_target.all_headers if hmap_content_style == HmapContentStyle::QUOTES_PRIVATE
189
+ hmap_info = {}
190
+ header_paths.each do |header_pathname|
191
+ header_pathname_basename = header_pathname.basename.to_s
192
+
193
+ header_hmap_value_quotes = {}
194
+ header_hmap_value_quotes['suffix'] = header_pathname_basename
195
+ header_hmap_value_quotes['prefix'] = header_pathname.dirname.to_s + '/'
196
+ hmap_info[header_pathname_basename] = header_hmap_value_quotes
197
+
198
+ if hmap_content_style == HmapContentStyle::QUOTES_PRIVATE
199
+ # pch
200
+ pchfile_path = kz_pod_target.prefix_header_path
201
+ if pchfile_path.exist?
202
+ suffix = pchfile_path.basename.to_s
203
+ hmap_info[suffix] = { 'suffix' => suffix, 'prefix' => "#{pchfile_path.dirname.to_s}/" }
204
+ end
205
+
206
+ unless kz_pod_target.is_dev_pod
207
+ # 各别第三方在使用自己组件文件时,会使用#import <xx/xx.h>的方式
208
+ hmap_info[kz_pod_target.name + '/' + header_pathname_basename] = header_hmap_value_quotes
209
+ end
210
+
211
+ if kz_pod_target.uses_swift && kz_pod_target.is_dev_pod
212
+ # 修改SPBoss-Swift.h文件的导入方式
213
+ swift_bridge_file_name = "#{kz_pod_target.name}-Swift.h"
214
+ hmap_info[swift_bridge_file_name] = { 'suffix' => swift_bridge_file_name, 'prefix' => "#{kz_pod_target.name}/" }
215
+
216
+ # 以SPBoss为例,在混编模式中,SPBoss-Swift.h会使用#import <SPBoss/SPBoss.h>方式导入swift需要使用的OC头文件
217
+ # SPBoss中头文件会存在当前组件与framework的Headers中,有两份。SPBoss-Swift.h只在framework中
218
+ # 编译默认从SPBoss-Swift.h找SPBoss.h,然后找SPBoss.h中的头文件也都会在framework中寻在,会造成与当前组件头文件重复
219
+ # 需要重新将#import <SPBoss/SPBoss.h>方式修复为寻找当前组件中的SPBoss.h文件,而不是framework中的SPBoss.h
220
+ if header_pathname_basename == "#{kz_pod_target.name}.h"
221
+ hmap_info[kz_pod_target.name + '/' + header_pathname_basename] = header_hmap_value_quotes
222
+ end
223
+ end
224
+ elsif hmap_content_style == HmapContentStyle::QUOTES_REPAIR
225
+ header_hmap_value_slash = {}
226
+ header_hmap_value_slash['suffix'] = header_pathname_basename
227
+ prefix_name = kz_pod_target.name
228
+ if header_pathname.dirname.to_s.include?('.framework')
229
+ header_pathname.dirname.to_s.split('/').each do |name|
230
+ if name.include?('.framework')
231
+ prefix_name = name.split('.').first
232
+ end
233
+ end
234
+ end
235
+ header_hmap_value_slash['prefix'] = prefix_name + '/'
236
+ hmap_info[header_pathname_basename] = header_hmap_value_slash
237
+ end
238
+ end
239
+ hmap_info
240
+ end
241
+
242
+ def save_hmap_file(hmap_hash, save_path, file_name)
243
+ hmap_json = JSON.pretty_generate(hmap_hash)
244
+ hmap_json_path = save_path + "#{file_name}.json"
245
+ hmap_path = save_path + "#{file_name}.hmap"
246
+ json_file = File.new(hmap_json_path, 'w')
247
+ return unless json_file
248
+
249
+ json_file.syswrite(hmap_json)
250
+ system "#{HMAP_EXECUTE_PATH} convert #{hmap_json_path} #{hmap_path}"
251
+
252
+ FileUtils.rm(hmap_json_path) unless KZ::KZGlobalHelper.instance.debug
253
+ end
254
+
255
+ end
256
+ end
@@ -8,6 +8,7 @@ require_relative 'kz_pod_target'
8
8
 
9
9
  module KZ
10
10
  KZ_POD_CONFIG_ROOT = Pod::Config.instance.installation_root + 'Pods/KZPodConfigure'
11
+ KZ_POD_CONFIG_ROOT_STR = "${PODS_ROOT}/KZPodConfigure"
11
12
  # 修复pod lib报错问题
12
13
  Pod::Config.instance.installation_root = nil
13
14
 
@@ -15,10 +16,24 @@ module KZ
15
16
  FLEX_COMPLIER_PATH = KZ_POD_CONFIG_ROOT + 'FlexCompiler'
16
17
  KZ_LOCK_FILE_PATH = KZ_POD_CONFIG_ROOT + 'KZConfigLock'
17
18
 
19
+ def self.deal_path_for_xcconfig(path, add_quotes = false)
20
+ if path.is_a?(String)
21
+ path_str = path.sub(KZ::KZ_POD_CONFIG_ROOT.to_s, KZ::KZ_POD_CONFIG_ROOT_STR)
22
+ path_str = ('"' + path_str + '"') if add_quotes
23
+ return path_str
24
+ elsif path.is_a?(Pathname)
25
+ path_str = path.to_s.sub(KZ::KZ_POD_CONFIG_ROOT.to_s, KZ::KZ_POD_CONFIG_ROOT_STR)
26
+ path_str = ('"' + path_str + '"') if add_quotes
27
+ return path_str
28
+ end
29
+ path
30
+ end
31
+
18
32
  class KZGlobalHelper
19
33
  attr_accessor :kz_pod_enable
20
34
  attr_accessor :kz_pod_config
21
35
  attr_accessor :kz_analyzer
36
+ attr_accessor :kz_generator
22
37
  attr_accessor :specify_pod_names
23
38
  attr_accessor :specify_pod_mode
24
39
  attr_accessor :debug
@@ -43,18 +58,16 @@ module KZ
43
58
  @@instance ||= new
44
59
  end
45
60
 
46
- def kz_pod_enable=(value)
47
- @kz_pod_enable = value
61
+ def prepare
48
62
  FileUtils.rm(KZ_LOCK_FILE_PATH) if File.exist?(KZ_LOCK_FILE_PATH)
63
+ FileUtils.mkdir_p(KZ_POD_CONFIG_ROOT) unless File.exist?(KZ_POD_CONFIG_ROOT)
49
64
 
50
- if value
51
- FileUtils.mkdir_p(KZ_POD_CONFIG_ROOT) unless File.exist?(KZ_POD_CONFIG_ROOT)
65
+ flex_compiler_de_path = KZ_POD_CONFIG_ROOT + 'FlexCompiler'
66
+ FileUtils.rm(flex_compiler_de_path) if File.exist?(flex_compiler_de_path)
67
+ FileUtils.cp_r(File.dirname(__FILE__) + '/../resources/FlexCompiler', KZ_POD_CONFIG_ROOT)
68
+ system("chmod +x #{flex_compiler_de_path}")
52
69
 
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
70
+ Pod::Config.instance.podfile.use_frameworks!(:linkage => :static) if Pod::Config.instance.podfile
58
71
  end
59
72
 
60
73
  def analyze_special_parameters(use_code_tag, use_framework_tag, pod_names)
@@ -77,7 +90,7 @@ module KZ
77
90
  end
78
91
 
79
92
  def pod_config_result_with_target(kz_pod_target)
80
- return nil unless @kz_pod_enable && @kz_analyzer != nil
93
+ return nil unless @kz_pod_enable
81
94
  return nil unless kz_pod_target && kz_pod_target.config_pod_mode == :kz_pod_framework_mode
82
95
 
83
96
  return @pods_config_cache[kz_pod_target.name] if @pods_config_cache.has_key?(kz_pod_target.name)