cocoapods-meitu-bin 3.0.0 → 3.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7031e306ba5fe02226aa2ef9d1e35d27c6de7683c3ff0010c430bec87778bdd8
4
- data.tar.gz: 571e8af4cdeb6b04f669ee6fcc3111a44a626df6e8f5d6887e7afbebfbca443d
3
+ metadata.gz: 64618df0d8fedfa3147cc0785b216cf4948a2a27b7c177e3b4cd572f57907547
4
+ data.tar.gz: 13098bebfe761c555f71c684a31196c8ee26882bf893b47ac266778bf91932dc
5
5
  SHA512:
6
- metadata.gz: 0675d5f0d9aa51c0fdd09a567da454c1644f035b5f40867910b5984834aecb807b27586e73b991a05c1e0222c3f49ef195c0deb1cae82a4e729d45f49d84b79a
7
- data.tar.gz: 6607870a45cb753f7a86426f0637d0f30b5a2fc38912c8a0a5fab00af1bea2e0dec17d4f1b42a494c61bc3f4a317be83a44dae098ed7032934a7574fdc9c8c0b
6
+ metadata.gz: 1f838b44f28942d9b863896ca12aadf21bc7f5a559b87f774dcab8fac5d28f62d8974c073d0c8aa05f49821742ceb6b65418e222312c4134fc188429cfe0a32c
7
+ data.tar.gz: 4e58a28dcb1b243c748c4c311f0f56bd133e1021b54602b03f791dabe7c245be0cbf6487bc01a8aef2d15e55be4c1780640ea19d8cad320434ccb582c15fd521
@@ -164,6 +164,8 @@ class PodUpdateConfig
164
164
  @@is_mtxx = false
165
165
  @@is_clear = false
166
166
  @@shell_project = false
167
+ ##是否设置podfile.lock = nil
168
+ @@is_podfile_lock_nil= false
167
169
  @@checkout_options = {}
168
170
  @@dependency_relationships = {} # 存储所有组件的依赖关系集合,格式: { pod_name => { dependencies: { dep_name => { version: version, requirement: requirement } } } }
169
171
 
@@ -173,6 +175,9 @@ class PodUpdateConfig
173
175
  @@external_source = []
174
176
  # 用于存储需要记录制作的external_source 组件
175
177
  @@external_source_binary = []
178
+ # 记录 Podfile 中通过 :commit 指定的本地组件及其 git 信息,格式: { pod_name => { git: git_url, commit: commit_hash } }
179
+ # mbox 激活组件,避免关联组件都切换到源码,影响编译速度
180
+ @@pods_with_commit = {}
176
181
 
177
182
  # 设置依赖关系集合
178
183
  def self.set_dependency_relationships(relationships)
@@ -200,6 +205,31 @@ class PodUpdateConfig
200
205
  end
201
206
 
202
207
 
208
+ # 存储最新解析到的本地组件列表(包含路径与 commit)
209
+ def self.set_pods_with_commit(pods)
210
+ @@pods_with_commit = pods
211
+ end
212
+
213
+ # 读取本地组件列表
214
+ def self.pods_with_commit
215
+ @@pods_with_commit
216
+ end
217
+
218
+ def self.get_with_commit(pod_name)
219
+ options = @@pods_with_commit[pod_name]
220
+ return nil unless options
221
+ # 优先返回commit信息
222
+ if options[:commit]
223
+ options[:commit]
224
+ # 其次返回tag信息
225
+ elsif options[:tag]
226
+ options[:tag]
227
+ else
228
+ nil
229
+ end
230
+
231
+ end
232
+
203
233
  def self.set_external_source_binary(dic)
204
234
  @@external_source_binary << dic
205
235
  end
@@ -215,7 +245,7 @@ class PodUpdateConfig
215
245
  @@checkout_options
216
246
  end
217
247
 
218
- def self.get_checkout_option(pod_name,podfile)
248
+ def self.get_checkout_option(pod_name)
219
249
  options = @@checkout_options[pod_name]
220
250
 
221
251
  # return nil unless !podfile.use_source_pods.include?(pod_name)
@@ -275,12 +305,14 @@ class PodUpdateConfig
275
305
  end
276
306
  end
277
307
 
