cocoapods-binary-matchup 0.0.22 → 0.0.23

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: 29a67f3c826a3e9a9484ea9134684416586890c98fd713e4400cab569680f01a
4
- data.tar.gz: be4047206d31ad740cf2816c7064a07b887b5ea056e42bf5244ca9fe83689d6d
3
+ metadata.gz: e70059ee19350023d191c3c6b833fec2bfe758f315fe1ae8fdb9fbb36f9f432c
4
+ data.tar.gz: 31381921a52f4f5536cc038a62dca528a3be92b75d206a5d0adf57fa4ddbcace
5
5
  SHA512:
6
- metadata.gz: 1504f6e56481955e29340bb99dfc7591e62bff64d326d0bd143372be3d0b72d000c18fdd12c33cb17f6c6b45f492f03a9160bcd86a8979fa2420fb7b7ccbef87
7
- data.tar.gz: ebe50d9c83c98873308675bd654fd5b314c26c7196dab582c59b2a8c40c218d9bdb11edfeb780f98c3331b2a906296e3c19501d830321d27fb97685d536c22b3
6
+ metadata.gz: 536812421e0dca76d05933986a8bcbfacb6818802ef53260b71f92b26aed70fd7c63cf2e859f6b82182acae15203097d2b37a378bd61d0759401ac7ecff04ed0
7
+ data.tar.gz: 26fbbac5e85b034bd10ef19bf26c7ab65c8232b86837c20733764e2d121a86c2e9eb491a2856c33fee1ff5d43398f150c7ade3002d3d7cffaf6a9a67bfafb0fb
@@ -29,7 +29,6 @@ module Pod
29
29
  # 获取pod版本信息
30
30
  prebuild_sandbox = Pod::PrebuildSandbox.from_standard_sandbox(standard_sanbox)
31
31
 
32
- pod_version = Pod::PrebuildCache::Cache.get_pod_version(prebuild_sandbox, self.name)
33
32
  target_folder = standard_sanbox.pod_dir(self.name)
34
33
  target_folder.rmtree if target_folder.exist?
35
34
 
@@ -41,7 +40,7 @@ module Pod
41
40
  UI.puts "📦 Copied prebuilt files for #{self.name}: #{real_file_folder} -> #{target_folder}"
42
41
 
43
42
  # 3. 同时保存到缓存(如果缓存不存在)
44
- Pod::PrebuildCache::Cache.save_to_cache(self.name, pod_version, target_folder.to_s)
43
+ Pod::PrebuildCache::Cache.save_to_cache(self.name, target_folder.to_s)
45
44
  else
46
45
  UI.puts "⚠️ Warning: Prebuilt files not found for #{self.name} at #{real_file_folder}"
47
46
  # 如果预构建文件不存在,创建空目录避免错误
@@ -1,32 +1,39 @@
1
1
  require 'fileutils'
2
2
  require 'digest'
3
+ require 'set'
3
4
 
4
5
  module Pod
5
6
 
6
- class_attr_accessor :min_deployment_target
7
-
8
7
  class_attr_accessor :main_deployment_target_name
9
8
 
10
9
  module PrebuildCache
11
10
 
12
11
  class Cache
13
12
 
13
+ # 类变量用于跟踪依赖关系和失效的pod
14
+ @@dependency_graph = {}
15
+
14
16
  # 获取缓存根目录
15
17
  def self.cache_root_dir
16
- cache_dir = File.expand_path("~/.PodCache/#{Pod.min_deployment_target}-#{Pod.main_deployment_target_name}")
17
- UI.puts "🔍 cache_root_dir #{cache_dir}"
18
+ cache_dir = File.expand_path("~/.PodCache/#{Pod.main_deployment_target_name}")
18
19
  FileUtils.mkdir_p(cache_dir) unless Dir.exist?(cache_dir)
19
20
  cache_dir
20
21
  end
21
22
 
23
+ # 获取manifest.lock缓存路径
24
+ def self.cached_manifest_path
25
+ File.join(cache_root_dir, 'Manifest.lock')
26
+ end
27
+
22
28
  # 获取特定pod的缓存目录
23
- def self.cache_dir_for_pod(pod_name, version)
24
- File.join(cache_root_dir, pod_name, version)
29
+ def self.cache_dir_for_pod(pod_name)
30
+ File.join(cache_root_dir, pod_name)
25
31
  end
