cocoapods-kz 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f2ecfbcbc07e3ac505466898ae1b82fe6daf936bcfc56d7a128c7256a000888
4
- data.tar.gz: '07248a9d57a52e6f2948b2d893d7463d8581f90d4bf29104df5d3465f991355c'
3
+ metadata.gz: c043498bc76c19c7f49d1b6f64f00f10535f3512b9eb85853e213e4faa9b4d1c
4
+ data.tar.gz: e86ca96c094fb8f90d6434d1ce99421c0d4c2d2bca37b0e91f23639f841ea3df
5
5
  SHA512:
6
- metadata.gz: b32004addf7c59b259281c83d92fab22dc85d5e7f021992f9a3a86af996d8c3de764885fc6bf8b44b2094716743d9cb45133398f4468733c95def92fba911886
7
- data.tar.gz: 4552647daba1c5c5265bc67302e84788a17bed18d6d87c93e70f90c6d3e97d393c342f6109f1f2f43e3a82ad3ab7071168e39df64b4b9ab35f9b3a308d6a06a8
6
+ metadata.gz: 15a3769ef86e707c147f1d8d0f3b03832c316a895869703e501fdf3efb9f365938548bc73b2db8331624d90c9ba714bb41763755696d42e7e64cf800c80729d0
7
+ data.tar.gz: 70b54fcc641af9ae839c916568e6af18444dc42d00054fcae859e64c9639b780a52eab7320582c15a1c392245fb0cad1cc43cc91557c4ae8716de04c419a6086
@@ -7,8 +7,7 @@ module Pod
7
7
  self.summary = 'pod kz clean 用于清理缓存以一些报错文件'
8
8
 
9
9
  self.description = <<-DESC
10
- 在pod update过程中由于代码变动,module缓存容易产生签名过期的问题,部分属性文件,跳转也会存在路径不对的情况,需要清理老旧缓存文件,
11
- 让Xcode重新生成
10
+ 在pod update过程中由于代码变动,module缓存容易产生签名过期的问题,部分属性文件,跳转也会存在路径不对的情况,需要清理老旧缓存文件,让Xcode重新生成
12
11
  DESC
13
12
 
14
13
  self.arguments = [
@@ -17,42 +16,50 @@ module Pod
17
16
 
18
17
  def self.options
19
18
  [
20
- %w[--xcode 清除module缓存与头文件索引问题],
19
+ ["--xcode", "清除module缓存与头文件索引问题"],
20
+ ["--framework", "清除所有自生成本地缓存的framework"],
21
21
  ]
22
22
  end
23
23
 
24
24
  def initialize(argv)
25
- clean_xcode = argv.flag?('xcode')
26
- banner! unless clean_xcode
25
+ @clean_xcode = argv.flag?('xcode')
26
+ @clean_framework = argv.flag?('framework')
27
+ banner! unless @clean_xcode || @clean_framework
27
28
 
28
29
  super
29
30
  end
30
31
 
31
32
  def run
32
- xcodeproj_path = Pathname.new(Dir[Pod::Config.instance.installation_root + "*.xcodeproj"].first)
33
- return unless xcodeproj_path
33
+ if @clean_xcode
34
+ xcodeproj_path = Pathname.new(Dir[Pod::Config.instance.installation_root + "*.xcodeproj"].first)
35
+ return unless xcodeproj_path
34
36
 
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?
37
+ xcode_derived_data_path = Pathname.new(Dir.home + "/Library/Developer/Xcode/DerivedData")
38
+ module_cache_noindex_path = xcode_derived_data_path + "ModuleCache.noindex"
39
+ FileUtils.rm_rf(module_cache_noindex_path) if module_cache_noindex_path.exist?
38
40
 
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'
41
+ project_name = xcodeproj_path.basename.to_s.split(".").first
42
+ Dir.foreach(xcode_derived_data_path) do |file_name|
43
+ next if file_name == '.' || file_name == '..' || file_name == '.DS_Store'
42
44
 
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?
45
+ if file_name.start_with?(project_name)
46
+ project_path = xcode_derived_data_path + file_name
47
+ index_noindex_path = project_path + "Index.noindex"
48
+ FileUtils.rm_rf(index_noindex_path) if index_noindex_path.exist?
49
+ end
50
+ end
51
+
52
+ default_xcode_path = Pathname.new('/Applications/Xcode.app')
53
+ if default_xcode_path.exist?
54
+ system("osascript -e 'quit app \"Xcode\"'")
55
+ sleep 1
56
+ workspace_path = Dir[Pod::Config.instance.installation_root + "*.xcworkspace"].first
57
+ system("open \"#{workspace_path}\"")
47
58
  end
48
59
  end
49
60
 
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}\"")
61
+ if @clean_framework
62
+ FileUtils.rm_r(KZ::KZ_POD_CONFIG_ROOT) if File.exist?(KZ::KZ_POD_CONFIG_ROOT)
56
63
  end