278
- def self.parse_checkout_options_from_specs(checkout_options_hash,podfile)
308
+ def self.parse_checkout_options_from_specs(checkout_options_hash,podfile,path_commit_pods)
279
309
  options = {}
280
310
 
281
311
  checkout_options_hash.each do |pod_name, opts|
282
312
  # 保存有 commit 或 tag 信息的组件
283
- if (opts[:commit] || opts[:tag]) && !podfile.use_source_pods.include?(pod_name)
313
+ # 注意:不再过滤 use_source_pods 中的组件,因为从二进制切换到源码时
314
+ # 也需要保留 checkout options(commit/tag),否则会导致找不到正确的下载源
315
+ if opts[:commit] || opts[:tag]
284
316
  options[pod_name] = {
285
317
  :git => opts[:git],
286
318
  :commit => opts[:commit],
@@ -288,9 +320,20 @@ class PodUpdateConfig
288
320
  }.compact
289
321
  end
290
322
  end
291
-
323
+ path_commit_pods.each do |pod_name, opts|
324
+ options[pod_name] = opts if options[pod_name].nil?
325
+ # puts "追加本地组件 #{pod_name} 的 commit 信息: #{opts[:commit]}".yellow
326
+ end
292
327
  set_checkout_options(options)
293
328
 
329
+ # 调试输出
330
+ # Pod::UI.puts "[DEBUG] parse_checkout_options_from_specs: 解析到的 checkout_options 数量=#{options.size}".yellow
331
+ # if options['MTLivePhoto'] || options['MTLPCloudService']
332
+ # Pod::UI.puts "[DEBUG] MTLivePhoto checkout_option: #{options['MTLivePhoto'].inspect}".yellow
333
+ # Pod::UI.puts "[DEBUG] MTLPCloudService checkout_option: #{options['MTLPCloudService'].inspect}".yellow
334
+ # end
335
+ # Pod::UI.puts "[DEBUG] checkout_options_hash 输入: #{checkout_options_hash.keys.join(', ')}".yellow if checkout_options_hash.keys.include?('MTLivePhoto') || checkout_options_hash.keys.include?('MTLPCloudService')
336
+
294
337
  if ENV['p_bin_v'] == '1'
295
338
  puts "\nResolver Specs CHECKOUT OPTIONS (commit/tag):".yellow
296
339
  options.each do |pod, opts|
@@ -361,4 +404,17 @@ class PodUpdateConfig
361
404
  def self.is_clear
362
405
  @@is_clear
363
406
  end
407
+
408
+ def self.clear
409
+ @@pods = []
410
+ @@lockfile = nil
411
+ @@is_clear = true
412
+ end
413
+ def self.is_podfile_lock_nil
414
+ @@is_podfile_lock_nil
415
+ end
416
+ def self.set_is_podfile_lock_nil(value)
417
+ @@is_podfile_lock_nil = value
418
+ end
419
+
364
420
  end
@@ -1,5 +1,5 @@
1
1
  module CBin
2
- VERSION = "3.0.0"
2
+ VERSION = "3.0.1"
3
3
  end
4
4
 
5
5
  module Pod
@@ -19,12 +19,11 @@ module CBin
19
19
  }.sort!
20
20
 
21
21
  version_name = PodUpdateConfig.dependency_relationships[pod_name]
22
- if version_name
22
+ if version_name && version_name != ""
23
23
  specs << version_name
24
24
  else
25
- specs << binary_version_pods_str(pod_name,specifications)
25
+ specs << binary_version_pods_str(pod_name,specifications)
26
26
  end
27
-
28
27
  specs << minimum_deployment_target_str
29
28
  specs << bundle_identifier_str
30
29
  specs << random_value_str
@@ -40,7 +39,11 @@ module CBin
40
39
  if ENV['p_bin_v'] == '1'
41
40
  UI.puts "`#{pod_name}`:#{specs_str}".red
42
41
  end
42
+
43
43
  specs_str_md5 = Digest::MD5.hexdigest(specs_str)[0,6]
44
+ # if pod_name == "AFNetworking"
45
+ # puts "AFNetworking 参与二进制版本号生成的字符串:#{specs_str_md5}".yellow
46
+ # end
44
47
  @specs_str_md5_hash[pod_name] = specs_str_md5
45
48
  else
46
49
  specs_str_md5 = @specs_str_md5_hash[pod_name]