26
32
 
27
33
  # 获取pod的版本信息,优先使用commit hash
28
34
  def self.get_pod_version(sandbox, pod_name)
29
35
  UI.puts "🔍 starting get pod version: #{pod_name}"
36
+ UI.puts "🔍 get_pod_version sandbox: #{sandbox.manifest_path}"
30
37
  checkout_options = sandbox.manifest.checkout_options_for_pod_named(pod_name)
31
38
  # 优先使用checkout_options中的检出来源
32
39
  if checkout_options
@@ -76,90 +83,24 @@ module Pod
76
83
  return "unknown"
77
84
  end
78
85
 
79
- # 计算目录内容的哈希值(用于验证缓存完整性)
80
- def self.calculate_dir_hash(dir_path)
81
- return nil unless Dir.exist?(dir_path)
82
-
83
- files = Dir.glob("#{dir_path}/**/*", File::FNM_DOTMATCH).select { |f| File.file?(f) }
84
- files.sort!
85
-
86
- hasher = Digest::SHA256.new
87
- files.each do |file|
88
- # 添加文件路径和修改时间到哈希计算中
89
- relative_path = file.sub("#{dir_path}/", "")
90
- hasher.update(relative_path)
91
- hasher.update(File.mtime(file).to_s)
92
- end
93
-
94
- hasher.hexdigest
95
- end
96
-
97
86
  # 检查缓存是否存在
98
- def self.cache_exists?(pod_name, version)
99
- Pod::UI.puts "🔍 cache_exists? #{pod_name} #{version}"
100
- cache_dir = cache_dir_for_pod(pod_name, version)
87
+ def self.cache_exists?(pod_name)
88
+ cache_dir = cache_dir_for_pod(pod_name)
89
+ Pod::UI.puts "🔍 cache_exists? #{cache_dir}"
101
90
  Dir.exist?(cache_dir) && !Dir.empty?(cache_dir)
102
91
  end
103
92
 
104
- # 检查缓存是否存在且有效(用于验证完整性)
105
- def self.cache_valid?(pod_name, version, source_dir = nil)
106
- cache_dir = cache_dir_for_pod(pod_name, version)
107
- return false unless Dir.exist?(cache_dir)
108
-
109
- # 如果没有提供源目录,只检查缓存是否存在
110
- return true if source_dir.nil?
111
-
112
- # 检查缓存的哈希文件
113
- hash_file = File.join(cache_dir, '.cache_hash')
114
- return false unless File.exist?(hash_file)
115
-
116
- begin
117
- cached_hash = File.read(hash_file).strip
118
- current_hash = calculate_dir_hash(source_dir)
119
-
120
- return cached_hash == current_hash
121
- rescue => e
122
- Pod::UI.puts "⚠️ Warning: Cannot validate cache for #{pod_name}: #{e.message}"
123
- return false
124
- end
125
- end
126
-
127
- # 从缓存恢复pod
128
- def self.restore_from_cache(pod_name, version, target_dir)
129
- cache_dir = cache_dir_for_pod(pod_name, version)
130
-
131
- return false unless Dir.exist?(cache_dir)
132
-
133
- begin
134
- # 删除目标目录
135
- FileUtils.rm_rf(target_dir) if Dir.exist?(target_dir)
136
-
137
- # 从缓存拷贝到目标目录
138
- FileUtils.cp_r(cache_dir, target_dir, :remove_destination => true)
139
-
140
- # 删除缓存标记文件
141
- hash_file = File.join(target_dir, '.cache_hash')
142
- File.delete(hash_file) if File.exist?(hash_file)
143
-
144
- Pod::UI.puts "📦 Restored #{pod_name} (#{version}) from cache"
145
- return true
146
- rescue => e
147
- Pod::UI.puts "❌ Failed to restore #{pod_name} from cache: #{e.message}"
148
- return false
149
- end
150
- end
151
-
152
93
  # 保存到缓存(如果缓存不存在的话)
153
- def self.save_to_cache(pod_name, version, source_dir)
94
+ def self.save_to_cache(pod_name, source_dir)
154
95
  return unless Dir.exist?(source_dir)
155
96
 