57
64
  end
58
65
  end
@@ -22,14 +22,16 @@ module Pod
22
22
  ['--framework', "后面需要跟上pod名(多个pod,使用英文逗号隔开),支持追加*匹配任意内容"],
23
23
  ['--code', "后面需要跟上pod名(多个pod,使用英文逗号隔开),支持追加*匹配任意内容"],
24
24
  ['--debug', "debug模式,会打印调试日志或生成调试文件"],
25
- ['--no-framework-update', "build后不再生成frameowrk"]
25
+ ['--framework-update', "build后不再生成frameowrk"],
26
+ ['--arm64-simulator', "适配模拟器的arm64模式,会自动将只支持真机arm64的framework转成arm64模式"]
26
27
  ].concat(super).reject { |(name, _)| name == '--no-repo-update' }
27
28
  end
28
29
 
29
30
  def initialize(argv)
30
31
  use_code_tag = argv.flag?('code')
31
32
  use_framework_tag = argv.flag?('framework')
32
- banner! if (use_code_tag && use_framework_tag) || (!use_code_tag && !use_framework_tag && !argv.empty?)
33
+ banner! unless isOptionsArgvFlag(argv.options.keys)
34
+ banner! if (use_code_tag && use_framework_tag)
33
35
 
34
36
  KZ::KZGlobalHelper.instance.analyze_special_parameters(use_code_tag, use_framework_tag, argv.arguments!)
35
37
  if Pod.match_version?('~> 1.11')
@@ -37,12 +39,20 @@ module Pod
37
39
  KZ::KZGlobalHelper.instance.generate_kz_pod_targets = true
38
40
  end
39
41
  KZ::KZGlobalHelper.instance.debug = true if argv.flag?('debug')
40
- KZ::KZGlobalHelper.instance.disable_generate_framework = true if argv.flag?('framework-update') != nil
42
+ KZ::KZGlobalHelper.instance.arm64_simulator = true if argv.flag?('arm64-simulator')
43
+ framework_update = argv.flag?('framework-update')
44
+ KZ::KZGlobalHelper.instance.disable_generate_framework = true if (framework_update != nil && framework_update == false)
41
45
 
42
46
  super
43
47
  @additional_args = argv.remainder!
44
48
  end
45
49
 
50
+ def isOptionsArgvFlag(all_flags)
51
+ return true if all_flags.empty?
52
+ supported_flags = ["repo-update", "deployment", "clean-install", "code", "framework", "debug", "framework-update", "arm64-simulator"]
53
+ return (all_flags & supported_flags) == all_flags
54
+ end
55
+
46
56
  def run
47
57
  KZ::KZGlobalHelper.instance.prepare
48
58
  install = Pod::Command::Install.new(CLAide::ARGV.new([*@additional_args]))
@@ -22,14 +22,16 @@ module Pod
22
22
  ['--framework', "后面需要跟上pod名(多个pod,使用英文逗号隔开),支持追加*匹配任意内容"],
23
23
  ['--code', "后面需要跟上pod名(多个pod,使用英文逗号隔开),支持追加*匹配任意内容"],
24
24
  ['--debug', "debug模式,会打印调试日志或生成调试文件"],
