cocoapods-kz 0.0.10 → 0.0.13
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 +30 -23
- data/lib/cocoapods-kz/command/install.rb +13 -3
- data/lib/cocoapods-kz/command/update.rb +13 -3
- data/lib/cocoapods-kz/gem_version.rb +1 -1
- data/lib/cocoapods-kz/helpers/kz_framework_manager.rb +169 -1
- data/lib/cocoapods-kz/helpers/kz_generator.rb +370 -39
- data/lib/cocoapods-kz/helpers/kz_global_helper.rb +28 -1
- data/lib/cocoapods-kz/helpers/kz_log.rb +11 -0
- data/lib/cocoapods-kz/helpers/kz_pod_target.rb +26 -6
- data/lib/cocoapods-kz/native/dls.rb +10 -0
- data/lib/cocoapods-kz/native/dsl_spec.rb +7 -0
- data/lib/cocoapods-kz/native/file_accessor.rb +8 -3
- data/lib/cocoapods-kz/native/installer.rb +3 -0
- data/lib/cocoapods-kz/native/pod_target_installer.rb +23 -0
- data/lib/cocoapods-kz/native/pod_target_integrator.rb +62 -0
- data/lib/cocoapods-kz/native/target_installer_helper.rb +40 -0
- data/lib/cocoapods-kz/native/target_integrator.rb +34 -0
- data/lib/cocoapods-kz/native.rb +2 -0
- data/lib/cocoapods-kz/resources/arm64ToSimulator +0 -0
- data/lib/cocoapods-kz/resources/kz_generator_framework.sh +6 -2
- data/lib/cocoapods-kz/resources/kz_improve_custom_yaml.sh +25 -0
- data/lib/cocoapods-kz/resources/kz_refresh_pods_pbxproj.rb +10 -6
- data/lib/cocoapods-kz/resources/on_demand_resources/kz_complete_asset_pack_output_spec_plist.rb +26 -0
- data/lib/cocoapods-kz/resources/on_demand_resources/kz_create_asset_pack_manifest_plist.rb +44 -0
- data/lib/cocoapods-kz/resources/on_demand_resources/kz_create_on_demand_resources_plis.rb +26 -0
- data/lib/cocoapods-kz/resources/on_demand_resources/kz_on_demand_resources_xocde.sh +162 -0
- metadata +13 -3
@@ -72,10 +72,15 @@ module Pod
|
|
72
72
|
|
73
73
|
alias_method :origin_vendored_frameworks, :vendored_frameworks
|
74
74
|
def vendored_frameworks
|
75
|
-
|
76
|
-
if !self.spec.test_specification && result
|
75
|
+
if self.kz_pod_target
|
77
76
|
frameworks = origin_vendored_frameworks
|
78
|
-
frameworks.
|
77
|
+
if KZ::KZGlobalHelper.instance.arm64_simulator && frameworks.count > 0
|
78
|
+
frameworks = KZ::KZFrameworkManager.handle_origin_framework(frameworks, self.kz_pod_target)
|
79
|
+
end
|
80
|
+
result = KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
|
81
|
+
if !self.spec.test_specification && result
|
82
|
+
frameworks.concat(result.get_framework_paths)
|
83
|
+
end
|
79
84
|
frameworks
|
80
85
|
else
|
81
86
|
origin_vendored_frameworks
|
@@ -24,6 +24,9 @@ module Pod
|
|
24
24
|
if KZ::KZGlobalHelper.instance.kz_pod_enable
|
25
25
|
# hmap的创建需要在download之后,integrate之前
|
26
26
|
KZ::KZGlobalHelper.instance.kz_generator.create_hamp
|
27
|
+
unless KZ::KZGlobalHelper.instance.on_demand_resources_bundle_id.nil?
|
28
|
+
KZ::KZGlobalHelper.instance.kz_generator.create_on_demand_resources
|
29
|
+
end
|
27
30
|
end
|
28
31
|
original_integrate
|
29
32
|
end
|
@@ -27,6 +27,10 @@ module Pod
|
|
27
27
|
if kz_pod_target.force_load
|
28
28
|
KZ::KZGlobalHelper.instance.kz_generator.add_force_load_exe_path_build_phase(target_installation_result.native_target, kz_pod_target.force_load_info)
|
29
29
|
end
|
30
|
+
|
31
|
+
unless kz_pod_target.custom_origin_yaml_path.nil?
|
32
|
+
KZ::KZGlobalHelper.instance.kz_generator.add_improve_yaml_build_phase(self.project, target_installation_result.native_target, kz_pod_target.custom_yaml_path)
|
33
|
+
end
|
30
34
|
end
|
31
35
|
|
32
36
|
if kz_pod_target && !kz_pod_target.use_modulemap
|
@@ -39,6 +43,25 @@ module Pod
|
|
39
43
|
target_installation_result
|
40
44
|
end
|
41
45
|
|
46
|
+
alias_method :origin_filter_resource_file_references, :filter_resource_file_references
|
47
|
+
def filter_resource_file_references(resource_file_references)
|
48
|
+
kz_pod_target = self.target.weakRef_kz_pod_target
|
49
|
+
if kz_pod_target
|
50
|
+
new_resource_file_references = []
|
51
|
+
odr_resources = kz_pod_target.get_on_demand_resources
|
52
|
+
resource_file_references.each do |path|
|
53
|
+
new_resource_file_references.push(path) unless odr_resources.include?(path)
|
54
|
+
end
|
55
|
+
origin_filter_resource_file_references(new_resource_file_references) do |compile_phase_refs, resources_phase_refs|
|
56
|
+
yield compile_phase_refs, resources_phase_refs
|
57
|
+
end
|
58
|
+
else
|
59
|
+
origin_filter_resource_file_references(resource_file_references) do |compile_phase_refs, resources_phase_refs|
|
60
|
+
yield compile_phase_refs, resources_phase_refs
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
42
65
|
end
|
43
66
|
end
|
44
67
|
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module Pod
|
2
|
+
class Installer
|
3
|
+
class Xcode
|
4
|
+
class PodsProjectGenerator
|
5
|
+
|
6
|
+
class PodTargetIntegrator
|
7
|
+
$global_output_paths_avoid_duplicate = []
|
8
|
+
|
9
|
+
def add_copy_xcframeworks_script_phase(native_target)
|
10
|
+
script_path = "${PODS_ROOT}/#{target.copy_xcframeworks_script_path.relative_path_from(target.sandbox.root)}"
|
11
|
+
|
12
|
+
input_paths_by_config = {}
|
13
|
+
output_paths_by_config = {}
|
14
|
+
|
15
|
+
xcframeworks = target.xcframeworks.values.flatten
|
16
|
+
|
17
|
+
if use_input_output_paths? && !xcframeworks.empty?
|
18
|
+
input_file_list_path = target.copy_xcframeworks_script_input_files_path
|
19
|
+
input_file_list_relative_path = "${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}"
|
20
|
+
input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)
|
21
|
+
input_paths = input_paths_by_config[input_paths_key] = [script_path]
|
22
|
+
|
23
|
+
framework_paths = xcframeworks.map { |xcf| "${PODS_ROOT}/#{xcf.path.relative_path_from(target.sandbox.root)}" }
|
24
|
+
input_paths.concat framework_paths
|
25
|
+
|
26
|
+
output_file_list_path = target.copy_xcframeworks_script_output_files_path
|
27
|
+
output_file_list_relative_path = "${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}"
|
28
|
+
output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)
|
29
|
+
output_paths_by_config[output_paths_key] = xcframeworks.map do |xcf|
|
30
|
+
"#{Target::BuildSettings::XCFRAMEWORKS_BUILD_DIR_VARIABLE}/#{xcf.target_name}/#{xcf.name}.framework"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
if xcframeworks.empty?
|
35
|
+
UserProjectIntegrator::TargetIntegrator.remove_copy_xcframeworks_script_phase_from_target(native_target)
|
36
|
+
else
|
37
|
+
if target_installation_result.target.scope_suffix
|
38
|
+
output_paths_by_config.each do |key, value|
|
39
|
+
if value && value.count > 0
|
40
|
+
need_remove_paths = []
|
41
|
+
value.each do |path|
|
42
|
+
if $global_output_paths_avoid_duplicate.include?(path)
|
43
|
+
need_remove_paths.append(path)
|
44
|
+
else
|
45
|
+
$global_output_paths_avoid_duplicate.append(path)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
need_remove_paths.each do |need_remove_path|
|
49
|
+
value.delete(need_remove_path)
|
50
|
+
end if need_remove_paths.count > 0
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
UserProjectIntegrator::TargetIntegrator.create_or_update_copy_xcframeworks_script_phase_to_target(
|
55
|
+
native_target, script_path, input_paths_by_config, output_paths_by_config)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -37,6 +37,10 @@ module Pod
|
|
37
37
|
end
|
38
38
|
xcconfig.attributes['HEADER_SEARCH_PATHS'] = main_hamp_search_path
|
39
39
|
xcconfig.attributes['USE_HEADERMAP'] = 'NO'
|
40
|
+
if KZ::KZGlobalHelper.instance.arm64_simulator
|
41
|
+
xcconfig.attributes.delete("EXCLUDED_ARCHS[sdk=iphonesimulator*]")
|
42
|
+
xcconfig.attributes['VALID_ARCHS'] = 'arm64 arm64_32 x86_64'
|
43
|
+
end
|
40
44
|
|
41
45
|
kz_update_xcconfig_file(xcconfig, path)
|
42
46
|
return
|
@@ -55,6 +59,42 @@ module Pod
|
|
55
59
|
if kz_pod_target.force_load
|
56
60
|
xcconfig.attributes['KZ_FIX_FORCE_LOAD_EXE_FOLDER'] = kz_pod_target.configuration_build_dir(true)
|
57
61
|
end
|
62
|
+
if KZ::KZGlobalHelper.instance.arm64_simulator
|
63
|
+
xcconfig.attributes.delete("EXCLUDED_ARCHS[sdk=iphonesimulator*]")
|
64
|
+
xcconfig.attributes['VALID_ARCHS'] = 'arm64 arm64_32 x86_64'
|
65
|
+
end
|
66
|
+
|
67
|
+
unless kz_pod_target.custom_origin_yaml_path.nil?
|
68
|
+
xcconfig.attributes['KZ_CUSTOM_ORIGIN_YAML_PATH'] = kz_pod_target.custom_origin_yaml_path
|
69
|
+
xcconfig.attributes['KZ_CUSTOM_YAML_PATH'] = kz_pod_target.custom_yaml_path
|
70
|
+
|
71
|
+
other_cflags = xcconfig.attributes['OTHER_CFLAGS']
|
72
|
+
if other_cflags == nil
|
73
|
+
other_cflags = ""
|
74
|
+
elsif !other_cflags.end_with?(" ")
|
75
|
+
other_cflags += " "
|
76
|
+
end
|
77
|
+
other_cflags += ("-ivfsoverlay #{KZ.deal_path_for_xcconfig(kz_pod_target.custom_yaml_path, true)}")
|
78
|
+
xcconfig.attributes['OTHER_CFLAGS'] = other_cflags
|
79
|
+
|
80
|
+
other_cplusplusflags = xcconfig.attributes['OTHER_CPLUSPLUSFLAGS']
|
81
|
+
if other_cplusplusflags == nil
|
82
|
+
other_cplusplusflags = ""
|
83
|
+
elsif !other_cplusplusflags.end_with?(" ")
|
84
|
+
other_cplusplusflags += " "
|
85
|
+
end
|
86
|
+
other_cplusplusflags += ("-ivfsoverlay #{KZ.deal_path_for_xcconfig(kz_pod_target.custom_yaml_path, true)}")
|
87
|
+
xcconfig.attributes['OTHER_CPLUSPLUSFLAGS'] = other_cplusplusflags
|
88
|
+
|
89
|
+
other_swift_flags = xcconfig.attributes['OTHER_SWIFT_FLAGS']
|
90
|
+
if other_swift_flags == nil
|
91
|
+
other_swift_flags = ""
|
92
|
+
elsif !other_swift_flags.end_with?(" ")
|
93
|
+
other_swift_flags += " "
|
94
|
+
end
|
95
|
+
other_swift_flags += ("-Xcc -ivfsoverlay -Xcc #{KZ.deal_path_for_xcconfig(kz_pod_target.custom_yaml_path, true)}")
|
96
|
+
xcconfig.attributes['OTHER_SWIFT_FLAGS'] = other_swift_flags
|
97
|
+
end
|
58
98
|
|
59
99
|
add_repair_modulemap(xcconfig, kz_pod_target.all_repair_modulemap_paths, kz_pod_target.current_uses_swift?)
|
60
100
|
add_repair_swift_include_path(xcconfig, kz_pod_target.all_repair_swift_include_paths, kz_pod_target.current_uses_swift?)
|
@@ -0,0 +1,34 @@
|
|
1
|
+
|
2
|
+
module Pod
|
3
|
+
class Installer
|
4
|
+
class UserProjectIntegrator
|
5
|
+
class TargetIntegrator
|
6
|
+
|
7
|
+
alias_method :origin_integrate!, :integrate!
|
8
|
+
def integrate!
|
9
|
+
origin_integrate!
|
10
|
+
|
11
|
+
unless KZ::KZGlobalHelper.instance.on_demand_resources_bundle_id.nil?
|
12
|
+
add_on_demand_resources_script_phase
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def add_on_demand_resources_script_phase
|
17
|
+
phase_name = "[KZ] On Demand Resources Build"
|
18
|
+
native_targets.each do |native_target|
|
19
|
+
if native_target.isa == "PBXNativeTarget" && native_target.product_type == "com.apple.product-type.application"
|
20
|
+
phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, phase_name)
|
21
|
+
native_target.build_phases.push(phase).uniq! unless native_target.build_phases.include?(phase)
|
22
|
+
phase.shell_script = KZ.deal_path_for_xcconfig(KZ::KZ_ON_DEMAND_RESOURCES_SHELL, true)
|
23
|
+
|
24
|
+
native_target.build_configurations.each do |config|
|
25
|
+
config.build_settings["ENABLE_ON_DEMAND_RESOURCES"] = "NO"
|
26
|
+
config.build_settings["KZ_POD_CONFIG_ROOT"] = KZ::KZ_POD_CONFIG_ROOT_STR
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/cocoapods-kz/native.rb
CHANGED
@@ -12,4 +12,6 @@ if Pod.match_version?('~> 1.11')
|
|
12
12
|
require 'cocoapods-kz/native/pod_target_installer'
|
13
13
|
require 'cocoapods-kz/native/specification'
|
14
14
|
require 'cocoapods-kz/native/pods_project_writer'
|
15
|
+
require 'cocoapods-kz/native/pod_target_integrator'
|
16
|
+
require 'cocoapods-kz/native/target_integrator'
|
15
17
|
end
|
Binary file
|
@@ -3,9 +3,13 @@ if [ "${MACH_O_TYPE}" != "staticlib" ]; then
|
|
3
3
|
fi
|
4
4
|
|
5
5
|
if [ -d "${KZ_FRAMEWORK_CACHE_PATH}" ]; then
|
6
|
-
|
6
|
+
if [ -d "${KZ_FRAMEWORK_CACHE_PATH}/${PRODUCT_NAME}.xcframework" ]; then
|
7
|
+
rm -r "${KZ_FRAMEWORK_CACHE_PATH}/${PRODUCT_NAME}.xcframework"
|
8
|
+
fi
|
9
|
+
else
|
10
|
+
mkdir -p "${KZ_FRAMEWORK_CACHE_PATH}"
|
7
11
|
fi
|
8
|
-
|
12
|
+
|
9
13
|
|
10
14
|
CURRENT_PRODUCT_DIR=${PODS_CONFIGURATION_BUILD_DIR}/${TARGET_NAME}
|
11
15
|
find "${CURRENT_PRODUCT_DIR}" -iname "*.bundle" | while read -r BUNDLE_FILE; do
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
set -e
|
3
|
+
set -u
|
4
|
+
set -o pipefail
|
5
|
+
|
6
|
+
function on_error {
|
7
|
+
echo "$(realpath -mq "${0}"):$1: error: Unexpected failure"
|
8
|
+
}
|
9
|
+
trap 'on_error $LINENO' ERR
|
10
|
+
|
11
|
+
if [ -z "${KZ_CUSTOM_ORIGIN_YAML_PATH+x}" ]; then
|
12
|
+
exit 0
|
13
|
+
fi
|
14
|
+
|
15
|
+
if [ -z "${KZ_CUSTOM_YAML_PATH+x}" ]; then
|
16
|
+
exit 0
|
17
|
+
fi
|
18
|
+
|
19
|
+
if [ ! -f "$KZ_CUSTOM_ORIGIN_YAML_PATH" ]; then
|
20
|
+
exit 0
|
21
|
+
fi
|
22
|
+
|
23
|
+
cp -f "$KZ_CUSTOM_ORIGIN_YAML_PATH" "$KZ_CUSTOM_YAML_PATH"
|
24
|
+
|
25
|
+
sed -i.bak "s|__built_products_dir__|${BUILT_PRODUCTS_DIR}|g" "$KZ_CUSTOM_YAML_PATH" && rm "$KZ_CUSTOM_YAML_PATH.bak"
|
@@ -4,12 +4,16 @@ require 'pathname'
|
|
4
4
|
current_pods_pbxproj_path = Pathname.new(ARGV[0])
|
5
5
|
temp_pods_pbxproj_path = Pathname.new(ARGV[1])
|
6
6
|
|
7
|
-
if
|
8
|
-
FileUtils.
|
9
|
-
|
7
|
+
if File.exist?(temp_pods_pbxproj_path)
|
8
|
+
if !File.exist?(current_pods_pbxproj_path) || !FileUtils.compare_file(current_pods_pbxproj_path, temp_pods_pbxproj_path)
|
9
|
+
FileUtils.cp_r(temp_pods_pbxproj_path, current_pods_pbxproj_path)
|
10
|
+
end
|
11
|
+
|
12
|
+
FileUtils.rm_r(Pathname(temp_pods_pbxproj_path).dirname)
|
10
13
|
|
11
|
-
xcode_running = system("ps aux | grep '[X]code' > /dev/null 2>&1")
|
12
|
-
if xcode_running
|
13
|
-
|
14
|
+
xcode_running = system("ps aux | grep '[X]code' > /dev/null 2>&1")
|
15
|
+
if xcode_running
|
16
|
+
system("touch #{current_pods_pbxproj_path}")
|
17
|
+
end
|
14
18
|
end
|
15
19
|
|
data/lib/cocoapods-kz/resources/on_demand_resources/kz_complete_asset_pack_output_spec_plist.rb
ADDED
@@ -0,0 +1,26 @@
|
|
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)
|
@@ -0,0 +1,44 @@
|
|
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
|
@@ -0,0 +1,26 @@
|
|
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
|
@@ -0,0 +1,162 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
set -e
|
4
|
+
set -u
|
5
|
+
set -o pipefail
|
6
|
+
|
7
|
+
function on_error {
|
8
|
+
echo "$(realpath -mq "${0}"):$1: error: Unexpected failure"
|
9
|
+
}
|
10
|
+
trap 'on_error $LINENO' ERR
|
11
|
+
|
12
|
+
if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then
|
13
|
+
exit 0
|
14
|
+
fi
|
15
|
+
|
16
|
+
TARGET_DIR=${TARGET_BUILD_DIR}
|
17
|
+
if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]] ; then
|
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
|
24
|
+
fi
|
25
|
+
|
26
|
+
case "${TARGETED_DEVICE_FAMILY:-}" in
|
27
|
+
1,2)
|
28
|
+
TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
|
29
|
+
;;
|
30
|
+
1)
|
31
|
+
TARGET_DEVICE_ARGS="--target-device iphone"
|
32
|
+
;;
|
33
|
+
2)
|
34
|
+
TARGET_DEVICE_ARGS="--target-device ipad"
|
35
|
+
;;
|
36
|
+
3)
|
37
|
+
TARGET_DEVICE_ARGS="--target-device tv"
|
38
|
+
;;
|
39
|
+
4)
|
40
|
+
TARGET_DEVICE_ARGS="--target-device watch"
|
41
|
+
;;
|
42
|
+
*)
|
43
|
+
TARGET_DEVICE_ARGS="--target-device mac"
|
44
|
+
;;
|
45
|
+
esac
|
46
|
+
|
47
|
+
RUBY_PATH=""
|
48
|
+
function find_ruby_path {
|
49
|
+
if [[ "$1" = /* ]] ; then
|
50
|
+
RESOURCE_PATH="$1"
|
51
|
+
else
|
52
|
+
RESOURCE_PATH="${HOME}/$1"
|
53
|
+
fi
|
54
|
+
|
55
|
+
ON_DEMAND_RESOURCES_SHELL_ENV="${TARGET_TEMP_DIR}/kz_on_demand_resources_env_$1"
|
56
|
+
if [ -f $ON_DEMAND_RESOURCES_SHELL_ENV ] ; then
|
57
|
+
rm $ON_DEMAND_RESOURCES_SHELL_ENV
|
58
|
+
fi
|
59
|
+
touch $ON_DEMAND_RESOURCES_SHELL_ENV
|
60
|
+
|
61
|
+
if [ -f $RESOURCE_PATH ] ; then
|
62
|
+
while read line; do
|
63
|
+
if [[ "$line" = export* ]] ; then
|
64
|
+
echo $line >> $ON_DEMAND_RESOURCES_SHELL_ENV
|
65
|
+
fi
|
66
|
+
done < $RESOURCE_PATH
|
67
|
+
|
68
|
+
source $ON_DEMAND_RESOURCES_SHELL_ENV >/dev/null 2>&1
|
69
|
+
if (gem list | grep cocoapods >/dev/null) ; then
|
70
|
+
RUBY_PATH=$(which ruby)
|
71
|
+
fi
|
72
|
+
fi
|
73
|
+
}
|
74
|
+
|
75
|
+
if (gem list | grep cocoapods >/dev/null) ; then
|
76
|
+
RUBY_PATH=$(which ruby)
|
77
|
+
fi
|
78
|
+
|
79
|
+
if [ -z $RUBY_PATH ];then
|
80
|
+
find_ruby_path ".bash_profile"
|
81
|
+
fi
|
82
|
+
|
83
|
+
if [ -z $RUBY_PATH ];then
|
84
|
+
find_ruby_path ".zshrc"
|
85
|
+
fi
|
86
|
+
|
87
|
+
if [ -z $RUBY_PATH ];then
|
88
|
+
exit 1
|
89
|
+
fi
|
90
|
+
|
91
|
+
BUILDE_ON_DEMAND_RESOURCES_PATH="${TARGET_BUILD_DIR}/OnDemandResources"
|
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}"
|
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.13
|
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: 2025-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -59,26 +59,36 @@ files:
|
|
59
59
|
- lib/cocoapods-kz/helpers/kz_framework_manager.rb
|
60
60
|
- lib/cocoapods-kz/helpers/kz_generator.rb
|
61
61
|
- lib/cocoapods-kz/helpers/kz_global_helper.rb
|
62
|
+
- lib/cocoapods-kz/helpers/kz_log.rb
|
62
63
|
- lib/cocoapods-kz/helpers/kz_pod_target.rb
|
63
64
|
- lib/cocoapods-kz/helpers/repair_dynamic_swift.rb
|
64
65
|
- lib/cocoapods-kz/helpers/repair_module_import.rb
|
65
66
|
- lib/cocoapods-kz/native.rb
|
66
67
|
- lib/cocoapods-kz/native/acknowledgements.rb
|
67
68
|
- lib/cocoapods-kz/native/dls.rb
|
69
|
+
- lib/cocoapods-kz/native/dsl_spec.rb
|
68
70
|
- lib/cocoapods-kz/native/file_accessor.rb
|
69
71
|
- lib/cocoapods-kz/native/installer.rb
|
70
72
|
- lib/cocoapods-kz/native/pod_target.rb
|
71
73
|
- lib/cocoapods-kz/native/pod_target_installer.rb
|
74
|
+
- lib/cocoapods-kz/native/pod_target_integrator.rb
|
72
75
|
- lib/cocoapods-kz/native/pods_project_writer.rb
|
73
76
|
- lib/cocoapods-kz/native/specification.rb
|
74
77
|
- lib/cocoapods-kz/native/target.rb
|
75
78
|
- lib/cocoapods-kz/native/target_installer_helper.rb
|
79
|
+
- lib/cocoapods-kz/native/target_integrator.rb
|
76
80
|
- lib/cocoapods-kz/resources/FlexCompiler
|
81
|
+
- lib/cocoapods-kz/resources/arm64ToSimulator
|
77
82
|
- lib/cocoapods-kz/resources/hmap
|
78
83
|
- lib/cocoapods-kz/resources/kz_fix_force_load_exe.sh
|
79
84
|
- lib/cocoapods-kz/resources/kz_generator_framework.sh
|
85
|
+
- lib/cocoapods-kz/resources/kz_improve_custom_yaml.sh
|
80
86
|
- lib/cocoapods-kz/resources/kz_refresh_pods_pbxproj.rb
|
81
87
|
- lib/cocoapods-kz/resources/kz_xml_build.sh
|
88
|
+
- lib/cocoapods-kz/resources/on_demand_resources/kz_complete_asset_pack_output_spec_plist.rb
|
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_xocde.sh
|
82
92
|
- lib/cocoapods_plugin.rb
|
83
93
|
homepage: https://github.com/EXAMPLE/cocoapods-kz
|
84
94
|
licenses:
|
@@ -99,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
109
|
- !ruby/object:Gem::Version
|
100
110
|
version: '0'
|
101
111
|
requirements: []
|
102
|
-
rubygems_version: 3.
|
112
|
+
rubygems_version: 3.5.11
|
103
113
|
signing_key:
|
104
114
|
specification_version: 4
|
105
115
|
summary: Kanzhun's cocoapods manage tools.
|