156
97
  # 检查缓存是否已经存在,如果存在则不覆盖
157
- if cache_exists?(pod_name, version)
158
- Pod::UI.puts "📦 Cache already exists for #{pod_name} (#{version}), skipping save"
98
+ if cache_exists?(pod_name)
99
+ Pod::UI.puts "📦 Cache already exists for #{pod_name}, skipping save"
159
100
  return true
160
101
  end
161
102
 
162
- cache_dir = cache_dir_for_pod(pod_name, version)
103
+ cache_dir = cache_dir_for_pod(pod_name)
163
104
 
164
105
  begin
165
106
  # 创建缓存目录
@@ -170,13 +111,6 @@ module Pod
170
111
 
171
112
  # 拷贝到缓存
172
113
  FileUtils.cp_r(source_dir, cache_dir, :remove_destination => true)
173
-
174
- # 保存哈希值
175
- source_hash = calculate_dir_hash(source_dir)
176
- hash_file = File.join(cache_dir, '.cache_hash')
177
- File.write(hash_file, source_hash)
178
-
179
- Pod::UI.puts "💾 Saved #{pod_name} (#{version}) to cache"
180
114
  return true
181
115
  rescue => e
182
116
  Pod::UI.puts "❌ Failed to save #{pod_name} to cache: #{e.message}"
@@ -184,138 +118,200 @@ module Pod
184
118
  end
185
119
  end
186
120
 
187
- # 尝试从缓存拷贝到目标目录(如果缓存存在)
188
- def self.copy_from_cache_if_exists(pod_name, version, target_dir)
189
- return false unless cache_exists?(pod_name, version)
190
-
191
- cache_dir = cache_dir_for_pod(pod_name, version)
192
-
121
+ # 保存当前manifest.lock到缓存目录
122
+ def self.save_manifest_to_cache(sandbox)
193
123
  begin
194
- # 删除目标目录
195
- FileUtils.rm_rf(target_dir) if Dir.exist?(target_dir)
196
-
197
- # 从缓存拷贝到目标目录
198
- FileUtils.cp_r(cache_dir, target_dir, :remove_destination => true)
199
-
200
- # 删除缓存标记文件
201
- hash_file = File.join(target_dir, '.cache_hash')
202
- File.delete(hash_file) if File.exist?(hash_file)
203
-
204
- Pod::UI.puts "📦 Copied #{pod_name} (#{version}) from cache"
205
- return true
124
+ # 查找_Prebuild目录中的manifest.lock
125
+ prebuild_manifest = sandbox.root + 'Manifest.lock'
126
+ # 如果存在,复制到缓存目录
127
+ if prebuild_manifest.exist?
128
+ cached_path = cached_manifest_path
129
+ FileUtils.cp(prebuild_manifest, cached_path)
130
+ Pod::UI.puts "💾 save_manifest_to_cache Manifest.lock to cache: #{cached_path}"
131
+ return true
132
+ else
133
+ Pod::UI.puts "⚠️ save_manifest_to_cache Manifest.lock not found in _Prebuild directory"
134
+ return false
135
+ end
206
136
  rescue => e
207
- Pod::UI.puts "❌ Failed to copy #{pod_name} from cache: #{e.message}"
137
+ Pod::UI.puts "❌ save_manifest_to_cache save Manifest.lock to cache failed: #{e.message}"
208
138
  return false
209
139
  end
210
140
  end
211
141
 
212
- # 清理过期缓存(可选功能)
213
- def self.clean_expired_cache(days = 30)
214
- return unless Dir.exist?(cache_root_dir)
215
-
216
- cutoff_time = Time.now - (days * 24 * 60 * 60)
217
- cleaned_count = 0
218
-
219
- Dir.glob("#{cache_root_dir}/*/*").each do |cache_dir|
220
- next unless Dir.exist?(cache_dir)
142
+ # 清空所有缓存
143
+ def self.clear_all_caches
144
+ begin
145
+ cache_dir = cache_root_dir
221
146
 