25
- ['--no-framework-update', "build后不再生成frameowrk"]
25
+ ['--no-framework-update', "build后不再生成frameowrk"],
26
+ ['--arm64-simulator', "适配模拟器的arm64模式,会自动将只支持真机arm64的framework转成arm64模式"]
26
27
  ].concat(super)
27
28
  end
28
29
 
29
30
  def initialize(argv)
30
31
  use_code_tag = argv.flag?('code')
31
32
  use_framework_tag = argv.flag?('framework')
32
- banner! if (use_code_tag && use_framework_tag) || (!use_code_tag && !use_framework_tag && !argv.empty?)
33
+ banner! unless isOptionsArgvFlag(argv.options.keys)
34
+ banner! if (use_code_tag && use_framework_tag)
33
35
 
34
36
  KZ::KZGlobalHelper.instance.analyze_special_parameters(use_code_tag, use_framework_tag, argv.arguments!)
35
37
  if Pod.match_version?('~> 1.11')
@@ -37,12 +39,20 @@ module Pod
37
39
  KZ::KZGlobalHelper.instance.generate_kz_pod_targets = true
38
40
  end
39
41
  KZ::KZGlobalHelper.instance.debug = true if argv.flag?('debug')
40
- KZ::KZGlobalHelper.instance.disable_generate_framework = true if argv.flag?('framework-update') != nil
42
+ KZ::KZGlobalHelper.instance.arm64_simulator = true if argv.flag?('arm64-simulator')
43
+ framework_update = argv.flag?('framework-update')
44
+ KZ::KZGlobalHelper.instance.disable_generate_framework = true if (framework_update != nil && framework_update == false)
41
45
 
42
46
  super
43
47
  @additional_args = argv.remainder!
44
48
  end
45
49
 
50
+ def isOptionsArgvFlag(all_flags)
51
+ return true if all_flags.empty?
52
+ supported_flags = ["sources", "exclude-pods", "clean-install", "code", "framework", "debug", "framework-update", "arm64-simulator"]
53
+ return (all_flags & supported_flags) == all_flags
54
+ end
55
+
46
56
  def run
47
57
  KZ::KZGlobalHelper.instance.prepare
48
58
  update = Pod::Command::Update.new(CLAide::ARGV.new([*@additional_args]))
@@ -1,5 +1,5 @@
1
1
  module CocoapodsKz
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
4
4
 
5
5
  module Pod
@@ -1,6 +1,8 @@
1
1
  require_relative 'kz_pod_target'
2
2
  require_relative 'kz_global_helper'
3
3
  require_relative 'kz_config_result'
4
+ require 'tmpdir'
5
+ require_relative 'kz_log'
4
6
 
5
7
  module KZ
6
8
  class KZFrameworkManager
@@ -48,5 +50,169 @@ module KZ
48
50
  @@all_resources_cache_info
49
51
  end
50
52
 
