cocoapods-kz 0.0.13 → 0.0.15
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/info.rb +5 -2
- data/lib/cocoapods-kz/command/repair.rb +19 -12
- data/lib/cocoapods-kz/gem_version.rb +1 -1
- data/lib/cocoapods-kz/helpers/kz_analyzer.rb +29 -0
- data/lib/cocoapods-kz/helpers/kz_framework_manager.rb +24 -1
- data/lib/cocoapods-kz/helpers/{kz_generator.rb → kz_generator_hmap.rb} +2 -222
- data/lib/cocoapods-kz/helpers/kz_generator_on_demand_resources.rb +231 -0
- data/lib/cocoapods-kz/helpers/kz_global_helper.rb +38 -8
- data/lib/cocoapods-kz/helpers/kz_pod_target.rb +79 -5
- data/lib/cocoapods-kz/helpers/repair_module_import.rb +1 -1
- data/lib/cocoapods-kz/native/build_configuration.rb +12 -0
- data/lib/cocoapods-kz/native/dls.rb +13 -7
- data/lib/cocoapods-kz/native/file_accessor.rb +25 -5
- data/lib/cocoapods-kz/native/installer.rb +11 -2
- data/lib/cocoapods-kz/native/path_list.rb +11 -0
- data/lib/cocoapods-kz/native/pod_target_installer.rb +0 -20
- data/lib/cocoapods-kz/native/specification.rb +6 -0
- data/lib/cocoapods-kz/native/target_installer_helper.rb +36 -1
- data/lib/cocoapods-kz/native/target_integrator.rb +6 -12
- data/lib/cocoapods-kz/native.rb +2 -0
- data/lib/cocoapods-kz/resources/FlexCompiler_V1 +0 -0
- data/lib/cocoapods-kz/resources/on_demand_resources/kz_on_demand_resources_process.rb +194 -0
- data/lib/cocoapods-kz/resources/on_demand_resources/kz_on_demand_resources_xocde.sh +4 -81
- metadata +8 -7
- data/lib/cocoapods-kz/native/dsl_spec.rb +0 -7
- data/lib/cocoapods-kz/resources/on_demand_resources/kz_complete_asset_pack_output_spec_plist.rb +0 -26
- data/lib/cocoapods-kz/resources/on_demand_resources/kz_create_asset_pack_manifest_plist.rb +0 -44
- data/lib/cocoapods-kz/resources/on_demand_resources/kz_create_on_demand_resources_plis.rb +0 -26
@@ -0,0 +1,194 @@
|
|
1
|
+
require 'xcodeproj'
|
2
|
+
require "date"
|
3
|
+
require 'fileutils'
|
4
|
+
require 'tmpdir'
|
5
|
+
require 'json'
|
6
|
+
autoload :Nanaimo, 'nanaimo'
|
7
|
+
|
8
|
+
def write_to_path(hash, path)
|
9
|
+
unless path.is_a?(String) || path.is_a?(Pathname)
|
10
|
+
raise TypeError, "The given `#{path}` must be a string or 'pathname'."
|
11
|
+
end
|
12
|
+
path = path.to_s
|
13
|
+
raise IOError, 'Empty path.' if path.empty?
|
14
|
+
|
15
|
+
File.open(path, 'w') do |f|
|
16
|
+
plist = Nanaimo::Plist.new(hash, :xml)
|
17
|
+
Nanaimo::Writer::XMLWriter.new(plist, :pretty => true, :output => f, :strict => false).write
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# shell输入参数
|
22
|
+
kz_on_demand_resources_paths = ENV["KZ_ON_DEMAND_RESOURCES_PATHS"]
|
23
|
+
target_build_dir = Pathname(ENV["TARGET_BUILD_DIR"])
|
24
|
+
target_build_temp_dir = Pathname(ENV["TARGET_TEMP_DIR"])
|
25
|
+
if ENV["ACTION"] == "install" && ENV["SKIP_INSTALL"] == "NO"
|
26
|
+
target_build_dir = Pathname(ENV["INSTALL_DIR"])
|
27
|
+
end
|
28
|
+
app_path = target_build_dir + ENV["UNLOCALIZED_RESOURCES_FOLDER_PATH"]
|
29
|
+
|
30
|
+
# pod过程解析的odr内容路径,放在环境参数KZ_ON_DEMAND_RESOURCES_PATHS中,
|
31
|
+
# 格式为:'"KZChat:/Users/admin/Desktop/RubyProject/washington-ios/Pods/KZPodConfigure/PodTargets/KZChat/on_demand_resources" "KZGeek:/Users/admin/Desktop/RubyProject/washington-ios/Pods/KZPodConfigure/PodTargets/KZGeek/on_demand_resources"'
|
32
|
+
kz_on_demand_resources_info = kz_on_demand_resources_paths.gsub('"', '').split.map { |s| s.split(':', 2) }.to_h
|
33
|
+
# Xcode编译的产物路径,build目录下Product目录,开启odr时,会在这个目录下生成OnDemandResources,因为这里odr改成手动构建,所以此文件夹需要手动创建
|
34
|
+
target_build_on_demand_resources_path = target_build_dir + "OnDemandResources"
|
35
|
+
if ENV["ACTION"] == "install" && ENV["SKIP_INSTALL"] == "NO"
|
36
|
+
target_build_on_demand_resources_path = Pathname(ENV["INSTALL_ROOT"]) + "OnDemandResources"
|
37
|
+
end
|
38
|
+
FileUtils.mkdir_p(target_build_on_demand_resources_path) unless File.exist?(target_build_on_demand_resources_path)
|
39
|
+
|
40
|
+
# 将KZOnDemandResourcesAllConfig.plist拷贝到.app中,用于业务使用代码加载odr资源
|
41
|
+
kz_on_demand_resources_all_config_plist_path = Pathname(ENV["KZ_POD_CONFIG_ROOT"]) + "KZOnDemandResourcesAllConfig.plist"
|
42
|
+
return unless File.exist?(kz_on_demand_resources_all_config_plist_path)
|
43
|
+
FileUtils.cp(kz_on_demand_resources_all_config_plist_path, app_path)
|
44
|
+
|
45
|
+
# 用于在最终.app中生成所有odr信息的plist文件,固定名称为OnDemandResources.plist,系统会自动识别
|
46
|
+
app_on_demand_resources_plist = {}
|
47
|
+
bundle_resource_request_tags = {}
|
48
|
+
app_on_demand_resources_plist["NSBundleResourceRequestTags"] = bundle_resource_request_tags
|
49
|
+
bundle_resource_request_asset_packs = {}
|
50
|
+
app_on_demand_resources_plist["NSBundleResourceRequestAssetPacks"] = bundle_resource_request_asset_packs
|
51
|
+
|
52
|
+
# 遍历所有组件的odr信息,然后将需要的资源进行拷贝
|
53
|
+
kz_on_demand_resources_info.each do |pod_name, kz_on_demand_resources_path|
|
54
|
+
kz_on_demand_resources_path = Pathname(kz_on_demand_resources_path)
|
55
|
+
odr_build_info_plist_paht = kz_on_demand_resources_path + "odr_build_info.plist"
|
56
|
+
next unless File.exist?(odr_build_info_plist_paht)
|
57
|
+
|
58
|
+
odr_build_info = Xcodeproj::Plist.read_from_path(odr_build_info_plist_paht)
|
59
|
+
|
60
|
+
# 获取对应组件的bundle,如果没有需要创建,这里的bundle名称会与target名称相同
|
61
|
+
pod_bundle_path = Pathname(app_path) + "#{pod_name}.bundle"
|
62
|
+
FileUtils.mkdir_p(pod_bundle_path) unless File.exist?(pod_bundle_path)
|
63
|
+
|
64
|
+
# 将预处理的OnDemandResources拷贝到Product的OnDemandResources中
|
65
|
+
on_demand_resources_build_path = kz_on_demand_resources_path + "OnDemandResources"
|
66
|
+
FileUtils.cp_r("#{on_demand_resources_build_path}/.", target_build_on_demand_resources_path)
|
67
|
+
|
68
|
+
# 将组件自己的OnDemandResources.plist拷贝到组件bundle中,这里bundle其实也是一种app,也需要OnDemandResources.plist,用于系统识别odr资源
|
69
|
+
bundle_on_demand_resources_plist_path = kz_on_demand_resources_path + "OnDemandResources.plist"
|
70
|
+
FileUtils.cp(bundle_on_demand_resources_plist_path, pod_bundle_path + "OnDemandResources.plist")
|
71
|
+
# 读取组件的OnDemandResources.plist中的tag信息,用于最终.app中生成的OnDemandResources.plist
|
72
|
+
bundle_on_demand_resources_plist = Xcodeproj::Plist.read_from_path(bundle_on_demand_resources_plist_path)
|
73
|
+
bundle_resource_request_tags.update(bundle_on_demand_resources_plist["NSBundleResourceRequestTags"])
|
74
|
+
bundle_resource_request_asset_packs.update(bundle_on_demand_resources_plist["NSBundleResourceRequestAssetPacks"])
|
75
|
+
|
76
|
+
# 清除已经编译的普通非odr资源
|
77
|
+
if odr_build_info["normal_files"]
|
78
|
+
odr_build_info["normal_files"].each do |file_name|
|
79
|
+
normal_file_path = pod_bundle_path + file_name
|
80
|
+
FileUtils.rm_rf(normal_file_path) if File.exist?(normal_file_path)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# 将pod install过程生成的AssetPackOutputSpecifications拷贝到编译临时目录,并修改AssetPackOutputSpecifications.plist中的路径
|
85
|
+
kz_asset_pack_output_specifications_plist_path = kz_on_demand_resources_path + "AssetPackOutputSpecifications.plist"
|
86
|
+
next unless File.exist?(kz_asset_pack_output_specifications_plist_path)
|
87
|
+
# 在Xcode编译过程中,会在build目录下生成一个临时目录,用于存放AssetPackOutputSpecifications.plist(该文件在pod install过程中生成了模版,拷贝到这里会进行修改后才能使用)
|
88
|
+
build_on_demand_resources_temp_path = target_build_temp_dir + pod_name + "KZOnDemandResources"
|
89
|
+
FileUtils.mkdir_p(build_on_demand_resources_temp_path) unless File.exist?(build_on_demand_resources_temp_path)
|
90
|
+
FileUtils.cp(kz_asset_pack_output_specifications_plist_path, build_on_demand_resources_temp_path)
|
91
|
+
|
92
|
+
# 修改编译临时目录中AssetPackOutputSpecifications.plist文件标记资源的真实路径
|
93
|
+
asset_pack_output_specifications_plist_path = build_on_demand_resources_temp_path + "AssetPackOutputSpecifications.plist"
|
94
|
+
asset_pack_output_specifications_plist = Xcodeproj::Plist.read_from_path(asset_pack_output_specifications_plist_path)
|
95
|
+
asset_pack_output_specifications_plist.each do |item|
|
96
|
+
bundle_paht = item["bundle-path"]
|
97
|
+
unless bundle_paht.start_with?(target_build_on_demand_resources_path.to_s)
|
98
|
+
item["bundle-path"] = target_build_on_demand_resources_path + bundle_paht
|
99
|
+
end
|
100
|
+
end
|
101
|
+
write_to_path(asset_pack_output_specifications_plist, asset_pack_output_specifications_plist_path)
|
102
|
+
|
103
|
+
# 处理xcasset资源编译,从odr_info中读取原始xcasset资源,为了不破坏原有资源,这里将原始资源拷贝到临时目录,并修改对应的odr信息,然后使用actool进行编译
|
104
|
+
all_xcassets = odr_build_info["all_xcassets"]
|
105
|
+
unless all_xcassets.nil?
|
106
|
+
temp_dir = Pathname(Dir.mktmpdir)
|
107
|
+
xcasset_files = []
|
108
|
+
all_xcassets.each do |xcassets_name, xcassets_info|
|
109
|
+
path = xcassets_info["path"]
|
110
|
+
next if path.nil? || path.empty? || !File.exist?(path)
|
111
|
+
path = Pathname(path)
|
112
|
+
tags = xcassets_info["tags"]
|
113
|
+
next if tags.nil? || tags.empty?
|
114
|
+
|
115
|
+
FileUtils.cp_r(path, temp_dir)
|
116
|
+
new_path = temp_dir + path.basename
|
117
|
+
xcasset_files << new_path
|
118
|
+
|
119
|
+
tags.each do |imageset_name, tag|
|
120
|
+
content_json_path = new_path + imageset_name + "Contents.json"
|
121
|
+
content_json = JSON.parse(File.read(content_json_path))
|
122
|
+
content_json["properties"] = { "on-demand-resource-tags" => [tag] }
|
123
|
+
content_json_file = File.new(content_json_path, 'w')
|
124
|
+
content_json_file.syswrite(JSON.pretty_generate(content_json))
|
125
|
+
end
|
126
|
+
end
|
127
|
+
next if xcasset_files.empty?
|
128
|
+
|
129
|
+
# 将所有配置好的xcasset资源进行编译,生成odr资源,odr资源到Product的OnDemandResources中,非odr资源放到组件bundle中
|
130
|
+
if ENV["WRAPPER_EXTENSION"] && `xcrun --find actool`.strip != "" && !xcasset_files.empty?
|
131
|
+
actool_cmd = [
|
132
|
+
"xcrun", "actool",
|
133
|
+
"--output-format", "human-readable-text",
|
134
|
+
"--notices", "--warnings",
|
135
|
+
"--platform", ENV["PLATFORM_NAME"],
|
136
|
+
"--minimum-deployment-target", ENV["#{ENV['DEPLOYMENT_TARGET_SETTING_NAME']}"],
|
137
|
+
*ENV["TARGET_DEVICE_ARGS"].to_s.split,
|
138
|
+
"--compress-pngs",
|
139
|
+
"--enable-on-demand-resources", "YES",
|
140
|
+
"--asset-pack-output-specifications", asset_pack_output_specifications_plist_path.to_s,
|
141
|
+
"--compile", pod_bundle_path.to_s,
|
142
|
+
*xcasset_files.map(&:to_s)
|
143
|
+
].compact
|
144
|
+
system(*actool_cmd)
|
145
|
+
end
|
146
|
+
FileUtils.rm_rf(temp_dir)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
# OnDemandResources.plist放到.app中,用于系统读取odr资源
|
151
|
+
app_on_demand_resources_plist_path = app_path + "OnDemandResources.plist"
|
152
|
+
write_to_path(app_on_demand_resources_plist, app_on_demand_resources_plist_path)
|
153
|
+
|
154
|
+
# 生成AssetPackManifestTemplate.plist放到.app中,用于系统读取odr记载路径与信息(archive时,系统会使用此文件生成新的AssetPackManifest.plist)
|
155
|
+
asset_pack_manifest_template_plist_path = app_path + "AssetPackManifestTemplate.plist"
|
156
|
+
manifest_url = "http://127.0.0.1"
|
157
|
+
|
158
|
+
manifest_template_plist_hash = {}
|
159
|
+
manifest_template_resources = []
|
160
|
+
manifest_template_plist_hash["resources"] = manifest_template_resources
|
161
|
+
|
162
|
+
Dir.foreach(target_build_on_demand_resources_path) do |sub_file|
|
163
|
+
if sub_file != "." && sub_file != ".." && sub_file != ".DS_Store"
|
164
|
+
resources_item = {}
|
165
|
+
primary_content_hash = {}
|
166
|
+
time = Time.now
|
167
|
+
primary_content_hash["hash"] = time.utc.strftime('%Y-%m-%dT%H:%M:%S.000Z')
|
168
|
+
primary_content_hash["strategy"] = "modtime"
|
169
|
+
resources_item["primaryContentHash"] = primary_content_hash
|
170
|
+
resources_item["isStreamable"] = true
|
171
|
+
total_size = 0
|
172
|
+
Dir.foreach(target_build_on_demand_resources_path + sub_file) do |resource|
|
173
|
+
if resource != "." && resource != ".." && resource != ".DS_Store"
|
174
|
+
if resource == "Info.plist"
|
175
|
+
info_plist = Xcodeproj::Plist.read_from_path(target_build_on_demand_resources_path + sub_file + resource)
|
176
|
+
priority = info_plist["Priority"]
|
177
|
+
if priority && priority > 0
|
178
|
+
resources_item["downloadPriority"] = priority
|
179
|
+
end
|
180
|
+
resources_item["bundleKey"] = info_plist["CFBundleIdentifier"]
|
181
|
+
else
|
182
|
+
resources_item["URL"] = "#{manifest_url}#{target_build_on_demand_resources_path}/#{sub_file}"
|
183
|
+
total_size = total_size + File.size(target_build_on_demand_resources_path + sub_file + resource)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
resources_item["uncompressedSize"] = total_size
|
188
|
+
manifest_template_resources << resources_item
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
if manifest_template_resources.size > 0
|
193
|
+
write_to_path(manifest_template_plist_hash, asset_pack_manifest_template_plist_path)
|
194
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
#!/bin/sh
|
2
2
|
|
3
3
|
set -e
|
4
4
|
set -u
|
@@ -13,14 +13,8 @@ if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then
|
|
13
13
|
exit 0
|
14
14
|
fi
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
TARGET_DIR=${INSTALL_DIR}
|
19
|
-
fi
|
20
|
-
|
21
|
-
KZ_ON_DEMAND_RESOURCES_PATH="${KZ_POD_CONFIG_ROOT}/OnDemandResources/Bundles"
|
22
|
-
if [ ! -d $KZ_ON_DEMAND_RESOURCES_PATH ]; then
|
23
|
-
exit 0
|
16
|
+
if [ -z "${KZ_ON_DEMAND_RESOURCES_PATHS+x}" ]; then
|
17
|
+
exit 0
|
24
18
|
fi
|
25
19
|
|
26
20
|
case "${TARGETED_DEVICE_FAMILY:-}" in
|
@@ -88,75 +82,4 @@ if [ -z $RUBY_PATH ];then
|
|
88
82
|
exit 1
|
89
83
|
fi
|
90
84
|
|
91
|
-
|
92
|
-
if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]] ; then
|
93
|
-
BUILDE_ON_DEMAND_RESOURCES_PATH="${INSTALL_ROOT}/OnDemandResources"
|
94
|
-
fi
|
95
|
-
mkdir -p $BUILDE_ON_DEMAND_RESOURCES_PATH
|
96
|
-
|
97
|
-
# 拷贝所有配置,供代码中读取
|
98
|
-
KZ_ON_DEMAND_RESOURCES_ALL_CONFIG_PATH="${KZ_POD_CONFIG_ROOT}/OnDemandResources/KZOnDemandResourcesAllConfig.plist"
|
99
|
-
if [ -e $KZ_ON_DEMAND_RESOURCES_ALL_CONFIG_PATH ]; then
|
100
|
-
cp "${KZ_ON_DEMAND_RESOURCES_ALL_CONFIG_PATH}" "${TARGET_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/"
|
101
|
-
fi
|
102
|
-
|
103
|
-
ls $KZ_ON_DEMAND_RESOURCES_PATH | while read line
|
104
|
-
do
|
105
|
-
KZ_ON_DEMAND_RESOURCES_BUNDLE_INFO_PATH="${KZ_ON_DEMAND_RESOURCES_PATH}/${line}/TargetBundleInfo.plist"
|
106
|
-
if [ ! -f $KZ_ON_DEMAND_RESOURCES_BUNDLE_INFO_PATH ] ; then
|
107
|
-
continue
|
108
|
-
fi
|
109
|
-
|
110
|
-
TARGET_BUILD_DIR_BUNDLE="${TARGET_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/${line}.bundle"
|
111
|
-
|
112
|
-
if [ ! -d $TARGET_BUILD_DIR_BUNDLE ] ; then
|
113
|
-
mkdir -p $TARGET_BUILD_DIR_BUNDLE
|
114
|
-
fi
|
115
|
-
|
116
|
-
KZ_BUILDE_ON_DEMAND_RESOURCES_PATH="${TARGET_TEMP_DIR}/${line}/KZOnDemandResources"
|
117
|
-
mkdir -p $KZ_BUILDE_ON_DEMAND_RESOURCES_PATH
|
118
|
-
|
119
|
-
# copy on demand resources
|
120
|
-
BUNDLE_ON_DEMAND_RESOURCES="${KZ_ON_DEMAND_RESOURCES_PATH}/${line}/OnDemandResources"
|
121
|
-
if [ -d $BUNDLE_ON_DEMAND_RESOURCES ] ; then
|
122
|
-
cp -r $BUNDLE_ON_DEMAND_RESOURCES/ $BUILDE_ON_DEMAND_RESOURCES_PATH/
|
123
|
-
fi
|
124
|
-
# copy on demand resources plist
|
125
|
-
BUNDLE_ON_DEMAND_RESOURCES_PLIST="${KZ_ON_DEMAND_RESOURCES_PATH}/${line}/OnDemandResources.plist"
|
126
|
-
if [ -f $BUNDLE_ON_DEMAND_RESOURCES_PLIST ] ; then
|
127
|
-
cp $BUNDLE_ON_DEMAND_RESOURCES_PLIST $TARGET_BUILD_DIR_BUNDLE
|
128
|
-
fi
|
129
|
-
# complete asset pack output specifications plist
|
130
|
-
ASSET_PACK_OUTPUT_SPECIFICATIONS="${KZ_ON_DEMAND_RESOURCES_PATH}/${line}/AssetPackOutputSpecifications.plist"
|
131
|
-
if [ ! -f $ASSET_PACK_OUTPUT_SPECIFICATIONS ] ; then
|
132
|
-
continue
|
133
|
-
fi
|
134
|
-
cp -f $ASSET_PACK_OUTPUT_SPECIFICATIONS $KZ_BUILDE_ON_DEMAND_RESOURCES_PATH
|
135
|
-
ASSET_PACK_OUTPUT_SPECIFICATIONS="${KZ_BUILDE_ON_DEMAND_RESOURCES_PATH}/AssetPackOutputSpecifications.plist"
|
136
|
-
$RUBY_PATH "${KZ_POD_CONFIG_ROOT}/SupportFiles/on_demand_resources/kz_complete_asset_pack_output_spec_plist.rb" "${BUILDE_ON_DEMAND_RESOURCES_PATH}" "${ASSET_PACK_OUTPUT_SPECIFICATIONS}"
|
137
|
-
ORIGIN_ASSETS_CAR=$TARGET_BUILD_DIR_BUNDLE/"Assets.car"
|
138
|
-
if [ -f $ORIGIN_ASSETS_CAR ] ; then
|
139
|
-
rm $ORIGIN_ASSETS_CAR
|
140
|
-
fi
|
141
|
-
XCASSET_FILES=()
|
142
|
-
XCASSETS_PATHS=$(/usr/libexec/PlistBuddy -c "Print xcassets_paths" $KZ_ON_DEMAND_RESOURCES_BUNDLE_INFO_PATH)
|
143
|
-
while read xcassets; do
|
144
|
-
if [[ $xcassets != "Array {" ]] && [[ $xcassets != "}" ]] ; then
|
145
|
-
if [ ! -d $xcassets ] ; then
|
146
|
-
continue
|
147
|
-
else
|
148
|
-
XCASSET_FILES+=("$xcassets")
|
149
|
-
fi
|
150
|
-
fi
|
151
|
-
done <<<"$XCASSETS_PATHS"
|
152
|
-
if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ] ; then
|
153
|
-
printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --platform "${PLATFORM_NAME}" --compress-pngs --enable-on-demand-resources YES --asset-pack-output-specifications "${ASSET_PACK_OUTPUT_SPECIFICATIONS}" --compile "${TARGET_BUILD_DIR_BUNDLE}"
|
154
|
-
fi
|
155
|
-
done
|
156
|
-
|
157
|
-
ASSET_PACK_MANIFEST_TEMPLATE_PATH="${TARGET_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AssetPackManifestTemplate.plist"
|
158
|
-
ON_DEMAND_RESOUCES_PATH="${TARGET_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/OnDemandResources.plist"
|
159
|
-
# create asset pack manifest template
|
160
|
-
$RUBY_PATH "${KZ_POD_CONFIG_ROOT}/SupportFiles/on_demand_resources/kz_create_asset_pack_manifest_plist.rb" "${BUILDE_ON_DEMAND_RESOURCES_PATH}" "${ASSET_PACK_MANIFEST_TEMPLATE_PATH}"
|
161
|
-
# create on demand resources to .app
|
162
|
-
$RUBY_PATH "${KZ_POD_CONFIG_ROOT}/SupportFiles/on_demand_resources/kz_create_on_demand_resources_plis.rb" "${KZ_ON_DEMAND_RESOURCES_PATH}" "${ON_DEMAND_RESOUCES_PATH}"
|
85
|
+
$RUBY_PATH "${KZ_POD_CONFIG_ROOT}/SupportFiles/on_demand_resources/kz_on_demand_resources_process.rb"
|
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.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yixiong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -57,7 +57,8 @@ files:
|
|
57
57
|
- lib/cocoapods-kz/helpers/kz_analyzer.rb
|
58
58
|
- lib/cocoapods-kz/helpers/kz_config_result.rb
|
59
59
|
- lib/cocoapods-kz/helpers/kz_framework_manager.rb
|
60
|
-
- lib/cocoapods-kz/helpers/
|
60
|
+
- lib/cocoapods-kz/helpers/kz_generator_hmap.rb
|
61
|
+
- lib/cocoapods-kz/helpers/kz_generator_on_demand_resources.rb
|
61
62
|
- lib/cocoapods-kz/helpers/kz_global_helper.rb
|
62
63
|
- lib/cocoapods-kz/helpers/kz_log.rb
|
63
64
|
- lib/cocoapods-kz/helpers/kz_pod_target.rb
|
@@ -65,10 +66,11 @@ files:
|
|
65
66
|
- lib/cocoapods-kz/helpers/repair_module_import.rb
|
66
67
|
- lib/cocoapods-kz/native.rb
|
67
68
|
- lib/cocoapods-kz/native/acknowledgements.rb
|
69
|
+
- lib/cocoapods-kz/native/build_configuration.rb
|
68
70
|
- lib/cocoapods-kz/native/dls.rb
|
69
|
-
- lib/cocoapods-kz/native/dsl_spec.rb
|
70
71
|
- lib/cocoapods-kz/native/file_accessor.rb
|
71
72
|
- lib/cocoapods-kz/native/installer.rb
|
73
|
+
- lib/cocoapods-kz/native/path_list.rb
|
72
74
|
- lib/cocoapods-kz/native/pod_target.rb
|
73
75
|
- lib/cocoapods-kz/native/pod_target_installer.rb
|
74
76
|
- lib/cocoapods-kz/native/pod_target_integrator.rb
|
@@ -78,6 +80,7 @@ files:
|
|
78
80
|
- lib/cocoapods-kz/native/target_installer_helper.rb
|
79
81
|
- lib/cocoapods-kz/native/target_integrator.rb
|
80
82
|
- lib/cocoapods-kz/resources/FlexCompiler
|
83
|
+
- lib/cocoapods-kz/resources/FlexCompiler_V1
|
81
84
|
- lib/cocoapods-kz/resources/arm64ToSimulator
|
82
85
|
- lib/cocoapods-kz/resources/hmap
|
83
86
|
- lib/cocoapods-kz/resources/kz_fix_force_load_exe.sh
|
@@ -85,9 +88,7 @@ files:
|
|
85
88
|
- lib/cocoapods-kz/resources/kz_improve_custom_yaml.sh
|
86
89
|
- lib/cocoapods-kz/resources/kz_refresh_pods_pbxproj.rb
|
87
90
|
- lib/cocoapods-kz/resources/kz_xml_build.sh
|
88
|
-
- lib/cocoapods-kz/resources/on_demand_resources/
|
89
|
-
- lib/cocoapods-kz/resources/on_demand_resources/kz_create_asset_pack_manifest_plist.rb
|
90
|
-
- lib/cocoapods-kz/resources/on_demand_resources/kz_create_on_demand_resources_plis.rb
|
91
|
+
- lib/cocoapods-kz/resources/on_demand_resources/kz_on_demand_resources_process.rb
|
91
92
|
- lib/cocoapods-kz/resources/on_demand_resources/kz_on_demand_resources_xocde.sh
|
92
93
|
- lib/cocoapods_plugin.rb
|
93
94
|
homepage: https://github.com/EXAMPLE/cocoapods-kz
|
data/lib/cocoapods-kz/resources/on_demand_resources/kz_complete_asset_pack_output_spec_plist.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'xcodeproj'
|
2
|
-
autoload :Nanaimo, 'nanaimo'
|
3
|
-
|
4
|
-
def write_to_path(hash, path)
|
5
|
-
unless path.is_a?(String) || path.is_a?(Pathname)
|
6
|
-
raise TypeError, "The given `#{path}` must be a string or 'pathname'."
|
7
|
-
end
|
8
|
-
path = path.to_s
|
9
|
-
raise IOError, 'Empty path.' if path.empty?
|
10
|
-
|
11
|
-
File.open(path, 'w') do |f|
|
12
|
-
plist = Nanaimo::Plist.new(hash, :xml)
|
13
|
-
Nanaimo::Writer::XMLWriter.new(plist, :pretty => true, :output => f, :strict => false).write
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
on_demand_resources_folder = ARGV[0]
|
18
|
-
asset_pack_output_specifications_plist_path = ARGV[1]
|
19
|
-
asset_pack_output_specifications_plist = Xcodeproj::Plist.read_from_path(asset_pack_output_specifications_plist_path)
|
20
|
-
asset_pack_output_specifications_plist.each do |item|
|
21
|
-
bundle_paht = item["bundle-path"]
|
22
|
-
unless bundle_paht.start_with?(on_demand_resources_folder)
|
23
|
-
item["bundle-path"] = "#{on_demand_resources_folder}/#{bundle_paht}"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
write_to_path(asset_pack_output_specifications_plist, asset_pack_output_specifications_plist_path)
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'xcodeproj'
|
2
|
-
require "date"
|
3
|
-
|
4
|
-
on_demand_resources_path = ARGV[0]
|
5
|
-
manifest_template_plist_path = ARGV[1]
|
6
|
-
manifest_url = "http://127.0.0.1"
|
7
|
-
|
8
|
-
manifest_template_plist_hash = {}
|
9
|
-
manifest_template_resources = []
|
10
|
-
manifest_template_plist_hash["resources"] = manifest_template_resources
|
11
|
-
|
12
|
-
Dir.foreach(on_demand_resources_path) do |sub_file|
|
13
|
-
if sub_file != "." && sub_file != ".." && sub_file != ".DS_Store"
|
14
|
-
resources_item = {}
|
15
|
-
primary_content_hash = {}
|
16
|
-
time = Time.now
|
17
|
-
primary_content_hash["hash"] = time.utc.strftime('%Y-%m-%dT%H:%M:%S.000Z')
|
18
|
-
primary_content_hash["strategy"] = "modtime"
|
19
|
-
resources_item["primaryContentHash"] = primary_content_hash
|
20
|
-
resources_item["isStreamable"] = true
|
21
|
-
total_size = 0
|
22
|
-
Dir.foreach("#{on_demand_resources_path}/#{sub_file}") do |resource|
|
23
|
-
if resource != "." && resource != ".." && resource != ".DS_Store"
|
24
|
-
if resource == "Info.plist"
|
25
|
-
info_plist = Xcodeproj::Plist.read_from_path("#{on_demand_resources_path}/#{sub_file}/#{resource}")
|
26
|
-
priority = info_plist["Priority"]
|
27
|
-
if priority && priority > 0
|
28
|
-
resources_item["downloadPriority"] = priority
|
29
|
-
end
|
30
|
-
resources_item["bundleKey"] = info_plist["CFBundleIdentifier"]
|
31
|
-
else
|
32
|
-
resources_item["URL"] = "#{manifest_url}#{on_demand_resources_path}/#{sub_file}"
|
33
|
-
total_size = total_size + File.size("#{on_demand_resources_path}/#{sub_file}/#{resource}")
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
resources_item["uncompressedSize"] = total_size
|
38
|
-
manifest_template_resources << resources_item
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
if manifest_template_resources.size > 0
|
43
|
-
Xcodeproj::Plist.write_to_path(manifest_template_plist_hash, manifest_template_plist_path)
|
44
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'xcodeproj'
|
2
|
-
|
3
|
-
kz_on_demand_resources_path = ARGV[0]
|
4
|
-
on_demand_resources_plist_path = ARGV[1]
|
5
|
-
|
6
|
-
on_demand_resources_plist = {}
|
7
|
-
bundle_resource_request_tags = {}
|
8
|
-
on_demand_resources_plist["NSBundleResourceRequestTags"] = bundle_resource_request_tags
|
9
|
-
bundle_resource_request_asset_packs = {}
|
10
|
-
on_demand_resources_plist["NSBundleResourceRequestAssetPacks"] = bundle_resource_request_asset_packs
|
11
|
-
|
12
|
-
Dir.foreach(kz_on_demand_resources_path) do |sub_file|
|
13
|
-
if sub_file != "." && sub_file != ".." && sub_file != ".DS_Store"
|
14
|
-
Dir.foreach("#{kz_on_demand_resources_path}/#{sub_file}") do |plist|
|
15
|
-
if plist == "OnDemandResources.plist"
|
16
|
-
info_plist = Xcodeproj::Plist.read_from_path("#{kz_on_demand_resources_path}/#{sub_file}/#{plist}")
|
17
|
-
bundle_resource_request_tags.update(info_plist["NSBundleResourceRequestTags"])
|
18
|
-
bundle_resource_request_asset_packs.update(info_plist["NSBundleResourceRequestAssetPacks"])
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
if bundle_resource_request_tags.size > 0 || bundle_resource_request_asset_packs.size > 0
|
25
|
-
Xcodeproj::Plist.write_to_path(on_demand_resources_plist, on_demand_resources_plist_path)
|
26
|
-
end
|