222
- if File.mtime(cache_dir) < cutoff_time
223
- begin
224
- FileUtils.rm_rf(cache_dir)
225
- cleaned_count += 1
226
- Pod::UI.puts "🗑️ Cleaned expired cache: #{File.basename(File.dirname(cache_dir))}/#{File.basename(cache_dir)}"
227
- rescue => e
228
- Pod::UI.puts " Failed to clean cache #{cache_dir}: #{e.message}"
147
+ # 删除除了cached_manifest.lock之外的所有缓存
148
+ Dir.glob("#{cache_dir}/*").each do |path|
149
+ next if File.basename(path) == 'Manifest.lock'
150
+
151
+ if Dir.exist?(path)
152
+ FileUtils.rm_rf(path)
153
+ Pod::UI.puts "🗑️ Cleared cache directory: #{File.basename(path)}"
229
154
  end
230
155
  end
156
+
157
+ Pod::UI.puts "✅ All pod caches cleared due to dependency changes"
158
+
159
+ rescue => e
160
+ Pod::UI.puts "❌ Error clearing caches: #{e.message}"
231
161
  end
232
-
233
- Pod::UI.puts "✅ Cleaned #{cleaned_count} expired cache entries" if cleaned_count > 0
234
162
  end
235
163
 
236
- # 获取缓存统计信息
237
- def self.cache_stats
238
- return {} unless Dir.exist?(cache_root_dir)
239
-
240
- stats = {
241
- total_pods: 0,
242
- total_versions: 0,
243
- total_size: 0
244
- }
245
-
246
- Dir.glob("#{cache_root_dir}/*").each do |pod_dir|
247
- next unless Dir.exist?(pod_dir)
164
+ # 验证pod版本一致性(与缓存时的manifest对比)
165
+ def self.validate_pod_version_consistency(pod_name, current_version)
166
+ begin
167
+ manifest_path = cached_manifest_path
168
+ Pod::UI.puts "🔍 validate_pod_version_consistency pod_name: #{pod_name} manifest_path: #{manifest_path}"
169
+ # 如果没有缓存的manifest,认为一致(首次构建)
170
+ unless File.exist?(manifest_path)
171
+ return true
172
+ end
248
173
 
249
- stats[:total_pods] += 1
174
+ # 创建基于缓存manifest的临时sandbox来获取缓存版本
175
+ cached_version = get_cached_pod_version(pod_name, cached_manifest_path)
250
176
 
251
- Dir.glob("#{pod_dir}/*").each do |version_dir|
252
- next unless Dir.exist?(version_dir)
253
-
254
- stats[:total_versions] += 1
255
-
256
- # 计算目录大小
257
- size = `du -sk "#{version_dir}" 2>/dev/null`.split.first.to_i * 1024
258
- stats[:total_size] += size
177
+ # 对比版本
178
+ if current_version == cached_version
179
+ return true
180
+ else
181
+ Pod::UI.puts "🔄 #{pod_name} version changed: #{cached_version} → #{current_version}"
182
+ return false
259
183
  end
184
+
185
+ rescue => e
186
+ Pod::UI.puts "⚠️ Error validating version consistency for #{pod_name}: #{e.message}"
187
+ return false
260
188
  end
189
+ end
190
+
191
+ # 从缓存的manifest中获取pod版本(复用get_pod_version的逻辑)
192
+ def self.get_cached_pod_version(pod_name, cached_manifest_path)
193
+ begin
194
+ # 使用缓存目录作为根目录创建PrebuildSandbox
195
+ # 因为Manifest.lock就在cache_root_dir下,可以直接使用
196
+ cache_dir = File.dirname(cached_manifest_path)
197
+ temp_sandbox = Pod::PrebuildSandbox.new(cache_dir)
198
+
199
+ # 复用现有的get_pod_version逻辑
200
+ return get_pod_version(temp_sandbox, pod_name)
201
+
202
+ rescue => e
203
+ Pod::UI.puts "⚠️ Error reading cached version for #{pod_name}: #{e.message}"
204
+ return "unknown"
205
+ end
206
+ end
207
+
208
+ # 获取指定target的反向依赖(哪些targets依赖于它)
209
+ def self.find_reverse_dependencies(target_to_find, all_pod_targets)
210
+ reverse_deps = all_pod_targets.select do |pod_target|
211
+ # 跳过自己
212
+ next false if pod_target.pod_name == target_to_find.pod_name
213
+ # 检查当前pod_target的正向递归依赖中是否包含目标target
214
+ pod_target.recursive_dependent_targets.include?(target_to_find)
215
+ end
216
+
217
+ reverse_deps.map { |item| item.pod_name }
218
+ end
219
+
220
+ # 构建简单的依赖关系图(从targets获取)
221
+ def self.build_simple_dependency_graph(target, total_targets)
222
+ return if total_targets.nil? || total_targets.empty?
261
223
 