53
+ def self.handle_origin_framework(origin_frameworks, kz_pod_target)
54
+ new_frameworks = []
55
+ destination_path = kz_pod_target.pod_config_cache_path(false, true)
56
+ origin_frameworks.each do |origin_framework_path|
57
+ if kz_pod_target.disable_to_simulator_frameworks.include?(origin_framework_path)
58
+ new_frameworks.append(origin_framework_path)
59
+ else
60
+ new_framework_path = self.convert_arm64_to_simulator(origin_framework_path, destination_path)
61
+ if new_framework_path == origin_framework_path
62
+ kz_pod_target.disable_to_simulator_frameworks.append(origin_framework_path)
63
+ end
64
+ new_frameworks.append(new_framework_path)
65
+ end
66
+ end
67
+ new_frameworks
68
+ end
69
+
70
+ def self.convert_arm64_to_simulator(origin_framework_path, destination_path)
71
+ framework_name = origin_framework_path.basename.to_s
72
+ if framework_name.end_with?(".framework")
73
+ framework_basename = framework_name.chomp(".framework")
74
+ xcframework_path = destination_path + "#{framework_basename}.xcframework"
75
+ return xcframework_path if File.exist?(xcframework_path) && !Dir.empty?(xcframework_path)
76
+
77
+ if self.create_xcframework(origin_framework_path, origin_framework_path, framework_basename, xcframework_path)
78
+ return xcframework_path
79
+ else
80
+ return origin_framework_path
81
+ end
82
+ elsif framework_name.end_with?(".xcframework")
83
+ framework_basename = framework_name.chomp(".xcframework")
84
+ xcframework_path = destination_path + "#{framework_basename}.xcframework"
85
+ return xcframework_path if File.exist?(xcframework_path)
86
+
87
+ info_plist_path = origin_framework_path + "Info.plist"
88
+ return origin_framework_path unless File.exist?(info_plist_path)
89
+
90
+ info_plist = Xcodeproj::Plist.read_from_path(info_plist_path)
91
+ available_libraries = info_plist["AvailableLibraries"]
92
+ available_libraries.each do |available_librarie|
93
+ if available_librarie["SupportedPlatformVariant"] == "simulator" && available_librarie["SupportedArchitectures"].include?("arm64")
94
+ return origin_framework_path
95
+ end
96
+ end
97
+
98
+ # 找到真机arm64 framework与模拟器x86_64 framework
99
+ xc_framework_path = ""
100
+ xc_simulator_framework_path = ""
101
+ available_libraries.each do |available_librarie|
102
+ if available_librarie["SupportedPlatformVariant"] == "simulator"
103
+ if available_librarie["SupportedArchitectures"].include?("x86_64")
104
+ xc_simulator_framework_path = origin_framework_path + available_librarie["LibraryIdentifier"] + available_librarie["LibraryPath"]
105
+ end
106
+ elsif available_librarie["SupportedPlatform"] == "ios"
107
+ if available_librarie["SupportedArchitectures"].include?("arm64")
108
+ xc_framework_path = origin_framework_path + available_librarie["LibraryIdentifier"] + available_librarie["LibraryPath"]
109
+ end
110
+ end
111
+ end
112
+
113
+ xc_simulator_framework_path = xc_framework_path unless xc_simulator_framework_path != ""
114
+ if self.create_xcframework(xc_framework_path, xc_simulator_framework_path, framework_basename, xcframework_path)
115
+ return xcframework_path
116
+ else
117
+ return origin_framework_path
118
+ end
119
+ else
120
+ return origin_framework_path
121
+ end
122
+ end
123
+
124
+ def self.create_xcframework(origin_framework_path, origin_simulator_framework_path, framework_basename, destination_xcframework_path)
125
+ tempdir = Pathname(Dir.mktmpdir)
126
+ arm64_path = tempdir + "arm64"
127
+ FileUtils.mkdir_p(arm64_path)
128
+ arm64_framework_path = arm64_path + "#{framework_basename}.framework"
129
+ FileUtils.cp_r(origin_framework_path, arm64_framework_path)
130
+ arm64_framework_exe_path = arm64_framework_path + framework_basename
131
+ if self.contain_multiple_arch?(arm64_framework_exe_path)
132
+ system("lipo #{arm64_framework_exe_path} -thin arm64 -output #{arm64_framework_exe_path} #{KZGlobalHelper.instance.debug_shell_log_tag}")
133
+ end
134
+
135
+ simulator_path = tempdir + "simulator"
136
+ FileUtils.mkdir_p(simulator_path)
137
+ simulator_framework_path = simulator_path + "#{framework_basename}.framework"
138
+ FileUtils.cp_r(origin_simulator_framework_path, simulator_framework_path)
139
+ simulator_framework_exe_path = simulator_framework_path + framework_basename
140
+ contain_x8664 = self.contain_x8664?(simulator_framework_exe_path)
141
+ if contain_x8664
142
+ system("lipo #{simulator_framework_exe_path} -thin x86_64 -output #{simulator_framework_exe_path} #{KZGlobalHelper.instance.debug_shell_log_tag}")
143
+ else
144
+ FileUtils.rm(simulator_framework_exe_path)
145
+ end
146
+
147
+ temp_framwork_exe_path = tempdir + "#{framework_basename}_arm64_simulator"
148
+
149
+ if self.is_dynamic_library?(origin_framework_path + framework_basename)
150
+ xcrun_vtool_show_result = `xcrun vtool -arch arm64 -show #{origin_framework_path + framework_basename}`.lines.map(&:chomp)
151
+ framework_sdk_version = "16.0"
152
+ framework_deployment_version = "12.0"
153
+ reach_cmd_tag = false
154
+ xcrun_vtool_show_result.each do |line|
155
+ reach_cmd_tag = false if line.start_with?("Load command")
156
+
157
+ line_infos = line.lstrip.split
158
+ next unless line_infos.count == 2
159
+
160
+ if line_infos.first == "cmd" && line_infos.last == "LC_VERSION_MIN_IPHONEOS"
161
+ reach_cmd_tag = true
162
+ end
163
+
164
+ if reach_cmd_tag
165
+ if line_infos.include?("sdk")
166
+ framework_sdk_version = line_infos.last
167
+ elsif line_infos.include?("version")
168
+ framework_deployment_version = line_infos.last
169
+ end
170
+ end
171
+ end
172
+ xcrun_vtool_set_result = system("xcrun vtool -arch arm64 -set-build-version 7 #{framework_deployment_version} #{framework_sdk_version} -replace -output #{temp_framwork_exe_path} #{arm64_framework_exe_path}")
173
+ unless xcrun_vtool_set_result
174
+ FileUtils.rm_r(tempdir)
175
+ return false
176
+ end
177
+ else
178
+ ar_x_path = tempdir + "ar_x"
179
+ FileUtils.mkdir_p(ar_x_path)
180
+ ar_x_success = system("cd #{ar_x_path}; ar x #{arm64_framework_exe_path}")
181
+ if ar_x_success
182
+ system("for file in #{ar_x_path}/*.o; do #{ARM64_TO_SIMULATOR_EXECUTE_PATH} $file; done")
183
+ system("ar crv #{temp_framwork_exe_path} #{ar_x_path}/*.o &> /dev/null")
184
+ else
185
+ FileUtils.rm_r(tempdir)
186
+ return false
187
+ end
188
+ end
189
+
190
+ if contain_x8664
191
+ system("lipo -create #{temp_framwork_exe_path} #{simulator_framework_exe_path} -output #{simulator_framework_exe_path} #{KZGlobalHelper.instance.debug_shell_log_tag}")
192
+ else
193
+ FileUtils.mv("#{temp_framwork_exe_path}", simulator_framework_exe_path)
194
+ end
195
+ FileUtils.mkdir_p(destination_xcframework_path) unless File.exist?(destination_xcframework_path)
196
+ system("xcodebuild -create-xcframework -framework $(readlink -f '#{arm64_framework_path}') -framework $(readlink -f '#{simulator_framework_path}') -output #{destination_xcframework_path} #{KZGlobalHelper.instance.debug_shell_log_tag}")
197
+ FileUtils.rm_r(tempdir)
198
+
199
+ return true
200
+ end
201
+
202
+ def self.is_dynamic_library?(file_path)
203
+ file_result = `file -b #{file_path}`
204
+ return file_result.include?("dynamically linked shared library")
205
+ end
206
+
207
+ def self.contain_x8664?(file_path)
208
+ file_result = `file -b #{file_path}`
209
+ return file_result.include?("for architecture x86_64")
210
+ end
211
+
212
+ def self.contain_multiple_arch?(file_path)
213
+ file_result = `lipo -info #{file_path}`
214
+ return file_result.include?("Architectures in the fat file")
215
+ end
216
+
51
217
  end
