cocoapods-podgenerate 0.1.4 → 0.1.6
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6a09245ceccdb3fe6baffa21e46a91047d662665a06b346f10d35d75827ca0b0
|
|
4
|
+
data.tar.gz: 2603e1fee43466df12136ebc901d89bb628df735bf54973a1986551caf96b1a9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ce1f86d080ddd862e6b94a0cc80fdff37a7bc3f5820c1241ff947fb819d0ce4d600b2af138b4b1de3c3024a7ffbebd270eef72f086052e70ea98ff82033a2510
|
|
7
|
+
data.tar.gz: 12a5c333eea428c31f8dfcca12a18bc548701708ac37f8c1e245ad3848cdfbf6fa789144b37bd7d5009e583a8d7041ffad4da4fe8792e8ae684af25c68c3d7a9
|
|
@@ -242,23 +242,28 @@ module Pod
|
|
|
242
242
|
# @param cache_key [String] 缓存键,写入文件头部供下次 load 验证
|
|
243
243
|
# @param result [Hash{TargetDefinition => Array<Specification>}] Molinillo 解析结果
|
|
244
244
|
def save_cached_result(cache_key, result)
|
|
245
|
-
|
|
245
|
+
begin
|
|
246
|
+
path = cache_path
|
|
246
247
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
248
|
+
# 提取纯数据:从 Specification 对象中只取名称和版本号
|
|
249
|
+
# 使用 respond_to? 安全检查确保 result 是预期的格式
|
|
250
|
+
targets_data = {}
|
|
251
|
+
if result.respond_to?(:each)
|
|
252
|
+
result.each do |target_def, specs|
|
|
253
|
+
next unless specs.respond_to?(:map)
|
|
254
|
+
pod_list = specs.map do |spec|
|
|
255
|
+
next unless spec.respond_to?(:root) && spec.root.respond_to?(:name) &&
|
|
256
|
+
spec.respond_to?(:version)
|
|
257
|
+
{
|
|
258
|
+
'pod_name' => spec.root.name,
|
|
259
|
+
'version' => spec.version.to_s,
|
|
260
|
+
}
|
|
261
|
+
end.compact
|
|
262
|
+
pod_list.uniq! { |entry| entry['pod_name'] }
|
|
263
|
+
target_name = target_def.respond_to?(:name) ? target_def.name : target_def.to_s
|
|
264
|
+
targets_data[target_name] = pod_list unless pod_list.empty?
|
|
265
|
+
end
|
|
257
266
|
end
|
|
258
|
-
# 去重:同一个 pod 的多个 subspec 共享相同的 root.name
|
|
259
|
-
pod_list.uniq! { |entry| entry['pod_name'] }
|
|
260
|
-
targets_data[target_def.name] = pod_list unless pod_list.empty?
|
|
261
|
-
end
|
|
262
267
|
|
|
263
268
|
# 组装缓存数据
|
|
264
269
|
data = {
|
|
@@ -269,14 +274,13 @@ module Pod
|
|
|
269
274
|
'targets' => targets_data,
|
|
270
275
|
}
|
|
271
276
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
Pod::UI.warn "[cocoapods-podgenerate] 保存解析缓存失败: #{e.message}"
|
|
277
|
+
# 原子写入:先写临时文件,成功后再 rename
|
|
278
|
+
tmp_path = "#{path}.tmp"
|
|
279
|
+
File.write(tmp_path, YAML.dump(data))
|
|
280
|
+
File.rename(tmp_path, path)
|
|
281
|
+
rescue StandardError => e
|
|
282
|
+
Pod::UI.warn "[cocoapods-podgenerate] 保存解析缓存失败: #{e.message}"
|
|
283
|
+
end
|
|
280
284
|
end
|
|
281
285
|
end
|
|
282
286
|
end
|
|
@@ -22,7 +22,10 @@
|
|
|
22
22
|
# v0.1.4 修复:
|
|
23
23
|
# - C2: 快速跳过路径设置缺失的 @pods_project/@pod_target_subprojects/@generated_projects
|
|
24
24
|
# 并确保 run_podfile_post_install_hooks 被调用(即使在跳过路径上)
|
|
25
|
-
# - H1:
|
|
25
|
+
# - H1: 跳过路径不再调用 update_project_cache(@target_installation_results 在跳过路径
|
|
26
|
+
# 上始终为 nil,回退到空 InstallationResults 会清除 metadata_cache 导致下次全量重建)
|
|
27
|
+
# - L3: parallel_configure_schemes 用 defined?(Concurrent::FixedThreadPool) 替代
|
|
28
|
+
# 宽泛的 rescue NameError(NameError 可能吞掉无关的未定义常量/变量错误)
|
|
26
29
|
# - M1: wait_for_termination 使用 ThreadPool::DEFAULT_TIMEOUT
|
|
27
30
|
# - M3: integrate_targets 改用 Concurrent::FixedThreadPool(限制并发数,避免 200 线程)
|
|
28
31
|
#
|
|
@@ -104,10 +107,13 @@ module Pod
|
|
|
104
107
|
# 清理沙盒中残留的文件
|
|
105
108
|
Pod::Installer::SandboxDirCleaner.new(sandbox, pod_targets, aggregate_targets).clean!
|
|
106
109
|
|
|
107
|
-
# H1 修复:
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
# H1 修复: 当没有目标需要生成时,跳过 update_project_cache 调用
|
|
111
|
+
# @target_installation_results 仅在 create_and_save_projects 内设置,
|
|
112
|
+
# 在跳过路径上始终为 nil,回退到空 InstallationResults.new({}, {})
|
|
113
|
+
# 会导致 metadata_cache 中所有 pod target 的安装结果被清除,
|
|
114
|
+
# 下次运行时触发全量重建(cache 损坏)。
|
|
115
|
+
# 跳过路径的正确行为:不更新任何缓存,因为没有任何变化,
|
|
116
|
+
# 已有的缓存状态仍然有效。
|
|
111
117
|
return
|
|
112
118
|
end
|
|
113
119
|
|
|
@@ -183,35 +189,36 @@ module Pod
|
|
|
183
189
|
# 每个 scheme 文件是独立的 .xcscheme,存储在不同 xcodeproj 的
|
|
184
190
|
# xcuserdata 目录中。每个 project 完全独立 → 无锁并行。
|
|
185
191
|
#
|
|
186
|
-
# v0.1.4:
|
|
192
|
+
# v0.1.4 修复 (L3): 使用 defined? 检查代替 rescue NameError
|
|
193
|
+
# rescue NameError 过于宽泛(捕获所有未定义常量/变量/方法错误),
|
|
194
|
+
# 可能吞掉与 Concurrent::FixedThreadPool 无关的错误。
|
|
195
|
+
# defined? 精确检查 Concurrent::FixedThreadPool 类定义是否存在。
|
|
187
196
|
def parallel_configure_schemes(projects_by_pod_targets, generator, generation_result)
|
|
188
197
|
pool_size = [[Etc.nprocessors - 1, 2].max, 16].min
|
|
189
198
|
Pod::UI.message "- Configuring schemes across #{projects_by_pod_targets.size} projects (pool: #{pool_size})"
|
|
190
199
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
nil # concurrent-ruby 不可用,回退到串行
|
|
195
|
-
end
|
|
196
|
-
|
|
197
|
-
if pool
|
|
200
|
+
# L3 修复: defined? 精确检查类可用性,替代 rescue NameError
|
|
201
|
+
unless defined?(Concurrent::FixedThreadPool)
|
|
202
|
+
# 回退到顺序执行(concurrent-ruby 中的 FixedThreadPool 不可用)
|
|
198
203
|
projects_by_pod_targets.each do |project, pts|
|
|
199
|
-
|
|
200
|
-
generator.configure_schemes(project, pts, generation_result)
|
|
201
|
-
rescue StandardError => e
|
|
202
|
-
Pod::UI.warn "[cocoapods-podgenerate] Scheme configuration error: #{e.message}"
|
|
203
|
-
end
|
|
204
|
-
end
|
|
205
|
-
pool.shutdown
|
|
206
|
-
unless pool.wait_for_termination(Pod::PodGenerate::Parallel::ThreadPool::DEFAULT_TIMEOUT)
|
|
207
|
-
Pod::UI.warn '[cocoapods-podgenerate] Scheme configuration timed out'
|
|
208
|
-
pool.kill
|
|
204
|
+
generator.configure_schemes(project, pts, generation_result)
|
|
209
205
|
end
|
|
210
|
-
|
|
211
|
-
|
|
206
|
+
return
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
pool = Concurrent::FixedThreadPool.new(pool_size)
|
|
210
|
+
projects_by_pod_targets.each do |project, pts|
|
|
211
|
+
pool.post do
|
|
212
212
|
generator.configure_schemes(project, pts, generation_result)
|
|
213
|
+
rescue StandardError => e
|
|
214
|
+
Pod::UI.warn "[cocoapods-podgenerate] Scheme configuration error: #{e.message}"
|
|
213
215
|
end
|
|
214
216
|
end
|
|
217
|
+
pool.shutdown
|
|
218
|
+
unless pool.wait_for_termination(Pod::PodGenerate::Parallel::ThreadPool::DEFAULT_TIMEOUT)
|
|
219
|
+
Pod::UI.warn '[cocoapods-podgenerate] Scheme configuration timed out'
|
|
220
|
+
pool.kill
|
|
221
|
+
end
|
|
215
222
|
end
|
|
216
223
|
end
|
|
217
224
|
|