262
- stats
224
+ Pod::UI.puts "🔍 Building reverse dependency graph for cache validation..."
225
+ begin
226
+ pod_name = target.pod_name
227
+ @@dependency_graph[pod_name] = []
228
+ dependencies = []
229
+ temp_dependencies = find_reverse_dependencies(target, total_targets)
230
+ if !temp_dependencies.nil?
231
+ dependencies = temp_dependencies
232
+ end
233
+
234
+ @@dependency_graph[pod_name] = dependencies
235
+ rescue => e
236
+ Pod::UI.puts "⚠️ Warning: Error processing target #{target}: #{e.message}"
237
+ end
263
238
  end
264
239
 
265
- # 打印缓存统计信息
266
- def self.print_cache_stats
267
- stats = cache_stats
268
- if stats[:total_pods] > 0
269
- size_mb = (stats[:total_size] / 1024.0 / 1024.0).round(2)
270
- Pod::UI.puts "📊 Cache Stats: #{stats[:total_pods]} pods, #{stats[:total_versions]} versions, #{size_mb} MB"
271
- else
272
- Pod::UI.puts "📊 Cache is empty"
240
+ # 删除pod的缓存
241
+ def self.invalidate_pod_cache(pod_name)
242
+ cache_dir = cache_dir_for_pod(pod_name)
243
+ Pod::UI.puts "🗑️ start Removed invalid cache for #{pod_name}"
244
+ if Dir.exist?(cache_dir)
245
+ FileUtils.rm_rf(cache_dir)
246
+ Pod::UI.puts "🗑️ end Removed invalid cache for #{pod_name}"
273
247
  end
274
248
  end
249
+
250
+ def self.remove_all_invalid_cache(sandbox, all_targets)
251
+ all_targets.each do |target|
252
+ build_simple_dependency_graph(target, all_targets)
253
+ current_version = get_pod_version(sandbox, target.pod_name)
254
+ if validate_pod_version_consistency(target.pod_name, current_version)
255
+ Pod::UI.puts "🔍 validate_pod_version_consistency #{target.pod_name} #{current_version}"
256
+ else
257
+ cascade_invalidate_dependents(target.pod_name)
258
+ Pod::UI.puts "❌ validate_pod_version_consistency #{target.pod_name} #{current_version}"
259
+ end
260
+ end
261
+ Pod::UI.puts "📊 Dependency graph: #{@@dependency_graph}"
262
+ end
263
+
264
+ # 级联失效依赖当前pod的其他pod
265
+ def self.cascade_invalidate_dependents(invalidated_pod)
266
+ # 查找所有依赖invalidated_pod的pod
267
+ dependenciess = @@dependency_graph[invalidated_pod]
268
+ return if dependenciess.nil? || !dependenciess.any?
269
+
270
+ dependenciess.each do |dependent_pod|
271
+ invalidate_pod_cache(dependent_pod)
272
+ end
273
+ end
274
+
275
+ # 重置依赖验证状态并检查manifest一致性
276
+ def self.reset_dependency_validation(sandbox = nil)
277
+ @@dependency_graph.clear
278
+ Pod::UI.puts "🔄 Reset dependency validation state"
279
+ end
275
280
 
276
- # 从 ~/.PodCache 恢复缓存到 _prebuild 目录
281
+ # 从 ~/.PodCache 恢复缓存到 _prebuild 目录(版本感知版)
277
282
  def self.restore_from_pod_cache(pod_name, prebuild_sandbox)
278
283
  begin
279
- Pod::UI.puts "🔍 Checking cache for #{pod_name} #{prebuild_sandbox}"
280
-
281
- restored_count = 0
282
- missing_pods = []
284
+ Pod::UI.puts "🔍 Checking cache for #{pod_name}"
283
285
 
284
286
  # 获取pod版本信息
285
287
  pod_version = get_pod_version(prebuild_sandbox, pod_name)
286
288
 
287
289
  # 检查缓存是否存在