@@ -73,6 +76,11 @@ module CBin
73
76
  version_arr.delete_at(version_arr.size - 1)
74
77
  version = version_arr.join('.')
75
78
  end
79
+ commit = PodUpdateConfig.get_with_commit(pod_name)
80
+ if commit
81
+ result << "#{pod_name}(#{commit})"
82
+ break
83
+ end
76
84
  result << "#{pod_name}(#{version})"
77
85
  break
78
86
  end
@@ -130,6 +130,7 @@ module CBin
130
130
  subspec['vendored_libraries'] = spec['vendored_libraries']
131
131
  subspec['resources'] = spec['resources']
132
132
  # 删除无用字段
133
+ subspec.delete('source')
133
134
  delete_unused(subspec)
134
135
  end
135
136
 
@@ -11,6 +11,7 @@ module Pod
11
11
  deps = dependencies_to_fetch(podfile_state)
12
12
  pods = pods_to_fetch(podfile_state)
13
13
  return if deps.empty?
14
+
14
15
  UI.section 'Fetching external sources' do
15
16
  if installation_options.install_with_multi_threads
16
17
  thread_count = installation_options.multi_threads_count
@@ -25,6 +26,27 @@ module Pod
25
26
  end
26
27
  end
27
28
 
29
+ # 关键修复:覆盖 fetch_external_source 方法
30
+ # 过滤 Podfile.lock 中只有 :commit 没有 :git 的无效 checkout_options
31
+ # 这种情况发生在 mbox activate 激活本地库时,lockfile 保留了旧的 commit 信息
32
+ alias old_fetch_external_source fetch_external_source
33
+ def fetch_external_source(dependency, use_lockfile_options)
34
+ # 检查 lockfile 中的 checkout_options 是否有效
35
+ if use_lockfile_options && lockfile
36
+ checkout_options = lockfile.checkout_options_for_pod_named(dependency.root_name)
37
+ if checkout_options
38
+ # 检查 checkout_options 是否有效(必须有 :git, :path, 或 :podspec)
39
+ has_valid_source = checkout_options[:git] || checkout_options[:path] || checkout_options[:podspec]
40
+ unless has_valid_source
41
+ # 无效的 checkout_options(只有 :commit 没有 :git),强制使用 dependency.external_source
42
+ use_lockfile_options = false
43
+ end
44
+ end
45
+ end
46
+
47
+ old_fetch_external_source(dependency, use_lockfile_options)
48
+ end
49
+
28
50
  # > 1.6.0
29
51
  # all_specs[dep.name] 为 nil 会崩溃
30
52
  # 主要原因是 all_specs 分析错误
@@ -14,23 +14,28 @@ module Pod
14
14
  alias mtxx_create_analyzer create_analyzer
15
15
  def create_analyzer(plugin_sources = nil)
16
16
  # 修复MBox下即使存在Podfile.lock依赖分析依然很慢的问题
17
- if !lockfile.nil? && lockfile.internal_data.empty?
18
- @lockfile = Lockfile.from_file(config.lockfile_path) if config.lockfile_path
19
- end
20
-
21
- podfile.use_source_pods.each do |name|
22
- # 如果lockfile存在,移除external_source_pods和checkout_options中的name元素
23
- if !lockfile.nil? && lockfile.internal_data && lockfile.internal_data['EXTERNAL SOURCES']
24
- # 从external_source_pods中移除
25
- lockfile.internal_data['EXTERNAL SOURCES'].delete(name)
17
+ if PodUpdateConfig.is_podfile_lock_nil
18
+ @lockfile = nil
19
+ else
20
+ if !lockfile.nil? && lockfile.internal_data.empty?
21
+ @lockfile = Lockfile.from_file(config.lockfile_path) if config.lockfile_path
26
22
  end
27
23
 