52
218
  end
@@ -108,6 +108,8 @@ module KZ
108
108
 
109
109
  if all_repair_hmap_info.count > 0
110
110
  hmap_cache_path = kz_pod_target.pod_config_cache_path(false)
111
+ FileUtils.mkdir_p(hmap_cache_path) unless File.exist?(hmap_cache_path)
112
+
111
113
  save_hmap_file(all_repair_hmap_info, hmap_cache_path, target_name + '_repair')
112
114
  kz_pod_target.repair_header_search_path = hmap_cache_path + "#{target_name}_repair.hmap"
113
115
  end
@@ -117,6 +119,8 @@ module KZ
117
119
  private_hamp_info = private_hmap_info(kz_pod_target)
118
120
  if private_hamp_info.count > 0
119
121
  hmap_cache_path = kz_pod_target.pod_config_cache_path(false)
122
+ FileUtils.mkdir_p(hmap_cache_path) unless File.exist?(hmap_cache_path)
123
+
120
124
  save_hmap_file(private_hamp_info, hmap_cache_path, target_name)
121
125
  kz_pod_target.private_header_search_path = hmap_cache_path + "#{target_name}.hmap"
122
126
  end
@@ -141,13 +145,14 @@ module KZ
141
145
 
142
146
  def clean_hmap_cache(kz_pod_target)