288
- if cache_exists?(pod_name, pod_version)
289
- # 从缓存复制到_prebuild目录
290
- cache_dir = cache_dir_for_pod(pod_name, pod_version)
291
- target_dir = prebuild_sandbox.framework_folder_path_for_pod_name(pod_name)
292
-
293
- # 确保目标目录存在
294
- target_dir.parent.mkpath unless target_dir.parent.exist?
295
-
296
- # 复制缓存到_prebuild
297
- FileUtils.cp_r(cache_dir, target_dir, :remove_destination => true)
298
-
299
- # 删除缓存标记文件
300
- hash_file = target_dir + '.cache_hash'
301
- hash_file.delete if hash_file.exist?
302
-
303
- Pod::UI.puts "📦 Restored #{pod_name} (#{pod_version}) from cache"
304
- restored_count += 1
305
- else
306
- missing_pods << pod_name
307
- end
308
-
309
- if missing_pods.empty?
310
- Pod::UI.puts "✅ Successfully restored all #{restored_count} pods from cache"
311
- return true
312
- else
313
- Pod::UI.puts "⚠️ Missing cache for #{missing_pods.count} pods: #{missing_pods.join(', ')}"
290
+ unless cache_exists?(pod_name)
291
+ Pod::UI.puts "⚠️ No cache found for #{pod_name}"
314
292
  return false
315
293
  end
316
294
 
295
+ # 所有验证通过,从缓存恢复
296
+ cache_dir = cache_dir_for_pod(pod_name)
297
+ target_dir = prebuild_sandbox.framework_folder_path_for_pod_name(pod_name)
298
+
299
+ # 确保目标目录存在
300
+ target_dir.parent.mkpath unless target_dir.parent.exist?
301
+
302
+ # 复制缓存到_prebuild
303
+ FileUtils.cp_r(cache_dir, target_dir, :remove_destination => true)
304
+
305
+ # 删除缓存标记文件
306
+ hash_file = target_dir + '.cache_hash'
307
+ hash_file.delete if hash_file.exist?
308
+
309
+ Pod::UI.puts "📦 Successfully restored #{pod_name} (#{pod_version}) from cache"
310
+ return true
311
+
317
312
  rescue => e
318
313
  Pod::UI.puts "❌ Error restoring from cache: #{e.message}"
314
+ # 出错时也标记为失效
319
315
  return false
320
316
  end
321
317
  end
@@ -100,14 +100,6 @@ Pod::HooksManager.register('cocoapods-binary-matchup', :pre_install) do |install
100
100
  exit
101
101
  end
102
102
  end
103
-
104
- root_target = installer_context.podfile.target_definition_list.first
105
- if root_target.platform
106
- project_ios_version = root_target.platform.deployment_target
107
- target_name = root_target
108
- Pod::UI.puts "📱 Project iOS Version: #{project_ios_version.version}, name: #{target_name}"
109
- Pod.min_deployment_target = project_ios_version.version
110
- end
111
103
 
112
104
  main_target = installer_context.podfile.target_definition_list[1]
113
105
  if main_target.platform
@@ -280,7 +272,6 @@ def scan_framework_resources(framework_dir, pod_name)
280
272
  framework_name = framework_dir.basename.to_s
281
273
 
282
274
  Pod::UI.puts " 🎯 Framework path: #{framework_dir}"
283
- Pod::UI.puts " 🎯 Pod name: #{pod_name}, Framework name: #{framework_name}"
284
275
 
285
276
  # 资源文件类型
