cocoapods-podgenerate 0.1.12 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cocoapods-podgenerate/patches/installer_patch.rb +103 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8339033a347400214385a8528759a3ca70fbe8d739579566bab631277f89e82c
|
|
4
|
+
data.tar.gz: aef46f6fbac5628e104b628efa2b4d37f3fd9e9a0e2eccaf9d30208b884c4837
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 26608721fe59f715e12457f268d45d8d9ccc375758d38c4e5fd4e9c0b678e8e09c3339f7ebf22deba6fe86d1ae5f5598d46d7400af58f78a0dfbaf8a4d3f1e27
|
|
7
|
+
data.tar.gz: 7a931fa7d0dc2613c35efffd823b76a0f6cabb53aef0b3834e9e9c6c4b2a4450528c960795cd1255e8380c0c2c6687ad34920ae06ab82d740e465a73ea6dc6d4
|
|
@@ -91,6 +91,23 @@ module Pod
|
|
|
91
91
|
ptg = cache_analysis_result.pod_targets_to_generate
|
|
92
92
|
atg = cache_analysis_result.aggregate_targets_to_generate
|
|
93
93
|
|
|
94
|
+
# ── 本地开发 pod 文件级变更检测 ──
|
|
95
|
+
# CocoaPods 的 TargetCacheKey 使用 spec attributes_hash(如
|
|
96
|
+
# source_files 的 glob 模式字符串)做哈希,不检查 glob 展开后的
|
|
97
|
+
# 实际文件列表。当本地开发 pod(:path)中源文件有增删时,
|
|
98
|
+
# glob 模式不变 → cache key 不变 → ptg 为空 → "No changes" 跳过。
|
|
99
|
+
# 解决方法:为每个开发 pod 计算当前源文件列表的 SHA256,
|
|
100
|
+
# 与上次运行的清单比较,有差异时强制加入 ptg。
|
|
101
|
+
if ptg.empty? && (atg.nil? || atg.empty?)
|
|
102
|
+
unless sandbox.development_pods.empty?
|
|
103
|
+
dev_changed = detect_dev_pod_file_changes
|
|
104
|
+
unless dev_changed.empty?
|
|
105
|
+
Pod::UI.puts "[cocoapods-podgenerate] Dev pod files changed: #{dev_changed.map(&:pod_name).join(', ')} — forcing regeneration"
|
|
106
|
+
ptg = dev_changed
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
94
111
|
if ptg.empty? && (atg.nil? || atg.empty?)
|
|
95
112
|
Pod::UI.puts "[cocoapods-podgenerate] No changes — skipping project generation"
|
|
96
113
|
|
|
@@ -301,6 +318,92 @@ module Pod
|
|
|
301
318
|
pool.kill
|
|
302
319
|
end
|
|
303
320
|
end
|
|
321
|
+
|
|
322
|
+
# ── 本地开发 pod 文件级变更检测 ──
|
|
323
|
+
#
|
|
324
|
+
# CocoaPods 的 TargetCacheKey 使用 pod_target.root_spec.attributes_hash
|
|
325
|
+
# 作为缓存键的一部分。attributes_hash 中包含 source_files 等 glob 模式
|
|
326
|
+
# 字符串(如 "lib/**/*.rb"),而不是实际展开后的文件列表。
|
|
327
|
+
# 当本地开发 pod 的源文件在文件系统层面发生增删时,glob 模式不变,
|
|
328
|
+
# 缓存键也就不会变化,导致 "No changes — skipping project generation"
|
|
329
|
+
# 漏掉文件级变更。
|
|
330
|
+
#
|
|
331
|
+
# 解决方法:为每个开发 pod 维护一个 SHA256 清单文件,记录其 source_files
|
|
332
|
+
# glob 展开后的实际文件列表的哈希值。每次 pod install 时重新计算并比较。
|
|
333
|
+
# 清单存储在 Pods/.cocoapods-podgenerate-devpod-manifest.yaml 中。
|
|
334
|
+
DEV_POD_FILE_MANIFEST = '.cocoapods-podgenerate-devpod-manifest.yaml'
|
|
335
|
+
|
|
336
|
+
# 检测开发 pod 中源文件是否有增删
|
|
337
|
+
# 返回需要重新生成的 PodTarget 数组
|
|
338
|
+
def detect_dev_pod_file_changes
|
|
339
|
+
dev_pods = sandbox.development_pods
|
|
340
|
+
return [] if dev_pods.empty?
|
|
341
|
+
|
|
342
|
+
manifest_path = File.join(sandbox.root.to_s, DEV_POD_FILE_MANIFEST)
|
|
343
|
+
|
|
344
|
+
# 读取上次记录的 hash 值
|
|
345
|
+
previous = {}
|
|
346
|
+
if File.exist?(manifest_path)
|
|
347
|
+
begin
|
|
348
|
+
data = YAML.safe_load(File.read(manifest_path))
|
|
349
|
+
previous = data if data.is_a?(Hash)
|
|
350
|
+
rescue => e
|
|
351
|
+
Pod::UI.warn "[cocoapods-podgenerate] Failed to read dev pod manifest: #{e.message}"
|
|
352
|
+
end
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
current = {}
|
|
356
|
+
changed = []
|
|
357
|
+
|
|
358
|
+
pod_targets.each do |pt|
|
|
359
|
+
name = pt.pod_name
|
|
360
|
+
next unless dev_pods.key?(name)
|
|
361
|
+
|
|
362
|
+
current[name] = compute_dev_pod_file_digest(pt)
|
|
363
|
+
if previous[name] != current[name]
|
|
364
|
+
changed << pt
|
|
365
|
+
end
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
# 持久化当前清单
|
|
369
|
+
begin
|
|
370
|
+
File.write(manifest_path, YAML.dump(current))
|
|
371
|
+
rescue => e
|
|
372
|
+
Pod::UI.warn "[cocoapods-podgenerate] Failed to write dev pod manifest: #{e.message}"
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
changed
|
|
376
|
+
end
|
|
377
|
+
|
|
378
|
+
# 计算开发 pod 当前源文件列表的 SHA256
|
|
379
|
+
# 使用 podspec 中的 source_files/headers glob 模式,
|
|
380
|
+
# 在文件系统层面展开后对相对路径排序做哈希。
|
|
381
|
+
# @return [String] 十六进制 SHA256(空文件列表则是空字符串哈希)
|
|
382
|
+
def compute_dev_pod_file_digest(pod_target)
|
|
383
|
+
pod_name = pod_target.pod_name
|
|
384
|
+
pod_dir = sandbox.pod_dir(pod_name)
|
|
385
|
+
return '' unless pod_dir && File.directory?(pod_dir)
|
|
386
|
+
|
|
387
|
+
pod_dir_str = pod_dir.to_s
|
|
388
|
+
files = []
|
|
389
|
+
|
|
390
|
+
pod_target.spec_consumers.each do |consumer|
|
|
391
|
+
patterns = []
|
|
392
|
+
patterns.concat(Array(consumer.source_files))
|
|
393
|
+
patterns.concat(Array(consumer.public_header_files))
|
|
394
|
+
patterns.concat(Array(consumer.private_header_files))
|
|
395
|
+
|
|
396
|
+
patterns.each do |pattern|
|
|
397
|
+
full_pattern = File.join(pod_dir_str, pattern)
|
|
398
|
+
Dir.glob(full_pattern).each do |f|
|
|
399
|
+
next unless File.file?(f)
|
|
400
|
+
files << f.sub("#{pod_dir_str}/", '')
|
|
401
|
+
end
|
|
402
|
+
end
|
|
403
|
+
end
|
|
404
|
+
|
|
405
|
+
Digest::SHA256.hexdigest(files.uniq.sort.join("\n"))
|
|
406
|
+
end
|
|
304
407
|
end
|
|
305
408
|
|
|
306
409
|
# ── 优化 3: 并行化 PodTargetIntegrator(修复 M3)──
|