143
147
  hmap_cache_path = kz_pod_target.pod_config_cache_path(false)
148
+
144
149
  Dir.foreach(hmap_cache_path) do |file_name|
145
150
  next if file_name == '.' || file_name == '..' || file_name == '.DS_Store'
146
151
 
147
152
  if file_name.end_with?(".hmap", ".json")
148
153
  FileUtils.rm(hmap_cache_path + file_name) if File.exist?(hmap_cache_path + file_name)
149
154
  end
150
- end
155
+ end if File.exist?(hmap_cache_path)
151
156
  end
152
157
 
153
158
  def repair_hmap_info(kz_pod_target)
@@ -18,6 +18,7 @@ module KZ
18
18
 
19
19
  HMAP_EXECUTE_PATH = File.dirname(__FILE__) + '/../resources/hmap'
20
20
  FLEX_COMPLIER_PATH = KZ_POD_CONFIG_SUPPORT_FILES + 'FlexCompiler'
21
+ ARM64_TO_SIMULATOR_EXECUTE_PATH = File.dirname(__FILE__) + '/../resources/arm64ToSimulator'
21
22
  KZ_GENERATOR_FRAMEWORK_PATH = KZ_POD_CONFIG_SUPPORT_FILES + 'kz_generator_framework.sh'
22
23
  KZ_XML_BUILD_PATH = KZ_POD_CONFIG_SUPPORT_FILES + 'kz_xml_build.sh'
23
24
  KZ_LOCK_FILE_PATH = KZ_POD_CONFIG_ROOT + 'KZConfigLock'
@@ -48,6 +49,8 @@ module KZ
48
49
  attr_accessor :kz_config_lock
49
50
  attr_accessor :disable_generate_framework
50
51
  attr_accessor :generate_kz_pod_targets
52
+ attr_accessor :debug_shell_log_tag
53
+ attr_accessor :arm64_simulator
51
54
 
52
55
  private_class_method :new
53
56
 
@@ -60,6 +63,15 @@ module KZ
60
63
  @disable_generate_framework = false
61
64
  @generate_kz_pod_targets = false
62
65
  @olde_lock_file_content = nil
66
+ @debug_shell_log_tag = "&> /dev/null"
67
+ @arm64_simulator = false
68
+ end
69
+
70
+ def debug=(value)
71
+ @debug = value
72
+ if debug
73
+ @debug_shell_log_tag = ""
74
+ end
63
75
  end
64
76
 
65
77
  @@instance = nil
@@ -0,0 +1,11 @@
1
+ module KZ
2
+
3
+ class KZLog
4
+ def self.log(logStr)
5
+ if KZGlobalHelper.instance.debug
6
+ puts logStr
7
+ end
8
+ end
9
+ end
10
+ end
11
+
@@ -46,6 +46,8 @@ module KZ
46
46
 
47
47
  attr_accessor :use_modulemap
48
48
 
49
+ attr_accessor :disable_to_simulator_frameworks
50
+
49
51
  def initialize(native_pod_target)
50
52
  @native_pod_target = native_pod_target
51
53
  @name = native_pod_target.name
@@ -64,6 +66,7 @@ module KZ
64
66
  @use_local_private_headers_path = false
65
67
  @force_load = false
66
68
  @use_modulemap = true
69
+ @disable_to_simulator_frameworks = []
67
70
 
68
71
  native_pod_target.file_accessors.each do |file_accessor|
69
72
  file_accessor.kz_pod_target = self