286
277
  resource_patterns = [
@@ -302,28 +293,23 @@ def scan_framework_resources(framework_dir, pod_name)
302
293
  # 例如:${PODS_ROOT}/CocoaDebug/CocoaDebug.framework/App.storyboardc
303
294
  resource_entry = "${PODS_ROOT}/#{pod_name}/#{framework_name}/#{resource_file.basename}"
304
295
  resources << resource_entry
305
- Pod::UI.puts " 📄 Found: #{resource_file.basename} -> #{resource_entry}"
306
296
  end
307
297
  end
308
298
 
309
299
  # 扫描framework/Resources目录
310
300
  resources_dir = framework_dir + 'Resources'
311
301
  if resources_dir.exist?
312
- Pod::UI.puts " 📁 Scanning Resources subdirectory"
313
302
  resource_patterns.each do |pattern|
314
303
  Dir.glob(resources_dir + pattern).each do |resource_path|
315
304
  resource_file = Pathname(resource_path)
316
305
 
317
306
  # Resources目录中的资源也使用BUILT_PRODUCTS_DIR路径
318
307
  resource_entry = "${PODS_ROOT}/#{pod_name}/#{framework_name}/#{resource_file.basename}"
319
- resources << resource_entry
320
-
321
- Pod::UI.puts " 📄 Found in Resources/: #{resource_file.basename} -> #{resource_entry}"
308
+ resources << resource_entry
322
309
  end
323
310
  end
324
311
  end
325
312
 
326
- Pod::UI.puts " 📊 Total resources found: #{resources.count}"
327
313
  resources
328
314
  end
329
315
 
@@ -334,15 +320,15 @@ def modify_resources_script(script_path, framework_resources)
334
320
  original_content = script_path.read
335
321
 
336
322
  # 检查是否已经添加过framework资源(避免重复)
337
- if original_content.include?('# Prebuilt Framework Resources')
338
- Pod::UI.puts " ℹ️ Framework resources already added, skipping"
339
- return
340
- end
341
-
342
- Pod::UI.puts " 📝 Adding #{framework_resources.count} framework resources to script"
343
- framework_resources.each_with_index do |resource, index|
344
- Pod::UI.puts " #{index + 1}. #{resource}"
345
- end
323
+ # if original_content.include?('# Prebuilt Framework Resources')
324
+ # Pod::UI.puts " ℹ️ Framework resources already added, skipping"
325
+ # return
326
+ # end
327
+
328
+ # Pod::UI.puts " 📝 Adding #{framework_resources.count} framework resources to script"
329
+ # framework_resources.each_with_index do |resource, index|
330
+ # Pod::UI.puts " #{index + 1}. #{resource}"
331
+ # end
346
332
 
347
333
  # 构建要添加的资源安装代码
348
334
  framework_resources_block = build_framework_resources_block(framework_resources)
@@ -99,7 +99,6 @@ module Pod
99
99
  not exsited_framework_names.include?(pod_name)
100
100
  end
101
101
 
102
-
103
102
  root_names_to_update = (added + changed + missing)
104
103
 
105
104
  # transform names to targets
@@ -122,7 +121,8 @@ module Pod
122
121
 
123
122
  targets = targets.reject {|pod_target| sandbox.local?(pod_target.pod_name) }
124
123
 
125
-
124
+ Pod::PrebuildCache::Cache.remove_all_invalid_cache(sandbox, targets)
125
+
126
126
  # build!
127
127
  Pod::UI.puts "Prebuild frameworks (total #{targets.count})"
128
128
  Pod::Prebuild.remove_build_dir(sandbox_path)
@@ -203,6 +203,9 @@ module Pod
203
203
  end
204
204
  end
205
205
  end
206
+
207
+ # save the manifest.lock to cache
208
+ Pod::PrebuildCache::Cache.save_manifest_to_cache(sandbox)
206
209
 
207
210
  # Remove useless files
208
211
  # remove useless pods
@@ -1,3 +1,3 @@
1
1
  module CocoapodsBinary
2
- VERSION = "0.0.22"
2
+ VERSION = "0.0.23"
3
3
  end
@@ -227,6 +227,7 @@ def xcodebuild(sandbox, target, sdk='macosx', deployment_target=nil, other_optio
227
227
  is_succeed = (exit_code == 0)
228
228
 
229
229
  if !is_succeed
230
+ Pod::UI.puts "❌ Build failed for target #{target} (exit code: #{exit_code})".red
230
231
  begin
231
232
  if log.include?('** BUILD FAILED **')
232
233
  # use xcpretty to print build log
@@ -241,6 +242,8 @@ def xcodebuild(sandbox, target, sdk='macosx', deployment_target=nil, other_optio
241
242
  rescue
242
243
  puts log.red
243
244
  end
245
+ Pod::UI.puts "💥 Compilation terminated due to build failure. Please check the error messages above.".red
246
+ exit 1
244
247
  end
245
248
  [is_succeed, log]
246
249
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-binary-matchup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.22
4
+ version: 0.0.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - leavez