28
- if !lockfile.nil? && lockfile.internal_data && lockfile.internal_data['CHECKOUT OPTIONS']
29
- # checkout_options中移除
30
- lockfile.internal_data['CHECKOUT OPTIONS'].delete(name)
24
+ podfile.use_source_pods.each do |name|
25
+ # 如果lockfile存在,移除external_source_pods和checkout_options中的name元素
26
+ if !lockfile.nil? && lockfile.internal_data && lockfile.internal_data['EXTERNAL SOURCES']
27
+ # 从external_source_pods中移除
28
+ lockfile.internal_data['EXTERNAL SOURCES'].delete(name)
29
+ end
30
+
31
+ if !lockfile.nil? && lockfile.internal_data && lockfile.internal_data['CHECKOUT OPTIONS']
32
+ # 从checkout_options中移除
33
+ lockfile.internal_data['CHECKOUT OPTIONS'].delete(name)
34
+ end
31
35
  end
32
36
  end
33
37
 
38
+
34
39
  mtxx_create_analyzer(plugin_sources)
35
40
  end
36
41
 
@@ -232,6 +237,17 @@ module Pod
232
237
  def print_source_bin_statistics(source_pods,bin_pods)
233
238
 
234
239
  UI.puts "\npod_time_profiler: 总共有 #{@pod_targets.size} 个Pod库,二进制有 #{bin_pods.size} 个,源码有 #{source_pods.size} 个".green
240
+
241
+ # 将二进制个数写入 Podfile 同级目录的 source_pods_size.txt
242
+ begin
243
+ file_path = (Pod::Config.instance.installation_root + 'source_pods_size.txt').to_s
244
+ if File.exist?(file_path)
245
+ File.delete(file_path) rescue nil
246
+ end
247
+ File.open(file_path, 'w') { |f| f << source_pods.size.to_s }
248
+ rescue => e
249
+ UI.puts "pod_time_profiler: 写入二进制个数日志失败:#{e}".red
250
+ end
235
251
  # 打印二进制库
236
252
  if ENV['statistics_bin'] == '1'
237
253
  UI.puts "二进制库:".green
@@ -17,13 +17,14 @@ module Pod
17
17
  #
18
18
  # @param [Specification] spec
19
19
  #
20
- alias old_podfile_for_spec podfile_for_spec
20
+ alias old_podfile_for_specs podfile_for_specs
21
21
 
22
- def podfile_for_spec(spec)
22
+ def podfile_for_specs(specs)
23
+ spec = specs.first
23
24
  generator = self
24
25
  dir = configuration.gen_dir_for_pod(spec.name)
25
26
 
26
- Pod::Podfile.new do
27
+ podfile = Pod::Podfile.new do
27
28
  project "#{spec.name}.xcodeproj"
28
29
  workspace "#{spec.name}.xcworkspace"
29
30
 
@@ -194,6 +195,7 @@ module Pod
194
195
  pod dependency.name, **pod_options
195
196
  end
196
197
  end
198
+ { specs => podfile }
197
199
  end
198
200
  end
199
201
  end
@@ -147,31 +147,122 @@ module Pod
147
147
  external_source_pods = @podfile_dependency_cache.podfile_dependencies.select(&:external_source).map(&:root_name).uniq
148
148
  checkout_options = sandbox.checkout_sources.select { |root_name, _| external_source_pods.include? root_name }
149
149
 
150
+
151
+
150
152
  if podfile.use_binaries?
151
- PodUpdateConfig.parse_checkout_options_from_specs(checkout_options,podfile)
153
+ path_pods = @podfile_dependency_cache.podfile_dependencies
154
+ .select { |dep| dep.external_source && dep.external_source[:path] }
155
+ .map(&:root_name)
156
+ .uniq
157
+ path_commit_pods = {}
158
+ path_pods.each do |pod_name|
159
+ if PodUpdateConfig.pods_with_commit[pod_name]
160
+ path_commit_pods[pod_name] = PodUpdateConfig.pods_with_commit[pod_name]
161
+ end
162
+ end
163
+ PodUpdateConfig.parse_checkout_options_from_specs(checkout_options,podfile,path_commit_pods)
152
164
  end
165
+
166
+
153
167
  all_pods = {}
154
168
  @activated.vertices.each do |vertex|
155
169
  all_pods[ "#{vertex[1].name.split("/").first }"] = vertex[1].payload.version.version
156
170
  end