@@ -188,6 +191,8 @@ module KZ
188
191
 
189
192
  # 直接用于配置HEADER_SEARCH_PATHS
190
193
  def header_search_paths(custom_paths)
194
+ return '' unless current_should_build?
195
+
191
196
  header_search_paths = ''
192
197
  header_search_paths = KZ.deal_path_for_xcconfig(@private_header_search_path, true) if @private_header_search_path
193
198
  repair_header_search_paths = self.all_repair_header_search_paths.join(' ')
@@ -226,11 +231,11 @@ module KZ
226
231
  end
227
232
 
228
233
  # 获取target对应的配置根目录,部分文件需要依赖版本进行存储
229
- def pod_config_cache_path(concat_version)
230
- kz_target_framework_folder = KZ_POD_CONFIG_POD_TARGETS + @name
231
- kz_target_framework_folder += @version if concat_version
232
- FileUtils.mkdir_p(kz_target_framework_folder) unless File.exist?(kz_target_framework_folder) || concat_version
233
- kz_target_framework_folder
234
+ def pod_config_cache_path(concat_version, vendored_framework = false)
235
+ kz_target_config_folder = KZ_POD_CONFIG_POD_TARGETS + @name
236
+ kz_target_config_folder += "vendored_framework" if vendored_framework
237
+ kz_target_config_folder += @version if concat_version
238
+ kz_target_config_folder
234
239
  end
235
240
 
236
241
  # 获取target中的module name,默认为product_module_name与target.name也相同。
@@ -72,10 +72,15 @@ module Pod
72
72
 
73
73
  alias_method :origin_vendored_frameworks, :vendored_frameworks
74
74
  def vendored_frameworks
75
- result = KZ::KZGlobalHelper.instance.pod_config_result_with_target(self.kz_pod_target)
76
- if !self.spec.test_specification && result
75
+ if self.kz_pod_target
77
76
  frameworks = origin_vendored_frameworks
78
- frameworks.concat(result.get_framework_paths)
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
@@ -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,10 @@ 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
58
66
 
59
67
  add_repair_modulemap(xcconfig, kz_pod_target.all_repair_modulemap_paths, kz_pod_target.current_uses_swift?)
60
68
  add_repair_swift_include_path(xcconfig, kz_pod_target.all_repair_swift_include_paths, kz_pod_target.current_uses_swift?)
@@ -12,4 +12,5 @@ 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'
15
16
  end
@@ -8,6 +8,8 @@ if !File.exist?(current_pods_pbxproj_path) || !FileUtils.compare_file(current_po
8
8
  FileUtils.cp_r(temp_pods_pbxproj_path, current_pods_pbxproj_path)
9
9
  end
10
10
 
11
+ FileUtils.rm_r(Pathname(temp_pods_pbxproj_path).dirname)
12
+
11
13
  xcode_running = system("ps aux | grep '[X]code' > /dev/null 2>&1")
12
14
  if xcode_running
13
15
  system("touch #{current_pods_pbxproj_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.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - yixiong
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-20 00:00:00.000000000 Z
11
+ date: 2024-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -59,6 +59,7 @@ 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
@@ -69,11 +70,13 @@ files:
69
70
  - lib/cocoapods-kz/native/installer.rb
70
71
  - lib/cocoapods-kz/native/pod_target.rb
71
72
  - lib/cocoapods-kz/native/pod_target_installer.rb
73
+ - lib/cocoapods-kz/native/pod_target_integrator.rb
72
74
  - lib/cocoapods-kz/native/pods_project_writer.rb
73
75
  - lib/cocoapods-kz/native/specification.rb
74
76
  - lib/cocoapods-kz/native/target.rb
75
77
  - lib/cocoapods-kz/native/target_installer_helper.rb
76
78
  - lib/cocoapods-kz/resources/FlexCompiler
79
+ - lib/cocoapods-kz/resources/arm64ToSimulator
77
80
  - lib/cocoapods-kz/resources/hmap
78
81
  - lib/cocoapods-kz/resources/kz_fix_force_load_exe.sh
79
82
  - lib/cocoapods-kz/resources/kz_generator_framework.sh