cocoapods-kz 0.0.3 → 0.0.5
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 +7 -6
- data/lib/cocoapods-kz/command/repair.rb +2 -2
- data/lib/cocoapods-kz/command/update.rb +7 -6
- data/lib/cocoapods-kz/gem_version.rb +1 -1
- data/lib/cocoapods-kz/helpers/kz_analyzer.rb +41 -4
- data/lib/cocoapods-kz/helpers/kz_framework_manager.rb +1 -1
- data/lib/cocoapods-kz/helpers/kz_generator.rb +268 -0
- data/lib/cocoapods-kz/helpers/{global_helper.rb → kz_global_helper.rb} +30 -6
- data/lib/cocoapods-kz/helpers/kz_pod_target.rb +76 -22
- data/lib/cocoapods-kz/helpers/repair_dynamic_swift.rb +2 -2
- data/lib/cocoapods-kz/helpers/repair_module_import.rb +16 -25
- data/lib/cocoapods-kz/native/analyzer.rb +4 -1
- data/lib/cocoapods-kz/native/dls.rb +2 -1
- data/lib/cocoapods-kz/native/file_accessor.rb +17 -0
- data/lib/cocoapods-kz/native/installer.rb +9 -24
- data/lib/cocoapods-kz/native/pod_target.rb +17 -0
- data/lib/cocoapods-kz/native/pod_target_installer.rb +30 -0
- data/lib/cocoapods-kz/native/specification.rb +31 -0
- data/lib/cocoapods-kz/native/target.rb +34 -0
- data/lib/cocoapods-kz/native/target_installer_helper.rb +125 -0
- data/lib/cocoapods-kz/native.rb +6 -2
- data/lib/cocoapods-kz/resources/kz_merge_swift_h.rb +14 -0
- metadata +10 -8
- data/lib/cocoapods-kz/helpers/build_framework_config.rb +0 -53
- data/lib/cocoapods-kz/helpers/create_hamp.rb +0 -236
- data/lib/cocoapods-kz/helpers/strip_framework_config.rb +0 -40
- data/lib/cocoapods-kz/helpers/xml_build_config.rb +0 -57
- data/lib/cocoapods-kz/native/user_project_integrator.rb +0 -16
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
product_swift_h_path = Pathname.new(ARGV[0])
|
5
|
+
product_simulator_swift_h_path = Pathname.new(ARGV[1])
|
6
|
+
target_swfit_h_path = Pathname.new(ARGV[2])
|
7
|
+
|
8
|
+
if File.exist?(product_swift_h_path) && File.exist?(product_simulator_swift_h_path)
|
9
|
+
FileUtils.cp_r(product_swift_h_path, target_swfit_h_path)
|
10
|
+
replacement = File.read(product_simulator_swift_h_path)
|
11
|
+
content_a = File.read(target_swfit_h_path)
|
12
|
+
content_a.gsub!("#error unsupported Swift architecture", replacement)
|
13
|
+
File.write(target_swfit_h_path, content_a)
|
14
|
+
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.5
|
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
|
+
date: 2023-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,26 +52,28 @@ files:
|
|
52
52
|
- lib/cocoapods-kz/command/repair.rb
|
53
53
|
- lib/cocoapods-kz/command/update.rb
|
54
54
|
- lib/cocoapods-kz/gem_version.rb
|
55
|
-
- lib/cocoapods-kz/helpers/build_framework_config.rb
|
56
|
-
- lib/cocoapods-kz/helpers/create_hamp.rb
|
57
|
-
- lib/cocoapods-kz/helpers/global_helper.rb
|
58
55
|
- lib/cocoapods-kz/helpers/kz_analyzer.rb
|
59
56
|
- lib/cocoapods-kz/helpers/kz_config_result.rb
|
60
57
|
- lib/cocoapods-kz/helpers/kz_framework_manager.rb
|
58
|
+
- lib/cocoapods-kz/helpers/kz_generator.rb
|
59
|
+
- lib/cocoapods-kz/helpers/kz_global_helper.rb
|
61
60
|
- lib/cocoapods-kz/helpers/kz_pod_target.rb
|
62
61
|
- lib/cocoapods-kz/helpers/repair_dynamic_swift.rb
|
63
62
|
- lib/cocoapods-kz/helpers/repair_module_import.rb
|
64
|
-
- lib/cocoapods-kz/helpers/strip_framework_config.rb
|
65
|
-
- lib/cocoapods-kz/helpers/xml_build_config.rb
|
66
63
|
- lib/cocoapods-kz/native.rb
|
67
64
|
- lib/cocoapods-kz/native/acknowledgements.rb
|
68
65
|
- lib/cocoapods-kz/native/analyzer.rb
|
69
66
|
- lib/cocoapods-kz/native/dls.rb
|
70
67
|
- lib/cocoapods-kz/native/file_accessor.rb
|
71
68
|
- lib/cocoapods-kz/native/installer.rb
|
72
|
-
- lib/cocoapods-kz/native/
|
69
|
+
- lib/cocoapods-kz/native/pod_target.rb
|
70
|
+
- lib/cocoapods-kz/native/pod_target_installer.rb
|
71
|
+
- lib/cocoapods-kz/native/specification.rb
|
72
|
+
- lib/cocoapods-kz/native/target.rb
|
73
|
+
- lib/cocoapods-kz/native/target_installer_helper.rb
|
73
74
|
- lib/cocoapods-kz/resources/FlexCompiler
|
74
75
|
- lib/cocoapods-kz/resources/hmap
|
76
|
+
- lib/cocoapods-kz/resources/kz_merge_swift_h.rb
|
75
77
|
- lib/cocoapods_plugin.rb
|
76
78
|
homepage: https://github.com/EXAMPLE/cocoapods-kz
|
77
79
|
licenses:
|
@@ -1,53 +0,0 @@
|
|
1
|
-
module KZ
|
2
|
-
class BuildFrameworkConfig
|
3
|
-
|
4
|
-
def initialize(main_project, pod_project)
|
5
|
-
@pod_project = pod_project
|
6
|
-
end
|
7
|
-
|
8
|
-
def config_project
|
9
|
-
@pod_project.targets.each do |target|
|
10
|
-
if target.isa == "PBXNativeTarget" && target.product_type == "com.apple.product-type.framework"
|
11
|
-
generate_framework_script = target.new_shell_script_build_phase('[KZ] Generate Framework')
|
12
|
-
generate_framework_script.show_env_vars_in_log = '0'
|
13
|
-
generate_framework_script.always_out_of_date = '1'
|
14
|
-
generate_framework_script.shell_script = %q{
|
15
|
-
if [ "${MACH_O_TYPE}" != "staticlib" ]; then
|
16
|
-
exit 0
|
17
|
-
fi
|
18
|
-
|
19
|
-
if [ "${ACTION}" != "build" ]; then
|
20
|
-
exit 0
|
21
|
-
fi
|
22
|
-
|
23
|
-
PRODUCT_DIR=${PODS_BUILD_DIR}/Debug-iphoneos/${TARGET_NAME}/${FULL_PRODUCT_NAME}
|
24
|
-
PRODUCT_SIMULATOR_DIR=${PODS_BUILD_DIR}/Debug-iphonesimulator/${TARGET_NAME}/${FULL_PRODUCT_NAME}
|
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}"
|
31
|
-
|
32
|
-
if [ -d "${KZ_FRAMEWORK_CACHE_PATH}/${FULL_PRODUCT_NAME}" ]; then
|
33
|
-
rm -r "${KZ_FRAMEWORK_CACHE_PATH}/${FULL_PRODUCT_NAME}"
|
34
|
-
fi
|
35
|
-
cp -r ${CURRENT_PRODUCT_DIR}/${FULL_PRODUCT_NAME} "${KZ_FRAMEWORK_CACHE_PATH}"
|
36
|
-
|
37
|
-
find "${CURRENT_PRODUCT_DIR}" -iname "*.bundle" -type d | while read -r BUNDLE_FILE; do
|
38
|
-
BUNDLE_NAME=$(basename ${BUNDLE_FILE})
|
39
|
-
if [ -d "${KZ_FRAMEWORK_CACHE_PATH}/${BUNDLE_NAME}" ]; then
|
40
|
-
rm -r "${KZ_FRAMEWORK_CACHE_PATH}/${BUNDLE_NAME}"
|
41
|
-
fi
|
42
|
-
cp -r ${BUNDLE_FILE} "${KZ_FRAMEWORK_CACHE_PATH}"
|
43
|
-
done
|
44
|
-
|
45
|
-
if [ -f ${PRODUCT_DIR}/${PRODUCT_NAME} ] && [ -f ${PRODUCT_SIMULATOR_DIR}/${PRODUCT_NAME} ]; then
|
46
|
-
lipo -create ${PRODUCT_DIR}/${PRODUCT_NAME} ${PRODUCT_SIMULATOR_DIR}/${PRODUCT_NAME} -output "${KZ_FRAMEWORK_CACHE_PATH}/${PRODUCT_NAME}.framework/${PRODUCT_NAME}"
|
47
|
-
fi
|
48
|
-
}
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,236 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
require_relative 'global_helper'
|
3
|
-
|
4
|
-
module KZ
|
5
|
-
class HmapContentStyle
|
6
|
-
QUOTES_PRIVATE = 1
|
7
|
-
QUOTES_REPAIR = 2
|
8
|
-
end
|
9
|
-
|
10
|
-
class CreateHmap
|
11
|
-
|
12
|
-
def initialize(main_project, pod_project)
|
13
|
-
@main_project = main_project
|
14
|
-
@pod_project = pod_project
|
15
|
-
end
|
16
|
-
|
17
|
-
def traverse_folder(folder_path)
|
18
|
-
Dir.foreach(folder_path) do |file_name|
|
19
|
-
next if file_name == '.' || file_name == '..'
|
20
|
-
|
21
|
-
file_path = File.join(folder_path, file_name)
|
22
|
-
if File.file?(file_path)
|
23
|
-
yield(file_path) if file_name.end_with?('.h')
|
24
|
-
elsif File.directory?(file_path)
|
25
|
-
traverse_folder(file_path) do |path|
|
26
|
-
yield(path)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def get_pod_pchfile_path(target_name)
|
33
|
-
@pod_project.project_dir + 'Target Support Files' + target_name + "#{target_name}-prefix.pch"
|
34
|
-
end
|
35
|
-
|
36
|
-
def save_hmap_file(hmap_hash, save_path, file_name)
|
37
|
-
hmap_json = JSON.pretty_generate(hmap_hash)
|
38
|
-
hmap_json_path = save_path + "#{file_name}.json"
|
39
|
-
hmap_path = save_path + "#{file_name}.hmap"
|
40
|
-
json_file = File.new(hmap_json_path, 'w')
|
41
|
-
return unless json_file
|
42
|
-
|
43
|
-
json_file.syswrite(hmap_json)
|
44
|
-
system "#{HMAP_EXECUTE_PATH} convert #{hmap_json_path} #{hmap_path}"
|
45
|
-
|
46
|
-
FileUtils.rm(hmap_json_path) unless KZ::KZGlobalHelper.instance.debug
|
47
|
-
end
|
48
|
-
|
49
|
-
def create_main_hamp
|
50
|
-
main_sources_path = @main_project.project_dir + @main_project.root_object.display_name
|
51
|
-
private_hmap_hash = {}
|
52
|
-
traverse_folder(main_sources_path) do |header_path|
|
53
|
-
header_pathname = Pathname.new(header_path)
|
54
|
-
header_pathname_basename = header_pathname.basename.to_s
|
55
|
-
|
56
|
-
header_hmap_value = {}
|
57
|
-
header_hmap_value['suffix'] = header_pathname_basename
|
58
|
-
header_hmap_value['prefix'] = header_pathname.dirname.to_s + '/'
|
59
|
-
|
60
|
-
private_hmap_hash[header_pathname_basename] = header_hmap_value
|
61
|
-
end
|
62
|
-
|
63
|
-
unless private_hmap_hash.empty?
|
64
|
-
save_hmap_file(private_hmap_hash, KZ_POD_CONFIG_ROOT, @main_project.root_object.display_name)
|
65
|
-
end
|
66
|
-
|
67
|
-
@main_project.targets.each do |target|
|
68
|
-
if target.isa == "PBXNativeTarget" and target.product_type == "com.apple.product-type.application"
|
69
|
-
target.build_configurations.each do |config|
|
70
|
-
config.build_settings['HEADER_SEARCH_PATHS'] = "${PODS_ROOT}/KZPodConfigure/#{@main_project.root_object.display_name }.hmap"
|
71
|
-
config.build_settings['USE_HEADERMAP'] = 'NO'
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def get_all_native_target_from(project)
|
78
|
-
all_native_target = {}
|
79
|
-
|
80
|
-
project.targets.each do |target|
|
81
|
-
if target.isa == "PBXNativeTarget" and target.product_type == "com.apple.product-type.framework" and !target.name.start_with?('Pods-')
|
82
|
-
all_native_target[target.name] = target
|
83
|
-
end
|
84
|
-
end
|
85
|
-
all_native_target
|
86
|
-
end
|
87
|
-
|
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)
|
100
|
-
all_handle_target = {}
|
101
|
-
|
102
|
-
project.targets.each do |target|
|
103
|
-
if target.isa == "PBXAggregateTarget"
|
104
|
-
all_handle_target[target.name] = target
|
105
|
-
end
|
106
|
-
end
|
107
|
-
all_handle_target
|
108
|
-
end
|
109
|
-
|
110
|
-
def get_hmap_info_from(kz_pod_target, hmap_content_style)
|
111
|
-
header_paths = kz_pod_target.public_headers
|
112
|
-
header_paths = kz_pod_target.all_headers if hmap_content_style == HmapContentStyle::QUOTES_PRIVATE
|
113
|
-
hmap_info = {}
|
114
|
-
header_paths.each do |header_pathname|
|
115
|
-
header_pathname_basename = header_pathname.basename.to_s
|
116
|
-
|
117
|
-
header_hmap_value_quotes = {}
|
118
|
-
header_hmap_value_quotes['suffix'] = header_pathname_basename
|
119
|
-
header_hmap_value_quotes['prefix'] = header_pathname.dirname.to_s + '/'
|
120
|
-
hmap_info[header_pathname_basename] = header_hmap_value_quotes
|
121
|
-
|
122
|
-
if hmap_content_style == HmapContentStyle::QUOTES_PRIVATE
|
123
|
-
# pch
|
124
|
-
pchfile_path = get_pod_pchfile_path(kz_pod_target.name)
|
125
|
-
if pchfile_path.exist?
|
126
|
-
suffix = pchfile_path.basename.to_s
|
127
|
-
prefix = pchfile_path.dirname.to_s + '/'
|
128
|
-
header_hmap_value = {}
|
129
|
-
header_hmap_value['suffix'] = suffix
|
130
|
-
header_hmap_value['prefix'] = prefix
|
131
|
-
hmap_info[suffix] = header_hmap_value
|
132
|
-
end
|
133
|
-
|
134
|
-
unless kz_pod_target.is_dev_pod
|
135
|
-
# 各别第三方在使用自己组件文件时,会使用#import <xx/xx.h>的方式
|
136
|
-
hmap_info[kz_pod_target.name + '/' + header_pathname_basename] = header_hmap_value_quotes
|
137
|
-
end
|
138
|
-
|
139
|
-
# 例如SPBoss.h会被在SPBoss-Swift.h中以#import <SPBoss/SPBoss.h>的方式使用,需要重定义寻找路径
|
140
|
-
if kz_pod_target.uses_swift && kz_pod_target.is_dev_pod && header_pathname_basename == "#{kz_pod_target.name}.h"
|
141
|
-
hmap_info[kz_pod_target.name + '/' + header_pathname_basename] = header_hmap_value_quotes
|
142
|
-
end
|
143
|
-
elsif hmap_content_style == HmapContentStyle::QUOTES_REPAIR
|
144
|
-
header_hmap_value_slash = {}
|
145
|
-
header_hmap_value_slash['suffix'] = header_pathname_basename
|
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 + '/'
|
155
|
-
hmap_info[header_pathname_basename] = header_hmap_value_slash
|
156
|
-
end
|
157
|
-
end
|
158
|
-
hmap_info
|
159
|
-
end
|
160
|
-
|
161
|
-
def create_pod_hamp(all_kz_pod_targets)
|
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))
|
164
|
-
all_handle_targets.each do |target_name, target|
|
165
|
-
kz_pod_target = all_kz_pod_targets[target_name]
|
166
|
-
next unless kz_pod_target
|
167
|
-
|
168
|
-
# 修复头文件导入方式
|
169
|
-
kz_recursive_dependent_targets = kz_pod_target.repair_import
|
170
|
-
if kz_recursive_dependent_targets.count > 0
|
171
|
-
all_repair_hmap_info = {}
|
172
|
-
kz_recursive_dependent_targets.each { |recursive_dependent_target|
|
173
|
-
repair_hmap_info = get_hmap_info_from(recursive_dependent_target, HmapContentStyle::QUOTES_REPAIR)
|
174
|
-
all_repair_hmap_info.merge!(repair_hmap_info)
|
175
|
-
}
|
176
|
-
if all_repair_hmap_info.count > 0
|
177
|
-
hmap_cache_path = kz_pod_target.pod_config_cache_path(false)
|
178
|
-
save_hmap_file(all_repair_hmap_info, hmap_cache_path, target_name + '_repair')
|
179
|
-
kz_pod_target.repair_header_search_path = hmap_cache_path + "#{target_name}_repair.hmap"
|
180
|
-
end
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
all_native_targets.each do |target_name, target|
|
185
|
-
target_real_name = target_name.split("-").first
|
186
|
-
kz_pod_target = all_kz_pod_targets[target_real_name]
|
187
|
-
next unless kz_pod_target
|
188
|
-
|
189
|
-
# 添加私有头文件引用
|
190
|
-
private_hamp_info = get_hmap_info_from(kz_pod_target, HmapContentStyle::QUOTES_PRIVATE)
|
191
|
-
if private_hamp_info.count > 0
|
192
|
-
hmap_cache_path = kz_pod_target.pod_config_cache_path(false)
|
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"
|
195
|
-
end
|
196
|
-
|
197
|
-
# 修复缺失的依赖
|
198
|
-
framework_search_paths = '$(inherited)'
|
199
|
-
kz_pod_target.all_repair_dependent_target_info.values.each do |repair_target|
|
200
|
-
result = KZGlobalHelper.instance.pod_config_result_with_target(repair_target)
|
201
|
-
if result
|
202
|
-
framework_search_paths += (' ' + "#{result.resource_path.to_s}")
|
203
|
-
else
|
204
|
-
# 修复target依赖
|
205
|
-
dependency_target = all_native_targets[repair_target.name]
|
206
|
-
target.add_dependency(dependency_target) if dependency_target
|
207
|
-
# 修复framework_search_paths
|
208
|
-
framework_search_paths += (' ' + '"${PODS_CONFIGURATION_BUILD_DIR}/' + repair_target.name + '"')
|
209
|
-
end
|
210
|
-
end
|
211
|
-
kz_pod_target.framwork_search_paths = framework_search_paths
|
212
|
-
end
|
213
|
-
|
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]
|
218
|
-
next unless kz_pod_target
|
219
|
-
|
220
|
-
# 添加配置
|
221
|
-
target.build_configurations.each do |config|
|
222
|
-
config.build_settings['HEADER_SEARCH_PATHS'] = kz_pod_target.header_search_paths
|
223
|
-
config.build_settings['USE_HEADERMAP'] = 'NO'
|
224
|
-
config.build_settings['FRAMEWORK_SEARCH_PATHS'] = kz_pod_target.framwork_search_paths
|
225
|
-
config.build_settings['KZ_FRAMEWORK_CACHE_PATH'] = kz_pod_target.pod_config_cache_path(true).to_s
|
226
|
-
end
|
227
|
-
end
|
228
|
-
end
|
229
|
-
|
230
|
-
def config_project
|
231
|
-
create_main_hamp
|
232
|
-
create_pod_hamp(KZGlobalHelper.instance.kz_analyzer.all_kz_pod_targets)
|
233
|
-
end
|
234
|
-
|
235
|
-
end
|
236
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
require 'tempfile'
|
3
|
-
|
4
|
-
module KZ
|
5
|
-
class StripFrameworkConfig
|
6
|
-
def initialize(main_project, pod_project)
|
7
|
-
@main_project = main_project
|
8
|
-
@pod_project = pod_project
|
9
|
-
end
|
10
|
-
|
11
|
-
def pod_target_support_files_path
|
12
|
-
@pod_project.project_dir + 'Target Support Files'
|
13
|
-
end
|
14
|
-
|
15
|
-
def config_project
|
16
|
-
@main_project.targets.each do |target|
|
17
|
-
if target.isa == "PBXNativeTarget" and target.product_type == "com.apple.product-type.application"
|
18
|
-
target_support_file_path = pod_target_support_files_path + "Pods-#{target.name}" + "Pods-#{target.name}-frameworks.sh"
|
19
|
-
if target_support_file_path.exist?
|
20
|
-
temp_sh_file_path = @main_project.project_dir + "Pods-#{target.name}" + 'temp.sh'
|
21
|
-
temp_sh_file = Tempfile.new(temp_sh_file_path.to_s)
|
22
|
-
chmod_cmd = "chmod +x #{temp_sh_file.path}"
|
23
|
-
system chmod_cmd
|
24
|
-
|
25
|
-
sh_file = File.open(target_support_file_path, "r+")
|
26
|
-
sh_file.each_line { |line|
|
27
|
-
temp_sh_file.puts(line)
|
28
|
-
if line.start_with?(" # Resign the code if required by the build settings to avoid unstable apps")
|
29
|
-
temp_sh_file.puts(' xcrun strip -x "${destination}/${basename}.framework/${basename}" 2> /dev/null')
|
30
|
-
end
|
31
|
-
}
|
32
|
-
temp_sh_file.close
|
33
|
-
FileUtils.mv(temp_sh_file.path, target_support_file_path)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
require_relative 'global_helper'
|
2
|
-
|
3
|
-
module KZ
|
4
|
-
class XmlBuildConfig
|
5
|
-
def initialize(main_project, pod_project)
|
6
|
-
@pod_project = pod_project
|
7
|
-
end
|
8
|
-
|
9
|
-
def new_build_rule(project, target, name)
|
10
|
-
new_rule = nil
|
11
|
-
target.build_rules.each do |build_rule|
|
12
|
-
new_rule = build_rule if build_rule.name == name
|
13
|
-
end
|
14
|
-
|
15
|
-
if new_rule == nil
|
16
|
-
new_rule = project.new(Xcodeproj::Project::PBXBuildRule)
|
17
|
-
target.build_rules << new_rule
|
18
|
-
end
|
19
|
-
|
20
|
-
new_rule.name = name
|
21
|
-
new_rule.compiler_spec = 'com.apple.compilers.proxy.script'
|
22
|
-
new_rule
|
23
|
-
end
|
24
|
-
|
25
|
-
def create_xml_rule(project, target)
|
26
|
-
xml_rule = new_build_rule(project, target, '[KZ] Custom Xml Build')
|
27
|
-
xml_rule.file_type = 'text.xml'
|
28
|
-
xml_rule.output_files = Array['${KZ_XML_FLEX_DIR}/${INPUT_FILE_BASE}.flex']
|
29
|
-
xml_rule.script = %Q{FLEX_PATH=${KZ_XML_FLEX_DIR}/${INPUT_FILE_BASE}.flex
|
30
|
-
rm -rf ${FLEX_PATH}
|
31
|
-
$KZ_XML_FLEX_COMPILER $INPUT_FILE_PATH $FLEX_PATH
|
32
|
-
if [ -f $FLEX_PATH ] ; then
|
33
|
-
cp $FLEX_PATH $KZ_XML_FLEX_BUILD_DIR
|
34
|
-
exit 0
|
35
|
-
else
|
36
|
-
exit 1
|
37
|
-
fi}
|
38
|
-
end
|
39
|
-
|
40
|
-
def config_project
|
41
|
-
@pod_project.targets.each do |target|
|
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
|
-
|
47
|
-
target.build_configurations.each do |config|
|
48
|
-
config.build_settings["KZ_XML_FLEX_COMPILER"] = FLEX_COMPLIER_PATH.to_s
|
49
|
-
config.build_settings["KZ_XML_FLEX_DIR"] = "${TARGET_TEMP_DIR}/XmlFlexs"
|
50
|
-
config.build_settings["KZ_XML_FLEX_BUILD_DIR"] = "${TARGET_BUILD_DIR}/${PRODUCT_NAME}.bundle"
|
51
|
-
end
|
52
|
-
self.create_xml_rule(@pod_project, target)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'cocoapods/installer/user_project_integrator'
|
2
|
-
require 'cocoapods-kz/helpers/global_helper'
|
3
|
-
|
4
|
-
module Pod
|
5
|
-
class Installer
|
6
|
-
class UserProjectIntegrator
|
7
|
-
|
8
|
-
alias_method :origin_print_override_warning, :print_override_warning
|
9
|
-
def print_override_warning(aggregate_target, user_target, config, key)
|
10
|
-
unless KZ::KZGlobalHelper.instance.kz_pod_enable
|
11
|
-
origin_print_override_warning(aggregate_target, user_target, config, key)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|