171
+
172
+ # 构建主库到合并依赖的映射: 主库名 => 所有依赖(合并子库后的)
173
+ # 性能优化: 先将 vertices 按 root name 分组,避免 N*M 嵌套循环
174
+ vertices_by_root = Hash.new { |h, k| h[k] = [] }
175
+ @activated.vertices.each do |vertex_name, vertex|
176
+ root_name = vertex_name.split("/").first
177
+ vertices_by_root[root_name] << vertex
178
+ end
179
+
180
+ root_pods_dependencies = {}
181
+ all_pods.each_key do |root_name|
182
+ # 收集该主库及其所有子库的依赖
183
+ all_dependencies = {}
184
+
185
+ # 直接查表获取属于当前主库的 vertices,无需遍历全部
186
+ vertices_by_root[root_name].each do |vertex|
187
+ deps = get_all_dependencies(vertex)
188
+ # 合并依赖到 all_dependencies
189
+ all_dependencies.merge!(deps)
190
+ end
191
+
192
+ root_pods_dependencies[root_name] = all_dependencies
193
+ end
194
+
157
195
  result = {}
158
196
  all_pods.each do |key ,version|
159
- vertex = @activated.vertices[key]
160
- deps = get_all_dependencies(vertex)
161
- pod_names = ""
162
- deps.each do |name ,version|
163
- checkout_option = PodUpdateConfig.get_checkout_option(name,podfile)
197
+ deps = root_pods_dependencies[key]
198
+
199
+ # pod_names = ""
200
+ # deps.each do |name ,version|
201
+ # checkout_option = nil
202
+ # if !checkout_options[name].nil?
203
+ # checkout_option = checkout_options[name][:commit]
204
+ # if checkout_option.nil?
205
+ # checkout_option = checkout_options[name][:tag]
206
+ # end
207
+ # end
208
+ # if checkout_option
209
+ # name_version = "#{name.split("/").first }_#{checkout_option}"
210
+ # pod_names << "|" << name_version unless pod_names.include?(name_version)
211
+ # else
212
+ # name_version = "#{name.split("/").first }_#{version[:version].version}"
213
+ # pod_names << "|" << name_version unless pod_names.include?(name_version)
214
+ # end
215
+ #
216
+ # end
217
+ # result[key] = pod_names
218
+
219
+
220
+ pod_names = []
221
+ deps.each do |name, dep_info|
222
+ checkout_option = nil
223
+
224
+ if !checkout_options[name].nil?
225
+ checkout_option = checkout_options[name][:commit]
226
+ if checkout_option.nil?
227
+ checkout_option = checkout_options[name][:tag]
228
+ end
229
+ end
230
+
231
+ pod_name = name.split("/").first
164
232
  if checkout_option
165
- name_version = "#{name.split("/").first }_#{checkout_option}"
166
- pod_names << "|" << name_version unless pod_names.include?(name_version)
233
+ name_version = "#{pod_name}_#{checkout_option}"
234
+ pod_names << name_version unless pod_names.join("|").include?(pod_name)
235
+
236
+ # if key == "MTRoboNeoModule" && pod_name == "MTXXFilters"
237
+ # puts "MTRoboNeoModule 依赖的 MTXXFilters 使用了 commit 方式,commit 为 #{checkout_option} name == #{name} ".yellow
238
+ # end
167
239
  else
168
- name_version = "#{name.split("/").first }_#{version[:version].version}"
169
- pod_names << "|" << name_version unless pod_names.include?(name_version)
240
+ name_version = "#{pod_name}_#{dep_info[:version].version}"
241
+ opts = path_commit_pods&.[](pod_name)
242
+ if opts && opts[:commit]
243
+ commit = opts[:commit]
244
+ name_commit = "#{pod_name}_#{commit}"
245
+ pod_names << name_commit unless pod_names.join("|").include?(pod_name)
246
+ else
247
+ # if key == "MTRoboNeoModule" && pod_name == "MTXXFilters"
248
+ # puts "MTRoboNeoModule 依赖的 MTXXFilters 使用了 version 方式,version 为 #{name_version} name == #{name} ".yellow
249
+ # end
250
+ pod_names << name_version unless pod_names.join("|").include?(pod_name)
251
+ end
170
252
  end
171
-
172
253
  end
173
- result[key] = pod_names
254
+
255
+ unique_array = pod_names.uniq
256
+ sorted_array = unique_array.sort_by(&:downcase)
257
+ result_names = sorted_array.join("|")
258
+ result[key] = "|#{result_names}"
259
+
260
+ # if key == "MTXXPhotoPicker"
261
+ # puts "MTXXPhotoPicker 合并后的依赖数量:#{deps.size}".yellow
262
+ # puts "MTXXPhotoPicker 参与二进制版本号生成的字符串:#{result_names}".yellow
263
+ # end
174
264
  end
