cocoapods-kz 0.0.6 → 0.0.9
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/clean.rb +61 -0
- data/lib/cocoapods-kz/command/install.rb +5 -4
- data/lib/cocoapods-kz/command/kz.rb +1 -17
- data/lib/cocoapods-kz/command/repair.rb +8 -5
- data/lib/cocoapods-kz/command/update.rb +5 -4
- data/lib/cocoapods-kz/gem_version.rb +1 -1
- data/lib/cocoapods-kz/helpers/kz_analyzer.rb +5 -5
- data/lib/cocoapods-kz/helpers/kz_config_result.rb +2 -2
- data/lib/cocoapods-kz/helpers/kz_framework_manager.rb +5 -5
- data/lib/cocoapods-kz/helpers/kz_generator.rb +62 -101
- data/lib/cocoapods-kz/helpers/kz_global_helper.rb +42 -14
- data/lib/cocoapods-kz/helpers/kz_pod_target.rb +50 -24
- data/lib/cocoapods-kz/native/target_installer_helper.rb +14 -26
- data/lib/cocoapods-kz/resources/kz_generator_framework.sh +41 -0
- data/lib/cocoapods-kz/resources/kz_xml_build.sh +9 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cd6c7deb2a958e5306602d1e1010400b44643a642a27333be9fa8d93405c38f
|
4
|
+
data.tar.gz: 813cf28a218e20fb79a15e284c69dafee039949c2c9c21e4f7467f8350215ade
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61cd3bff4c6e8d50118395abaf1ebcff6e89f6ca9f64d98b636617e62c0c5bb5d8b3d7b5646e4496230d11da36d4a7bf4d9e5f8dec585107b06f3b7ba22d76b4
|
7
|
+
data.tar.gz: 7e47fda547a29835c34f4c761ff9d521aa26bd12f4e19bb37902f7e19751fe970e3b0dd0816204c12bf94d5d5fbca699da35576598ef5ce28bed2fe69e24acaf
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class Kz < Command
|
6
|
+
class Clean < Kz
|
7
|
+
self.summary = 'pod kz clean 用于清理缓存以一些报错文件'
|
8
|
+
|
9
|
+
self.description = <<-DESC
|
10
|
+
在pod update过程中由于代码变动,module缓存容易产生签名过期的问题,部分属性文件,跳转也会存在路径不对的情况,需要清理老旧缓存文件,
|
11
|
+
让Xcode重新生成
|
12
|
+
DESC
|
13
|
+
|
14
|
+
self.arguments = [
|
15
|
+
CLAide::Argument.new('1', false)
|
16
|
+
]
|
17
|
+
|
18
|
+
def self.options
|
19
|
+
[
|
20
|
+
%w[--xcode 清除module缓存与头文件索引问题],
|
21
|
+
]
|
22
|
+
end
|
23
|
+
|
24
|
+
def initialize(argv)
|
25
|
+
clean_xcode = argv.flag?('xcode')
|
26
|
+
banner! unless clean_xcode
|
27
|
+
|
28
|
+
super
|
29
|
+
end
|
30
|
+
|
31
|
+
def run
|
32
|
+
xcodeproj_path = Pathname.new(Dir[Pod::Config.instance.installation_root + "*.xcodeproj"].first)
|
33
|
+
return unless xcodeproj_path
|
34
|
+
|
35
|
+
xcode_derived_data_path = Pathname.new(Dir.home + "/Library/Developer/Xcode/DerivedData")
|
36
|
+
module_cache_noindex_path = xcode_derived_data_path + "ModuleCache.noindex"
|
37
|
+
FileUtils.rm_rf(module_cache_noindex_path) if module_cache_noindex_path.exist?
|
38
|
+
|
39
|
+
project_name = xcodeproj_path.basename.to_s.split(".").first
|
40
|
+
Dir.foreach(xcode_derived_data_path) do |file_name|
|
41
|
+
next if file_name == '.' || file_name == '..' || file_name == '.DS_Store'
|
42
|
+
|
43
|
+
if file_name.start_with?(project_name)
|
44
|
+
project_path = xcode_derived_data_path + file_name
|
45
|
+
index_noindex_path = project_path + "Index.noindex"
|
46
|
+
FileUtils.rm_rf(index_noindex_path) if index_noindex_path.exist?
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
default_xcode_path = Pathname.new('/Applications/Xcode.app')
|
51
|
+
if default_xcode_path.exist?
|
52
|
+
system("osascript -e 'quit app \"Xcode\"'")
|
53
|
+
sleep 1
|
54
|
+
workspace_path = Dir[Pod::Config.instance.installation_root + "*.xcworkspace"].first
|
55
|
+
system("open \"#{workspace_path}\"")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -8,9 +8,9 @@ module Pod
|
|
8
8
|
self.summary = 'pod kz install,用于指定pod是否开启framework模式'
|
9
9
|
|
10
10
|
self.description = <<-DESC
|
11
|
-
pod kz install 通过 --
|
12
|
-
通过 --
|
13
|
-
如果不添加任何参数,则默认所有pod为code模式,--
|
11
|
+
pod kz install 通过 --framework与指定pod名(多个pod,使用英文逗号隔开),尝试开启这些pod的framework模式,如果framwork不存在则仍然会使用code模式
|
12
|
+
通过 --code 与指定pod名(多个pod,使用英文逗号隔开),尝试开启这些pod的code模式,其余pod将尝试使用framework模式,如果framwork不存在则仍然会使用code模式
|
13
|
+
如果不添加任何参数,则默认所有pod为code模式,--framework与--code不能同时使用
|
14
14
|
DESC
|
15
15
|
|
16
16
|
def self.options
|
@@ -29,7 +29,8 @@ module Pod
|
|
29
29
|
def initialize(argv)
|
30
30
|
use_code_tag = argv.flag?('code')
|
31
31
|
use_framework_tag = argv.flag?('framework')
|
32
|
-
|
32
|
+
banner! if use_code_tag && use_framework_tag
|
33
|
+
|
33
34
|
KZ::KZGlobalHelper.instance.analyze_special_parameters(use_code_tag, use_framework_tag, argv.arguments!)
|
34
35
|
if Pod.match_version?('~> 1.11')
|
35
36
|
KZ::KZGlobalHelper.instance.kz_pod_enable = true
|
@@ -1,26 +1,10 @@
|
|
1
1
|
require_relative 'install'
|
2
2
|
require_relative 'update'
|
3
3
|
require_relative 'repair'
|
4
|
+
require_relative 'clean'
|
4
5
|
|
5
6
|
module Pod
|
6
7
|
class Command
|
7
|
-
# This is an example of a cocoapods plugin adding a top-level subcommand
|
8
|
-
# to the 'pod' command.
|
9
|
-
#
|
10
|
-
# You can also create subcommands of existing or new commands. Say you
|
11
|
-
# wanted to add a subcommand to `list` to show newly deprecated pods,
|
12
|
-
# (e.g. `pod list deprecated`), there are a few things that would need
|
13
|
-
# to change.
|
14
|
-
#
|
15
|
-
# - move this file to `lib/pod/command/list/deprecated.rb` and update
|
16
|
-
# the class to exist in the the Pod::Command::List namespace
|
17
|
-
# - change this class to extend from `List` instead of `Command`. This
|
18
|
-
# tells the plugin system that it is a subcommand of `list`.
|
19
|
-
# - edit `lib/cocoapods_plugins.rb` to require this file
|
20
|
-
#
|
21
|
-
# @todo Create a PR to add your plugin to CocoaPods/cocoapods.org
|
22
|
-
# in the `plugins.json` file, once your plugin is released.
|
23
|
-
#
|
24
8
|
class Kz < Command
|
25
9
|
self.summary = 'Short description of cocoapods-kz.'
|
26
10
|
self.abstract_command = true
|
@@ -14,15 +14,16 @@ module Pod
|
|
14
14
|
def self.options
|
15
15
|
[
|
16
16
|
['--module-import', "指定组件名(只针对开发组件),修复该组件所有文件头文件导入方式,壳工程使用“Main”,如果不指定,默认对所有开发组件进行修复"],
|
17
|
-
['--dynamic-swift', "指定组件名(只针对开发组件),将该组件中所有swift文件添加OC特性,壳工程使用“Main”,如果不指定,默认对所有开发组件进行修复"]
|
17
|
+
['--dynamic-swift', "指定组件名(只针对开发组件),将该组件中所有swift文件添加OC特性,壳工程使用“Main”,如果不指定,默认对所有开发组件进行修复"],
|
18
|
+
['--private-hmap', "重新生成组件私有hamp"],
|
18
19
|
]
|
19
20
|
end
|
20
21
|
|
21
22
|
def initialize(argv)
|
22
|
-
help! if argv.arguments == 0
|
23
23
|
@repair_module_import = argv.flag?('module-import')
|
24
24
|
@repair_dynamic_swift = argv.flag?('dynamic-swift')
|
25
|
-
|
25
|
+
@repair_private_hmap = argv.flag?('private-hmap')
|
26
|
+
banner! unless @repair_module_import || @repair_dynamic_swift || @repair_private_hmap
|
26
27
|
|
27
28
|
KZ::KZGlobalHelper.instance.analyze_special_parameters(true, false, argv.arguments!)
|
28
29
|
KZ::KZGlobalHelper.instance.generate_kz_pod_targets = true
|
@@ -33,12 +34,14 @@ module Pod
|
|
33
34
|
def run
|
34
35
|
installer = installer_for_config
|
35
36
|
installer.prepare
|
36
|
-
installer.resolve_dependencies
|
37
|
+
installer.resolve_dependencies
|
37
38
|
|
38
39
|
if @repair_dynamic_swift
|
39
40
|
KZ::KZSwiftAttachOCFeature.new.repair
|
40
|
-
|
41
|
+
elsif @repair_module_import
|
41
42
|
KZ::KZRepairModuleImport.new(installer.aggregate_targets.first.user_project).repair
|
43
|
+
else @repair_private_hmap
|
44
|
+
KZ::KZGlobalHelper.instance.kz_generator.create_hamp
|
42
45
|
end
|
43
46
|
end
|
44
47
|
end
|
@@ -7,9 +7,9 @@ module Pod
|
|
7
7
|
self.summary = 'pod kz update,用于指定pod是否开启framework模式'
|
8
8
|
|
9
9
|
self.description = <<-DESC
|
10
|
-
pod kz update 通过 --
|
11
|
-
通过 --
|
12
|
-
如果不添加任何参数,则默认所有pod为code模式,--
|
10
|
+
pod kz update 通过 --framework与指定pod名(多个pod,使用英文逗号隔开),尝试开启这些pod的framework模式,如果framwork不存在则仍然会使用code模式
|
11
|
+
通过 --code 与指定pod名(多个pod,使用英文逗号隔开),尝试开启这些pod的code模式,其余pod将尝试使用framework模式,如果framwork不存在则仍然会使用code模式
|
12
|
+
如果不添加任何参数,则默认所有pod为code模式,--framework与--code不能同时使用
|
13
13
|
DESC
|
14
14
|
|
15
15
|
def self.options
|
@@ -29,7 +29,8 @@ module Pod
|
|
29
29
|
def initialize(argv)
|
30
30
|
use_code_tag = argv.flag?('code')
|
31
31
|
use_framework_tag = argv.flag?('framework')
|
32
|
-
|
32
|
+
banner! if use_code_tag && use_framework_tag
|
33
|
+
|
33
34
|
KZ::KZGlobalHelper.instance.analyze_special_parameters(use_code_tag, use_framework_tag, argv.arguments!)
|
34
35
|
if Pod.match_version?('~> 1.11')
|
35
36
|
KZ::KZGlobalHelper.instance.kz_pod_enable = true
|
@@ -30,7 +30,7 @@ module KZ
|
|
30
30
|
kz_pod_target.repair_modulemap_path = "${PODS_CONFIGURATION_BUILD_DIR}/#{kz_pod_target.name}/#{kz_pod_target.product_name}/Modules/module.modulemap"
|
31
31
|
end
|
32
32
|
kz_pod_target.need_repair_module_import = true
|
33
|
-
|
33
|
+
elsif kz_pod_target.should_build?
|
34
34
|
temp_repeat_product_name << kz_pod_target.product_name
|
35
35
|
end
|
36
36
|
end
|
@@ -131,10 +131,10 @@ module KZ
|
|
131
131
|
end
|
132
132
|
|
133
133
|
def use_framework_mode_from_lock_file?(kz_pod_target)
|
134
|
-
|
135
|
-
|
136
|
-
pod_lock_config =
|
137
|
-
return :kz_pod_framework_mode if pod_lock_config['use_framework']
|
134
|
+
olde_lock_file_content = KZGlobalHelper.instance.olde_lock_file_content
|
135
|
+
if olde_lock_file_content
|
136
|
+
pod_lock_config = olde_lock_file_content[kz_pod_target.name]
|
137
|
+
return :kz_pod_framework_mode if pod_lock_config && pod_lock_config['use_framework']
|
138
138
|
end
|
139
139
|
:kz_pod_code_mode
|
140
140
|
end
|
@@ -14,7 +14,7 @@ module KZ
|
|
14
14
|
def get_bundle_paths
|
15
15
|
bundle_paths = []
|
16
16
|
Dir.foreach(@resource_path) do |bundle_name|
|
17
|
-
next if bundle_name == '.' || bundle_name == '..'
|
17
|
+
next if bundle_name == '.' || bundle_name == '..' || bundle_name == '.DS_Store'
|
18
18
|
|
19
19
|
bundle_path = @resource_path + bundle_name
|
20
20
|
if File.directory?(bundle_path) && bundle_name.end_with?(".bundle")
|
@@ -27,7 +27,7 @@ module KZ
|
|
27
27
|
def get_framework_paths
|
28
28
|
framework_paths = []
|
29
29
|
Dir.foreach(@resource_path) do |framework_name|
|
30
|
-
next if framework_name == '.' || framework_name == '..'
|
30
|
+
next if framework_name == '.' || framework_name == '..' || framework_name == '.DS_Store'
|
31
31
|
|
32
32
|
framework_path = @resource_path + framework_name
|
33
33
|
if File.directory?(framework_path) && framework_name.end_with?(".framework")
|
@@ -21,19 +21,19 @@ module KZ
|
|
21
21
|
return @@all_resources_cache_info
|
22
22
|
end
|
23
23
|
|
24
|
-
Dir.foreach(
|
25
|
-
next if folder_name == '.' || folder_name == '..'
|
24
|
+
Dir.foreach(KZ_POD_CONFIG_POD_TARGETS) do |folder_name|
|
25
|
+
next if folder_name == '.' || folder_name == '..' || folder_name == '.DS_Store'
|
26
26
|
|
27
|
-
config_folder =
|
27
|
+
config_folder = KZ_POD_CONFIG_POD_TARGETS + folder_name
|
28
28
|
if File.directory?(config_folder)
|
29
29
|
Dir.foreach(config_folder) do |version|
|
30
|
-
next if version == '.' || version == '..'
|
30
|
+
next if version == '.' || version == '..' || version == '.DS_Store'
|
31
31
|
|
32
32
|
version_folder = config_folder + version
|
33
33
|
if File.directory?(version_folder)
|
34
34
|
have_framework = false
|
35
35
|
Dir.foreach(version_folder) do |file_name|
|
36
|
-
next if file_name == '.' || file_name == '..'
|
36
|
+
next if file_name == '.' || file_name == '..' || file_name == '.DS_Store'
|
37
37
|
|
38
38
|
if file_name.end_with?(".framework") && File.directory?(version_folder + file_name)
|
39
39
|
have_framework = true
|
@@ -2,10 +2,6 @@ require 'xcodeproj'
|
|
2
2
|
require 'fileutils'
|
3
3
|
|
4
4
|
module KZ
|
5
|
-
class HmapContentStyle
|
6
|
-
QUOTES_PRIVATE = 1
|
7
|
-
QUOTES_REPAIR = 2
|
8
|
-
end
|
9
5
|
|
10
6
|
class KZGenerator
|
11
7
|
|
@@ -20,56 +16,14 @@ module KZ
|
|
20
16
|
build_phase = native_target.new_shell_script_build_phase('[KZ] Generate Framework')
|
21
17
|
build_phase.show_env_vars_in_log = '0'
|
22
18
|
build_phase.output_paths = ['${KZ_FRAMEWORK_CACHE_PATH}/${FULL_PRODUCT_NAME}']
|
23
|
-
build_phase.shell_script =
|
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}/${FULL_PRODUCT_NAME}/${PRODUCT_NAME}"
|
52
|
-
fi
|
53
|
-
|
54
|
-
if [ -d ${PRODUCT_DIR}/Modules/${PRODUCT_NAME}.swiftmodule ] && [ -d ${PRODUCT_SIMULATOR_DIR}/Modules/${PRODUCT_NAME}.swiftmodule ]; then
|
55
|
-
cp -r ${PRODUCT_DIR}/Modules/${PRODUCT_NAME}.swiftmodule "${KZ_FRAMEWORK_CACHE_PATH}/${FULL_PRODUCT_NAME}/Modules"
|
56
|
-
cp -r ${PRODUCT_SIMULATOR_DIR}/Modules/${PRODUCT_NAME}.swiftmodule "${KZ_FRAMEWORK_CACHE_PATH}/${FULL_PRODUCT_NAME}/Modules"
|
57
|
-
fi
|
58
|
-
|
59
|
-
PRODUCT_SWIFT_H=${PRODUCT_DIR}/Headers/${PRODUCT_NAME}-Swift.h
|
60
|
-
PRODUCT_SIMULATOR_SWIFT_H=${PRODUCT_SIMULATOR_DIR}/Headers/${PRODUCT_NAME}-Swift.h
|
61
|
-
TARGET_SWIFT_H=${KZ_FRAMEWORK_CACHE_PATH}/${FULL_PRODUCT_NAME}/Headers/${PRODUCT_NAME}-Swift.h
|
62
|
-
if [ -f $PRODUCT_SWIFT_H ] && [ -f $PRODUCT_SIMULATOR_SWIFT_H ]; then
|
63
|
-
ruby "$KZ_MERGE_SWIFT_H_PATH" "$PRODUCT_SWIFT_H" "$PRODUCT_SIMULATOR_SWIFT_H" "$TARGET_SWIFT_H"
|
64
|
-
fi
|
65
|
-
}
|
19
|
+
build_phase.shell_script = KZ.deal_path_for_xcconfig(KZ_GENERATOR_FRAMEWORK_PATH, true)
|
66
20
|
end
|
67
21
|
|
68
22
|
def add_flexlib_xml_build_rules(project, native_target)
|
69
23
|
return unless KZ::KZGlobalHelper.instance.have_flexLib_pod_target
|
70
24
|
|
71
25
|
native_target.build_configurations.each do |config|
|
72
|
-
config.build_settings["KZ_XML_FLEX_COMPILER"] = FLEX_COMPLIER_PATH
|
26
|
+
config.build_settings["KZ_XML_FLEX_COMPILER"] = KZ.deal_path_for_xcconfig(FLEX_COMPLIER_PATH, false)
|
73
27
|
config.build_settings["KZ_XML_FLEX_DIR"] = "${TARGET_TEMP_DIR}/XmlFlexs"
|
74
28
|
config.build_settings["KZ_XML_FLEX_BUILD_DIR"] = "${TARGET_BUILD_DIR}/${PRODUCT_NAME}.bundle"
|
75
29
|
end
|
@@ -77,15 +31,7 @@ fi
|
|
77
31
|
xml_rule = new_build_rule(project, native_target, '[KZ] Custom Xml Build')
|
78
32
|
xml_rule.file_type = 'text.xml'
|
79
33
|
xml_rule.output_files = Array['${KZ_XML_FLEX_DIR}/${INPUT_FILE_BASE}.flex']
|
80
|
-
xml_rule.script =
|
81
|
-
rm -rf ${FLEX_PATH}
|
82
|
-
$KZ_XML_FLEX_COMPILER $INPUT_FILE_PATH $FLEX_PATH
|
83
|
-
if [ -f $FLEX_PATH ] ; then
|
84
|
-
cp $FLEX_PATH $KZ_XML_FLEX_BUILD_DIR
|
85
|
-
exit 0
|
86
|
-
else
|
87
|
-
exit 1
|
88
|
-
fi}
|
34
|
+
xml_rule.script = KZ.deal_path_for_xcconfig(KZ_XML_BUILD_PATH, true)
|
89
35
|
end
|
90
36
|
|
91
37
|
def new_build_rule(project, native_target, name)
|
@@ -132,7 +78,7 @@ fi}
|
|
132
78
|
need_repair_import_targets = kz_pod_target.repair_import
|
133
79
|
if need_repair_import_targets.count > 0
|
134
80
|
need_repair_import_targets.each { |need_repair_import_target|
|
135
|
-
repair_hmap_info =
|
81
|
+
repair_hmap_info = repair_hmap_info(need_repair_import_target)
|
136
82
|
all_repair_hmap_info.merge!(repair_hmap_info)
|
137
83
|
}
|
138
84
|
end
|
@@ -159,7 +105,7 @@ fi}
|
|
159
105
|
|
160
106
|
# 添加私有头文件引用
|
161
107
|
if kz_pod_target.should_build?
|
162
|
-
private_hamp_info =
|
108
|
+
private_hamp_info = private_hmap_info(kz_pod_target)
|
163
109
|
if private_hamp_info.count > 0
|
164
110
|
hmap_cache_path = kz_pod_target.pod_config_cache_path(false)
|
165
111
|
save_hmap_file(private_hamp_info, hmap_cache_path, target_name)
|
@@ -171,7 +117,7 @@ fi}
|
|
171
117
|
|
172
118
|
def traverse_folder(folder_path)
|
173
119
|
Dir.foreach(folder_path) do |file_name|
|
174
|
-
next if file_name == '.' || file_name == '..'
|
120
|
+
next if file_name == '.' || file_name == '..' || file_name == '.DS_Store'
|
175
121
|
|
176
122
|
file_path = File.join(folder_path, file_name)
|
177
123
|
if File.file?(file_path)
|
@@ -187,7 +133,7 @@ fi}
|
|
187
133
|
def clean_hmap_cache(kz_pod_target)
|
188
134
|
hmap_cache_path = kz_pod_target.pod_config_cache_path(false)
|
189
135
|
Dir.foreach(hmap_cache_path) do |file_name|
|
190
|
-
next if file_name == '.' || file_name == '..'
|
136
|
+
next if file_name == '.' || file_name == '..' || file_name == '.DS_Store'
|
191
137
|
|
192
138
|
if file_name.end_with?(".hmap", ".json")
|
193
139
|
FileUtils.rm(hmap_cache_path + file_name) if File.exist?(hmap_cache_path + file_name)
|
@@ -195,11 +141,9 @@ fi}
|
|
195
141
|
end
|
196
142
|
end
|
197
143
|
|
198
|
-
def
|
144
|
+
def repair_hmap_info(kz_pod_target)
|
199
145
|
header_paths = kz_pod_target.public_headers
|
200
|
-
header_paths
|
201
|
-
hmap_info = {}
|
202
|
-
header_paths.each do |header_pathname|
|
146
|
+
header_paths.each_with_object({}) do |header_pathname, hmap_info|
|
203
147
|
header_pathname_basename = header_pathname.basename.to_s
|
204
148
|
|
205
149
|
header_hmap_value_quotes = {}
|
@@ -207,48 +151,65 @@ fi}
|
|
207
151
|
header_hmap_value_quotes['prefix'] = header_pathname.dirname.to_s + '/'
|
208
152
|
hmap_info[header_pathname_basename] = header_hmap_value_quotes
|
209
153
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
154
|
+
header_hmap_value_slash = {}
|
155
|
+
header_hmap_value_slash['suffix'] = header_pathname_basename
|
156
|
+
prefix_name = kz_pod_target.product_basename
|
157
|
+
if header_pathname.dirname.to_s.include?('.framework')
|
158
|
+
header_pathname.dirname.to_s.split('/').each do |name|
|
159
|
+
if name.include?('.framework')
|
160
|
+
prefix_name = name.split('.').first
|
161
|
+
end
|
216
162
|
end
|
163
|
+
end
|
164
|
+
header_hmap_value_slash['prefix'] = prefix_name + '/'
|
165
|
+
hmap_info[header_pathname_basename] = header_hmap_value_slash
|
166
|
+
end
|
167
|
+
end
|
217
168
|
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
169
|
+
def private_hmap_info(kz_pod_target)
|
170
|
+
header_paths = kz_pod_target.all_headers
|
171
|
+
# 更新Headers
|
172
|
+
if kz_pod_target.is_dev_pod && kz_pod_target.should_build?
|
173
|
+
header_paths.each do |header_pathname|
|
174
|
+
symlink_path = kz_pod_target.local_private_headers_path + header_pathname.basename
|
175
|
+
File.symlink(header_pathname, symlink_path) unless File.symlink?(symlink_path) || File.exist?(symlink_path)
|
176
|
+
end
|
177
|
+
kz_pod_target.use_local_private_headers_path = true
|
178
|
+
end
|
179
|
+
header_paths.each_with_object({}) do |header_pathname, hmap_info|
|
180
|
+
header_pathname_basename = header_pathname.basename.to_s
|
222
181
|
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
182
|
+
header_hmap_value_quotes = {}
|
183
|
+
header_hmap_value_quotes['suffix'] = header_pathname_basename
|
184
|
+
header_hmap_value_quotes['prefix'] = header_pathname.dirname.to_s + '/'
|
185
|
+
hmap_info[header_pathname_basename] = header_hmap_value_quotes
|
186
|
+
|
187
|
+
# pch
|
188
|
+
pchfile_path = kz_pod_target.prefix_header_path
|
189
|
+
if pchfile_path.exist?
|
190
|
+
suffix = pchfile_path.basename.to_s
|
191
|
+
hmap_info[suffix] = { 'suffix' => suffix, 'prefix' => "#{pchfile_path.dirname.to_s}/" }
|
192
|
+
end
|
193
|
+
|
194
|
+
unless kz_pod_target.is_dev_pod
|
195
|
+
# 个别第三方在使用自己组件文件时,会使用#import <xx/xx.h>的方式
|
196
|
+
hmap_info[kz_pod_target.product_basename + '/' + header_pathname_basename] = header_hmap_value_quotes
|
197
|
+
end
|
198
|
+
|
199
|
+
if kz_pod_target.uses_swift && kz_pod_target.is_dev_pod
|
200
|
+
# 修改SPBoss-Swift.h文件的导入方式
|
201
|
+
swift_bridge_file_name = "#{kz_pod_target.name}-Swift.h"
|
202
|
+
hmap_info[swift_bridge_file_name] = { 'suffix' => swift_bridge_file_name, 'prefix' => "#{kz_pod_target.name}/" }
|
203
|
+
|
204
|
+
# 以SPBoss为例,在混编模式中,SPBoss-Swift.h会使用#import <SPBoss/SPBoss.h>方式导入swift需要使用的OC头文件
|
205
|
+
# SPBoss中头文件会存在当前组件与framework的Headers中,有两份。SPBoss-Swift.h只在framework中
|
206
|
+
# 编译默认从SPBoss-Swift.h找SPBoss.h,然后找SPBoss.h中的头文件也都会在framework中寻在,会造成与当前组件头文件重复
|
207
|
+
# 需要重新将#import <SPBoss/SPBoss.h>方式修复为寻找当前组件中的SPBoss.h文件,而不是framework中的SPBoss.h
|
208
|
+
if header_pathname_basename == "#{kz_pod_target.name}.h"
|
209
|
+
hmap_info[kz_pod_target.name + '/' + header_pathname_basename] = header_hmap_value_quotes
|
246
210
|
end
|
247
|
-
header_hmap_value_slash['prefix'] = prefix_name + '/'
|
248
|
-
hmap_info[header_pathname_basename] = header_hmap_value_slash
|
249
211
|
end
|
250
212
|
end
|
251
|
-
hmap_info
|
252
213
|
end
|
253
214
|
|
254
215
|
def save_hmap_file(hmap_hash, save_path, file_name)
|
@@ -7,15 +7,20 @@ require_relative 'kz_config_result'
|
|
7
7
|
require_relative 'kz_pod_target'
|
8
8
|
|
9
9
|
module KZ
|
10
|
+
KZ_POD_CONFIG_VERSION = '1.0.2'
|
10
11
|
KZ_POD_CONFIG_ROOT = Pod::Config.instance.installation_root + 'Pods/KZPodConfigure'
|
12
|
+
KZ_POD_CONFIG_SUPPORT_FILES = KZ_POD_CONFIG_ROOT + 'SupportFiles'
|
13
|
+
KZ_POD_CONFIG_POD_TARGETS = KZ_POD_CONFIG_ROOT + 'PodTargets'
|
11
14
|
KZ_POD_CONFIG_ROOT_STR = "${PODS_ROOT}/KZPodConfigure"
|
12
15
|
# 修复pod lib报错问题
|
13
16
|
Pod::Config.instance.installation_root = nil
|
14
17
|
|
15
18
|
HMAP_EXECUTE_PATH = File.dirname(__FILE__) + '/../resources/hmap'
|
16
|
-
FLEX_COMPLIER_PATH =
|
19
|
+
FLEX_COMPLIER_PATH = KZ_POD_CONFIG_SUPPORT_FILES + 'FlexCompiler'
|
20
|
+
KZ_MERGE_SWIFT_H_PATH = KZ_POD_CONFIG_SUPPORT_FILES + 'kz_merge_swift_h.rb'
|
21
|
+
KZ_GENERATOR_FRAMEWORK_PATH = KZ_POD_CONFIG_SUPPORT_FILES + 'kz_generator_framework.sh'
|
22
|
+
KZ_XML_BUILD_PATH = KZ_POD_CONFIG_SUPPORT_FILES + 'kz_xml_build.sh'
|
17
23
|
KZ_LOCK_FILE_PATH = KZ_POD_CONFIG_ROOT + 'KZConfigLock'
|
18
|
-
KZ_MERGE_SWIFT_H_PATH = KZ_POD_CONFIG_ROOT + 'kz_merge_swift_h.rb'
|
19
24
|
|
20
25
|
def self.deal_path_for_xcconfig(path, add_quotes = false)
|
21
26
|
if path.is_a?(String)
|
@@ -52,24 +57,38 @@ module KZ
|
|
52
57
|
@kz_config_lock = {}
|
53
58
|
@disable_generate_framework = false
|
54
59
|
@generate_kz_pod_targets = false
|
60
|
+
@olde_lock_file_content = nil
|
55
61
|
end
|
56
62
|
|
57
63
|
@@instance = nil
|
58
64
|
def self.instance
|
65
|
+
FileUtils.mkdir_p(KZ_POD_CONFIG_ROOT) unless File.exist?(KZ_POD_CONFIG_ROOT)
|
59
66
|
@@instance ||= new
|
60
67
|
end
|
61
68
|
|
62
69
|
def prepare
|
63
70
|
if Pod::Config.instance.podfile && Pod::Config.instance.podfile.plugins.has_key?("cocoapods-kz")
|
64
|
-
|
71
|
+
if olde_lock_file_content == nil || olde_lock_file_content['version'] != KZ_POD_CONFIG_VERSION
|
72
|
+
FileUtils.rm_rf(KZ_POD_CONFIG_ROOT)
|
73
|
+
FileUtils.mkdir_p(KZ_POD_CONFIG_ROOT)
|
74
|
+
end
|
75
|
+
FileUtils.mkdir_p(KZ_POD_CONFIG_SUPPORT_FILES) unless File.exist?(KZ_POD_CONFIG_SUPPORT_FILES)
|
76
|
+
FileUtils.mkdir_p(KZ_POD_CONFIG_POD_TARGETS) unless File.exist?(KZ_POD_CONFIG_POD_TARGETS)
|
77
|
+
|
78
|
+
FileUtils.rm(FLEX_COMPLIER_PATH) if File.exist?(FLEX_COMPLIER_PATH)
|
79
|
+
FileUtils.cp_r(File.dirname(__FILE__) + '/../resources/FlexCompiler', FLEX_COMPLIER_PATH)
|
80
|
+
system("chmod +x #{FLEX_COMPLIER_PATH}")
|
65
81
|
|
66
|
-
flex_compiler_de_path = KZ_POD_CONFIG_ROOT + 'FlexCompiler'
|
67
|
-
FileUtils.rm(flex_compiler_de_path) if File.exist?(flex_compiler_de_path)
|
68
|
-
FileUtils.cp_r(File.dirname(__FILE__) + '/../resources/FlexCompiler', KZ_POD_CONFIG_ROOT)
|
69
|
-
system("chmod +x #{flex_compiler_de_path}")
|
70
82
|
FileUtils.cp_r(File.dirname(__FILE__) + '/../resources/kz_merge_swift_h.rb', KZ_MERGE_SWIFT_H_PATH)
|
71
83
|
|
84
|
+
FileUtils.cp_r(File.dirname(__FILE__) + '/../resources/kz_generator_framework.sh', KZ_GENERATOR_FRAMEWORK_PATH)
|
85
|
+
system("chmod +x #{KZ_GENERATOR_FRAMEWORK_PATH}")
|
86
|
+
|
87
|
+
FileUtils.cp_r(File.dirname(__FILE__) + '/../resources/kz_xml_build.sh', KZ_XML_BUILD_PATH)
|
88
|
+
system("chmod +x #{KZ_XML_BUILD_PATH}")
|
89
|
+
|
72
90
|
Pod::Config.instance.podfile.use_frameworks!(:linkage => :static)
|
91
|
+
Pod::Config.instance.podfile.install!("cocoapods", :deterministic_uuids => false)
|
73
92
|
else
|
74
93
|
@kz_pod_enable = false
|
75
94
|
@generate_kz_pod_targets = false
|
@@ -108,17 +127,23 @@ module KZ
|
|
108
127
|
end
|
109
128
|
|
110
129
|
def have_flexLib_pod_target
|
111
|
-
@kz_analyzer.
|
130
|
+
@kz_analyzer.all_kz_pod_targets.values.each do |target|
|
131
|
+
return true if target.root_name == 'FlexLib' || target.root_name == 'KZSwiftUI'
|
132
|
+
end
|
133
|
+
false
|
112
134
|
end
|
113
135
|
|
114
136
|
def write_lock_file
|
115
137
|
self.kz_analyzer.all_kz_pod_targets.values.each do |kz_pod_target|
|
116
138
|
result = pod_config_result_with_target(kz_pod_target)
|
117
139
|
|
118
|
-
@kz_config_lock[
|
119
|
-
@kz_config_lock[
|
120
|
-
|
121
|
-
@kz_config_lock[kz_pod_target.name]
|
140
|
+
@kz_config_lock['version'] = KZ_POD_CONFIG_VERSION
|
141
|
+
@kz_config_lock['pod_targets'] ||= {}
|
142
|
+
|
143
|
+
@kz_config_lock['pod_targets'][kz_pod_target.name] ||= {}
|
144
|
+
@kz_config_lock['pod_targets'][kz_pod_target.name]["dev_pod"] = kz_pod_target.is_dev_pod
|
145
|
+
@kz_config_lock['pod_targets'][kz_pod_target.name]["use_framework"] = (result != nil)
|
146
|
+
@kz_config_lock['pod_targets'][kz_pod_target.name]["version"] = kz_pod_target.version
|
122
147
|
end
|
123
148
|
|
124
149
|
if @kz_config_lock.count > 0
|
@@ -129,8 +154,11 @@ module KZ
|
|
129
154
|
end
|
130
155
|
end
|
131
156
|
|
132
|
-
def
|
133
|
-
|
157
|
+
def olde_lock_file_content
|
158
|
+
if File.exist?(KZ_LOCK_FILE_PATH)
|
159
|
+
@olde_lock_file_content ||= JSON.parse(File.read(KZ_LOCK_FILE_PATH))
|
160
|
+
end
|
161
|
+
@olde_lock_file_content
|
134
162
|
end
|
135
163
|
|
136
164
|
end
|
@@ -36,6 +36,8 @@ module KZ
|
|
36
36
|
# 当手动修改PRODUCT_NAME之后,#import<xx/xxx.h>需要修复为原使用方式,使用hmap进行映射
|
37
37
|
attr_accessor :need_repair_module_import
|
38
38
|
|
39
|
+
attr_accessor :use_local_private_headers_path
|
40
|
+
|
39
41
|
def initialize(native_pod_target)
|
40
42
|
@native_pod_target = native_pod_target
|
41
43
|
@name = native_pod_target.name
|
@@ -50,6 +52,7 @@ module KZ
|
|
50
52
|
@product_name = native_pod_target.origin_product_name
|
51
53
|
@product_basename = native_pod_target.origin_product_basename
|
52
54
|
@need_repair_module_import = false
|
55
|
+
@use_local_private_headers_path = false
|
53
56
|
|
54
57
|
native_pod_target.file_accessors.each do |file_accessor|
|
55
58
|
file_accessor.kz_pod_target = self
|
@@ -63,31 +66,30 @@ module KZ
|
|
63
66
|
end
|
64
67
|
|
65
68
|
def all_headers
|
66
|
-
return
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
@_all_headers
|
69
|
+
return [] unless have_download_pod?
|
70
|
+
@all_headers ||= begin
|
71
|
+
all_headers = []
|
72
|
+
native_pod_target.file_accessors.each do |file_accessor|
|
73
|
+
next if file_accessor.spec.test_specification
|
74
|
+
|
75
|
+
all_headers.concat(file_accessor.kz_headers)
|
76
|
+
end
|
77
|
+
all_headers
|
78
|
+
end
|
77
79
|
end
|
78
80
|
|
79
81
|
def public_headers
|
80
|
-
return
|
81
|
-
|
82
|
-
public_headers = []
|
83
|
-
native_pod_target.file_accessors.each do |file_accessor|
|
84
|
-
next if file_accessor.spec.test_specification
|
82
|
+
return [] unless have_download_pod?
|
85
83
|
|
86
|
-
|
87
|
-
|
84
|
+
@public_headers ||= begin
|
85
|
+
public_headers = []
|
86
|
+
native_pod_target.file_accessors.each do |file_accessor|
|
87
|
+
next if file_accessor.spec.test_specification
|
88
88
|
|
89
|
-
|
90
|
-
|
89
|
+
public_headers.concat(file_accessor.kz_public_headers)
|
90
|
+
end
|
91
|
+
public_headers
|
92
|
+
end
|
91
93
|
end
|
92
94
|
|
93
95
|
# 重些config_pod_mode的set方法,kz_pod_framework_mode优先级最高
|
@@ -137,7 +139,7 @@ module KZ
|
|
137
139
|
elsif repair_import.is_a?(Array)
|
138
140
|
repair_import.each do |repair_import_target_name|
|
139
141
|
kz_repair_pod_target = yield(repair_import_target_name)
|
140
|
-
@repair_import << kz_repair_pod_target
|
142
|
+
@repair_import << kz_repair_pod_target if kz_repair_pod_target
|
141
143
|
end
|
142
144
|
end
|
143
145
|
end
|
@@ -166,13 +168,20 @@ module KZ
|
|
166
168
|
end
|
167
169
|
|
168
170
|
# 直接用于配置HEADER_SEARCH_PATHS
|
169
|
-
def header_search_paths
|
171
|
+
def header_search_paths(custom_paths)
|
170
172
|
header_search_paths = ''
|
171
173
|
header_search_paths = KZ.deal_path_for_xcconfig(@private_header_search_path, true) if @private_header_search_path
|
172
174
|
repair_header_search_paths = self.all_repair_header_search_paths.join(' ')
|
173
175
|
if repair_header_search_paths.length > 0
|
174
176
|
header_search_paths += (' ' + repair_header_search_paths)
|
175
177
|
end
|
178
|
+
if @use_local_private_headers_path
|
179
|
+
header_search_paths += (' ' + KZ.deal_path_for_xcconfig(local_private_headers_path, true))
|
180
|
+
end
|
181
|
+
header_search_paths += (' ' + KZ.deal_path_for_xcconfig(self.native_pod_target.sandbox.public_headers.root, true))
|
182
|
+
custom_paths.each do |custom_path|
|
183
|
+
header_search_paths += (' ' + custom_path)
|
184
|
+
end if custom_paths
|
176
185
|
header_search_paths
|
177
186
|
end
|
178
187
|
|
@@ -199,7 +208,7 @@ module KZ
|
|
199
208
|
|
200
209
|
# 获取target对应的配置根目录,部分文件需要依赖版本进行存储
|
201
210
|
def pod_config_cache_path(concat_version)
|
202
|
-
kz_target_framework_folder =
|
211
|
+
kz_target_framework_folder = KZ_POD_CONFIG_POD_TARGETS + @name
|
203
212
|
kz_target_framework_folder += @version if concat_version
|
204
213
|
FileUtils.mkdir_p(kz_target_framework_folder) unless File.exist?(kz_target_framework_folder) || concat_version
|
205
214
|
kz_target_framework_folder
|
@@ -237,8 +246,25 @@ module KZ
|
|
237
246
|
@native_pod_target.prefix_header_path
|
238
247
|
end
|
239
248
|
|
249
|
+
def have_download_pod?
|
250
|
+
native_pod_dir = @native_pod_target.sandbox.pod_dir(@root_name)
|
251
|
+
File.exist?(native_pod_dir) && !File.empty?(native_pod_dir)
|
252
|
+
end
|
253
|
+
|
240
254
|
def should_build?
|
241
|
-
@native_pod_target.should_build?
|
255
|
+
have_download_pod? ? @native_pod_target.should_build? : false
|
256
|
+
end
|
257
|
+
|
258
|
+
def uses_swift?
|
259
|
+
@native_pod_target.uses_swift?
|
260
|
+
end
|
261
|
+
|
262
|
+
def local_private_headers_path
|
263
|
+
@local_private_headers_path ||= begin
|
264
|
+
path = KZ_POD_CONFIG_POD_TARGETS + @name + "Headers"
|
265
|
+
FileUtils.mkdir_p(path) unless File.exist?(path)
|
266
|
+
path
|
267
|
+
end
|
242
268
|
end
|
243
269
|
|
244
270
|
end
|
@@ -27,30 +27,29 @@ module Pod
|
|
27
27
|
if kz_pod_target.repair_header_search_path
|
28
28
|
main_hamp_search_path += (' ' + KZ.deal_path_for_xcconfig(kz_pod_target.repair_header_search_path, true))
|
29
29
|
end
|
30
|
-
add_repair_modulemap(xcconfig, kz_pod_target.all_repair_modulemap_paths)
|
30
|
+
add_repair_modulemap(xcconfig, kz_pod_target.all_repair_modulemap_paths, self.target.uses_swift?)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
xcconfig.attributes['HEADER_SEARCH_PATHS'] = main_hamp_search_path
|
34
34
|
xcconfig.attributes['USE_HEADERMAP'] = 'NO'
|
35
|
-
|
36
|
-
if generator.configuration_name == 'Debug' && check_default_xcode_version_for_ld64
|
37
|
-
other_linker_flags = xcconfig.other_linker_flags[:simple]
|
38
|
-
other_linker_flags << '-ld64'
|
39
|
-
end
|
35
|
+
|
40
36
|
kz_update_xcconfig_file(xcconfig, path)
|
41
37
|
return
|
42
38
|
end
|
43
39
|
elsif generator.is_a?(Pod::Target::BuildSettings::PodTargetSettings)
|
44
40
|
kz_pod_target = self.target.weakRef_kz_pod_target
|
45
41
|
if kz_pod_target
|
42
|
+
pod_custom_header_search_paths = generator.pod_target_xcconfig_values_by_consumer_by_key["HEADER_SEARCH_PATHS"]
|
43
|
+
pod_custom_header_search_paths = pod_custom_header_search_paths.values if pod_custom_header_search_paths
|
44
|
+
|
46
45
|
xcconfig = generator.xcconfig
|
47
|
-
xcconfig.attributes['HEADER_SEARCH_PATHS'] = kz_pod_target.header_search_paths
|
46
|
+
xcconfig.attributes['HEADER_SEARCH_PATHS'] = kz_pod_target.header_search_paths(pod_custom_header_search_paths)
|
48
47
|
xcconfig.attributes['USE_HEADERMAP'] = 'NO'
|
49
48
|
framework_cache_path = KZ.deal_path_for_xcconfig(kz_pod_target.pod_config_cache_path(true))
|
50
49
|
xcconfig.attributes['KZ_FRAMEWORK_CACHE_PATH'] = framework_cache_path
|
51
|
-
xcconfig.attributes['KZ_MERGE_SWIFT_H_PATH'] = KZ::
|
50
|
+
xcconfig.attributes['KZ_MERGE_SWIFT_H_PATH'] = KZ.deal_path_for_xcconfig(KZ::KZ_MERGE_SWIFT_H_PATH)
|
52
51
|
|
53
|
-
add_repair_modulemap(xcconfig, kz_pod_target.all_repair_modulemap_paths)
|
52
|
+
add_repair_modulemap(xcconfig, kz_pod_target.all_repair_modulemap_paths, kz_pod_target.uses_swift?)
|
54
53
|
kz_update_xcconfig_file(xcconfig, path)
|
55
54
|
return
|
56
55
|
end
|
@@ -58,16 +57,18 @@ module Pod
|
|
58
57
|
origin_update_changed_file(generator, path)
|
59
58
|
end
|
60
59
|
|
61
|
-
def add_repair_modulemap(xcconfig, repair_modulemap_paths)
|
60
|
+
def add_repair_modulemap(xcconfig, repair_modulemap_paths, uses_swift = false)
|
62
61
|
if repair_modulemap_paths.count > 0
|
63
62
|
repair_modulemap_paths.each do |repair_modulemap_path|
|
64
63
|
fmodule_map = ' -fmodule-map-file=' + KZ.deal_path_for_xcconfig(repair_modulemap_path, true)
|
65
64
|
unless xcconfig.attributes['OTHER_CFLAGS'].include?(fmodule_map)
|
66
65
|
xcconfig.attributes['OTHER_CFLAGS'] += fmodule_map
|
67
66
|
end
|
68
|
-
|
69
|
-
|
70
|
-
xcconfig.attributes['OTHER_SWIFT_FLAGS']
|
67
|
+
if uses_swift
|
68
|
+
xfmodule_map = ' -Xcc -fmodule-map-file=' + KZ.deal_path_for_xcconfig(repair_modulemap_path, true)
|
69
|
+
unless xcconfig.attributes['OTHER_SWIFT_FLAGS'].include?(xfmodule_map)
|
70
|
+
xcconfig.attributes['OTHER_SWIFT_FLAGS'] += xfmodule_map
|
71
|
+
end
|
71
72
|
end
|
72
73
|
end
|
73
74
|
end
|
@@ -105,19 +106,6 @@ module Pod
|
|
105
106
|
xcconfig.attributes['OTHER_CFLAGS'] = new_flags.join(' ')
|
106
107
|
end
|
107
108
|
|
108
|
-
def check_default_xcode_version_for_ld64
|
109
|
-
default_xcode_path = Pathname.new('/Applications/Xcode.app')
|
110
|
-
return false unless File.exist?(default_xcode_path)
|
111
|
-
|
112
|
-
xcode_info_plist = default_xcode_path + 'Contents/Info.plist'
|
113
|
-
_xcode_info_plist = KZ::KZ_POD_CONFIG_ROOT + 'Xcode_Info.plist'
|
114
|
-
FileUtils.cp(xcode_info_plist, _xcode_info_plist)
|
115
|
-
system "plutil -convert xml1 #{_xcode_info_plist.to_s} #{_xcode_info_plist.to_s}"
|
116
|
-
plist_hash = Xcodeproj::Plist.read_from_path(_xcode_info_plist)
|
117
|
-
FileUtils.rm(_xcode_info_plist)
|
118
|
-
plist_hash['CFBundleShortVersionString'] == '15.0'
|
119
|
-
end
|
120
|
-
|
121
109
|
end
|
122
110
|
end
|
123
111
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
if [ "${MACH_O_TYPE}" != "staticlib" ]; then
|
2
|
+
exit 0
|
3
|
+
fi
|
4
|
+
|
5
|
+
PRODUCT_DIR=${PODS_BUILD_DIR}/Debug-iphoneos/${TARGET_NAME}/${FULL_PRODUCT_NAME}
|
6
|
+
PRODUCT_SIMULATOR_DIR=${PODS_BUILD_DIR}/Debug-iphonesimulator/${TARGET_NAME}/${FULL_PRODUCT_NAME}
|
7
|
+
CURRENT_PRODUCT_DIR=${PODS_CONFIGURATION_BUILD_DIR}/${TARGET_NAME}
|
8
|
+
|
9
|
+
if [ -d "${KZ_FRAMEWORK_CACHE_PATH}" ]; then
|
10
|
+
rm -r "${KZ_FRAMEWORK_CACHE_PATH}"
|
11
|
+
fi
|
12
|
+
mkdir -p "${KZ_FRAMEWORK_CACHE_PATH}"
|
13
|
+
|
14
|
+
if [ -d "${KZ_FRAMEWORK_CACHE_PATH}/${FULL_PRODUCT_NAME}" ]; then
|
15
|
+
rm -r "${KZ_FRAMEWORK_CACHE_PATH}/${FULL_PRODUCT_NAME}"
|
16
|
+
fi
|
17
|
+
cp -r ${CURRENT_PRODUCT_DIR}/${FULL_PRODUCT_NAME} "${KZ_FRAMEWORK_CACHE_PATH}"
|
18
|
+
|
19
|
+
find "${CURRENT_PRODUCT_DIR}" -iname "*.bundle" | while read -r BUNDLE_FILE; do
|
20
|
+
BUNDLE_NAME=$(basename ${BUNDLE_FILE})
|
21
|
+
if [ -d "${KZ_FRAMEWORK_CACHE_PATH}/${BUNDLE_NAME}" ]; then
|
22
|
+
rm -r "${KZ_FRAMEWORK_CACHE_PATH}/${BUNDLE_NAME}"
|
23
|
+
fi
|
24
|
+
cp -r ${BUNDLE_FILE} "${KZ_FRAMEWORK_CACHE_PATH}"
|
25
|
+
done
|
26
|
+
|
27
|
+
if [ -f ${PRODUCT_DIR}/${PRODUCT_NAME} ] && [ -f ${PRODUCT_SIMULATOR_DIR}/${PRODUCT_NAME} ]; then
|
28
|
+
lipo -create ${PRODUCT_DIR}/${PRODUCT_NAME} ${PRODUCT_SIMULATOR_DIR}/${PRODUCT_NAME} -output "${KZ_FRAMEWORK_CACHE_PATH}/${FULL_PRODUCT_NAME}/${PRODUCT_NAME}"
|
29
|
+
fi
|
30
|
+
|
31
|
+
if [ -d ${PRODUCT_DIR}/Modules/${PRODUCT_NAME}.swiftmodule ] && [ -d ${PRODUCT_SIMULATOR_DIR}/Modules/${PRODUCT_NAME}.swiftmodule ]; then
|
32
|
+
cp -r ${PRODUCT_DIR}/Modules/${PRODUCT_NAME}.swiftmodule "${KZ_FRAMEWORK_CACHE_PATH}/${FULL_PRODUCT_NAME}/Modules"
|
33
|
+
cp -r ${PRODUCT_SIMULATOR_DIR}/Modules/${PRODUCT_NAME}.swiftmodule "${KZ_FRAMEWORK_CACHE_PATH}/${FULL_PRODUCT_NAME}/Modules"
|
34
|
+
fi
|
35
|
+
|
36
|
+
PRODUCT_SWIFT_H=${PRODUCT_DIR}/Headers/${PRODUCT_NAME}-Swift.h
|
37
|
+
PRODUCT_SIMULATOR_SWIFT_H=${PRODUCT_SIMULATOR_DIR}/Headers/${PRODUCT_NAME}-Swift.h
|
38
|
+
TARGET_SWIFT_H=${KZ_FRAMEWORK_CACHE_PATH}/${FULL_PRODUCT_NAME}/Headers/${PRODUCT_NAME}-Swift.h
|
39
|
+
if [ -f $PRODUCT_SWIFT_H ] && [ -f $PRODUCT_SIMULATOR_SWIFT_H ]; then
|
40
|
+
ruby "$KZ_MERGE_SWIFT_H_PATH" "$PRODUCT_SWIFT_H" "$PRODUCT_SIMULATOR_SWIFT_H" "$TARGET_SWIFT_H"
|
41
|
+
fi
|
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.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yixiong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -47,6 +47,7 @@ extra_rdoc_files: []
|
|
47
47
|
files:
|
48
48
|
- lib/cocoapods-kz.rb
|
49
49
|
- lib/cocoapods-kz/command.rb
|
50
|
+
- lib/cocoapods-kz/command/clean.rb
|
50
51
|
- lib/cocoapods-kz/command/install.rb
|
51
52
|
- lib/cocoapods-kz/command/kz.rb
|
52
53
|
- lib/cocoapods-kz/command/repair.rb
|
@@ -73,7 +74,9 @@ files:
|
|
73
74
|
- lib/cocoapods-kz/native/target_installer_helper.rb
|
74
75
|
- lib/cocoapods-kz/resources/FlexCompiler
|
75
76
|
- lib/cocoapods-kz/resources/hmap
|
77
|
+
- lib/cocoapods-kz/resources/kz_generator_framework.sh
|
76
78
|
- lib/cocoapods-kz/resources/kz_merge_swift_h.rb
|
79
|
+
- lib/cocoapods-kz/resources/kz_xml_build.sh
|
77
80
|
- lib/cocoapods_plugin.rb
|
78
81
|
homepage: https://github.com/EXAMPLE/cocoapods-kz
|
79
82
|
licenses:
|