265
+ # puts "MTRoboNeoModule 参与二进制版本号生成的字符串:#{result["MTRoboNeoModule"]}".yellow
175
266
  PodUpdateConfig.set_dependency_relationships(result)
176
267
  UI.puts "pod_time_profiler: dependency_relationships:#{'%.1f' % (Time.now - start_time)}s".green
177
268
  resolver_specs_by_target
@@ -214,7 +305,15 @@ module Pod
214
305
 
215
306
  # developments 组件采用默认输入的 spec (development pods 的 source 为 nil)
216
307
  # 可以使 :podspec => "htts://IMYFoundation.podspec"可以走下去,by slj
217
- dependency_source = PodUpdateConfig.get_checkout_option(rspec.root.name,podfile)
308
+ dependency_source = PodUpdateConfig.get_checkout_option(rspec.root.name)
309
+
310
+ # 关键修复:本地 path 依赖的组件(sandbox.local? 为 true)
311
+ # 应该直接使用原始 rspec,不应走 spec repo 查找和替换逻辑
312
+ # 否则如果 spec repo 中的旧版 podspec 缺少某些 subspecs,
313
+ # subspec_by_name 会返回 nil,导致该 subspec 丢失
314
+ if sandbox.local?(rspec.root.name)
315
+ next rspec
316
+ end
218
317
 
219
318
  unless rspec.spec.respond_to?(:spec_source) && rspec.spec.spec_source
220
319
 
@@ -225,11 +324,23 @@ module Pod
225
324
 
226
325
  # 采用二进制依赖并且不为开发组件
227
326
  use_binary = use_binary_rspecs.include?(rspec)
327
+
228
328
  if use_binary
229
329
  source = sources_manager.binary_source
230
330
  configuration = ENV['configuration'] || podfile.configuration
231
331
  spec_version = version_helper.version(rspec.root.name, rspec.spec.version, specifications, configuration, podfile.include_dependencies?)
232
332
  else
333
+ # 关键修复:对于通过 commit/tag 指定的组件,在切换到源码时
334
+ # 应该保持原始 rspec,让 CocoaPods 走正常的 external source 下载流程
335
+ # 而不是尝试从 spec repo 查找(会导致找到的 podspec 的 s.source 不匹配)
336
+ # 注意:mbox activate 激活的本地库,checkout_options 中只有 :commit 没有 :git
337
+ # 这种情况下不应该走 external source 流程,应该走 path 依赖流程
338
+ full_checkout_options = PodUpdateConfig.checkout_options[rspec.root.name]
339
+ if dependency_source && full_checkout_options && full_checkout_options[:git]
340
+ # 这是一个有效的 external source 组件(同时有 :git 和 :commit/:tag),保持原样
341
+ next rspec
342
+ end
343
+
233
344
  # 获取podfile中的source
234
345
  podfile_sources = podfile.sources.uniq.map { |source| sources_manager.source_with_name_or_url(source) }
235
346
  source = (sources_manager.code_source_list + podfile_sources).uniq.select do |s|
@@ -272,11 +383,40 @@ module Pod
272
383
  end
273
384
  # UI.message "组装新的 rspec ,替换原 rspec #{rspec.root.name} (#{spec_version}) specification = #{specification} #{rspec} "
274
385
  rescue Pod::StandardError => e
275
- # 没有从新的 source 找到对应版本组件,直接返回原 rspec
386
+ # 没有从新的 source 找到对应版本组件
276
387
  missing_binary_specs << rspec.spec if use_binary
277
- # UI.message "【#{rspec.spec.name} | #{rspec.spec.version}】组件无对应源码版本 , 将采用二进制版本依赖.".red unless use_binary
278
388
  is_exist_binary_version = false
279
- rspec
389
+
390
+ # 关键修复:对于有 commit/tag 指定的组件,二进制不存在时:
391
+ # 1. 将完整的 checkout_options 添加到 sandbox.checkout_sources
392
+ # 2. 修改 spec.source 为正确的 git URL
393
+ # 3. 标记为 predownloaded,让 CocoaPods 使用 external source 下载流程
394
+ # 注意:跳过 mbox activate 激活的本地库(sandbox.local? 返回 true)
395
+ if dependency_source && use_binary && !sandbox.local?(rspec.root.name)
396
+ # 获取完整的 checkout_options(包含 :git 和 :commit/:tag)
397
+ full_checkout_options = PodUpdateConfig.checkout_options[rspec.root.name]
398
+ if full_checkout_options && full_checkout_options[:git]
399
+ # 1. 添加到 sandbox.checkout_sources
400
+ sandbox.store_checkout_source(rspec.root.name, full_checkout_options)
401
+
402
+ # 2. 修改 spec 的 source 属性为正确的 git URL
403
+ # 这样 CocoaPods 在下载时就会使用这个 URL 而不是 podspec 中的 s.source
404
+ new_source = { :git => full_checkout_options[:git] }
405
+ new_source[:commit] = full_checkout_options[:commit] if full_checkout_options[:commit]
406
+ new_source[:tag] = full_checkout_options[:tag] if full_checkout_options[:tag]
407
+ unless rspec.spec.subspec?
408
+ rspec.spec.source = new_source
409
+ end
410
+
411
+
412
+ # 3. 将组件添加到 predownloaded_pods(让 CocoaPods 知道需要从 external source 下载)
413
+ sandbox.store_pre_downloaded_pod(rspec.root.name)
414
+ end
415
+ end
416
+
417
+
418
+
419
+ rspec # 返回原 rspec,保持 external source 信息
280
420
  end
281
421
  # 有对应二进制组件版本才进行替换记录,否则走之前pre-downloading 逻辑
282
422
  if is_exist_binary_version && sandbox.predownloaded?(rspec.root.name) && spec_version.is_a?(String) && spec_version.include?("bin")
@@ -17,6 +17,7 @@ def get_podfile_lock
17
17
  PodUpdateConfig.set_checksum(checksum)
18
18
  #目前只支持MTXX target "MTXX" 项目 想要支持其他项目可以添加对应 target "xxx"
19
19
  content = File.read(Pod::Config.instance.podfile_path)
20
+
20
21
  if content
21
22
  if content.include?("target \"MTXX\"")
22
23
  is_load_podfile_lock = true
@@ -267,6 +268,36 @@ end
267
268
  Pod::HooksManager.register('cocoapods-meitu-bin', :source_provider) do |context, _|
268
269
  sources_manager = Pod::Config.instance.sources_manager
269
270
  podfile = Pod::Config.instance.podfile
271
+
272
+ podfile_path = podfile.defined_in_file
273
+ pods_with_commit = {}
274
+ pods_with_path = 0
275
+ File.readlines(podfile_path).each_with_index do |line, index|
276
+ # 去除行首空白后检查是否为注释行
277
+ trimmed_line = line.lstrip
278
+ next if trimmed_line.start_with?('#')
279
+
280
+ if line.include?(':commit =>')
281
+ # 提取 pod 名称
282
+ if line =~ /pod\s+['"]([^'"]+)['"]/
283
+ pod_name = $1
284
+ # 提取 commit hash
285
+ if line =~ /:commit\s*=>\s*['"]([^'"]+)['"]/
286
+ commit_hash = $1
287
+ pods_with_commit[pod_name] = { commit: commit_hash }
288
+ end
289
+ end
290
+ elsif line.include?(':path =>')
291
+ pods_with_path = pods_with_path + 1
292
+ end
293
+ end
294
+ # 解决多个组件切换从二进制切换到源码受podfile.lock 缓存影响导致切换异常的问题
295
+ if pods_with_path > 2
296
+ PodUpdateConfig.set_is_podfile_lock_nil(true)
297
+ end
298
+
299
+ PodUpdateConfig.set_pods_with_commit(pods_with_commit)
300
+
270
301
  if podfile
271
302
  # 读取配置文件
272
303
  config_file = File.join(Pod::Config.instance.project_root, 'BinConfig.yaml')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-meitu-bin
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jensen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-10-31 00:00:00.000000000 Z
11
+ date: 2026-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: cocoapods-generate
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 2.0.1
47
+ version: 2.2.3
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 2.0.1
54
+ version: 2.2.3
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement