cocoapods-binary-matchup 0.0.20 → 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: 35204da82186a57c4ba756a412e4bf54cad82323cf41cec9f94571de706913d9
4
- data.tar.gz: 8370ce7b81ab1899146fdd7db8ce840ff4fad7c38b03995bdcc99fd8c30fddaa
3
+ metadata.gz: e70059ee19350023d191c3c6b833fec2bfe758f315fe1ae8fdb9fbb36f9f432c
4
+ data.tar.gz: 31381921a52f4f5536cc038a62dca528a3be92b75d206a5d0adf57fa4ddbcace
5
5
  SHA512:
6
- metadata.gz: '000708c3be09ad3aab5096bf9e427b50d1e2c6d6aa38d1d61c355390b550748a2fb9d961f7e13061a38fe6fcbf07f2ed26352bdedd605346838b6c411eff4d56'
7
- data.tar.gz: 6ff11604344cff43cd68cb381aa4bda9d2054a1d6fdfd0140f8216896147c07a989d6db7b4772a23894ff90602574561fc1436f0c1463ebb54203cc96f38bcc8
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,30 +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
+ class_attr_accessor :main_deployment_target_name
7
8
 
8
9
  module PrebuildCache
9
10
 
10
11
  class Cache
11
12
 
13
+ # 类变量用于跟踪依赖关系和失效的pod
14
+ @@dependency_graph = {}
15
+
12
16
  # 获取缓存根目录
13
17
  def self.cache_root_dir
14
- cache_dir = File.expand_path("~/.PodCache/#{Pod.min_deployment_target}")
15
- UI.puts "🔍 cache_root_dir #{cache_dir}"
18
+ cache_dir = File.expand_path("~/.PodCache/#{Pod.main_deployment_target_name}")
16
19
  FileUtils.mkdir_p(cache_dir) unless Dir.exist?(cache_dir)
17
20
  cache_dir
18
21
  end
19
22
 
23
+ # 获取manifest.lock缓存路径
24
+ def self.cached_manifest_path
25
+ File.join(cache_root_dir, 'Manifest.lock')
26
+ end
27
+
20
28
  # 获取特定pod的缓存目录
21
- def self.cache_dir_for_pod(pod_name, version)
22
- 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)
23
31
  end
24
32
 
25
33
  # 获取pod的版本信息,优先使用commit hash
26
34
  def self.get_pod_version(sandbox, pod_name)
27
35
  UI.puts "🔍 starting get pod version: #{pod_name}"
36
+ UI.puts "🔍 get_pod_version sandbox: #{sandbox.manifest_path}"
28
37
  checkout_options = sandbox.manifest.checkout_options_for_pod_named(pod_name)
29
38
  # 优先使用checkout_options中的检出来源
30
39
  if checkout_options
@@ -74,90 +83,24 @@ module Pod
74
83
  return "unknown"
75
84
  end
76
85
 
77
- # 计算目录内容的哈希值(用于验证缓存完整性)
78
- def self.calculate_dir_hash(dir_path)
79
- return nil unless Dir.exist?(dir_path)
80
-
81
- files = Dir.glob("#{dir_path}/**/*", File::FNM_DOTMATCH).select { |f| File.file?(f) }
82
- files.sort!
83
-
84
- hasher = Digest::SHA256.new
85
- files.each do |file|
86
- # 添加文件路径和修改时间到哈希计算中
87
- relative_path = file.sub("#{dir_path}/", "")
88
- hasher.update(relative_path)
89
- hasher.update(File.mtime(file).to_s)
90
- end
91
-
92
- hasher.hexdigest
93
- end
94
-
95
86
  # 检查缓存是否存在
96
- def self.cache_exists?(pod_name, version)
97
- Pod::UI.puts "🔍 cache_exists? #{pod_name} #{version}"
98
- 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}"
99
90
  Dir.exist?(cache_dir) && !Dir.empty?(cache_dir)
100
91
  end
101
92
 
102
- # 检查缓存是否存在且有效(用于验证完整性)
103
- def self.cache_valid?(pod_name, version, source_dir = nil)
104
- cache_dir = cache_dir_for_pod(pod_name, version)
105
- return false unless Dir.exist?(cache_dir)
106
-
107
- # 如果没有提供源目录,只检查缓存是否存在
108
- return true if source_dir.nil?
109
-
110
- # 检查缓存的哈希文件
111
- hash_file = File.join(cache_dir, '.cache_hash')
112
- return false unless File.exist?(hash_file)
113
-
114
- begin
115
- cached_hash = File.read(hash_file).strip
116
- current_hash = calculate_dir_hash(source_dir)
117
-
118
- return cached_hash == current_hash
119
- rescue => e
120
- Pod::UI.puts "⚠️ Warning: Cannot validate cache for #{pod_name}: #{e.message}"
121
- return false
122
- end
123
- end
124
-
125
- # 从缓存恢复pod
126
- def self.restore_from_cache(pod_name, version, target_dir)
127
- cache_dir = cache_dir_for_pod(pod_name, version)
128
-
129
- return false unless Dir.exist?(cache_dir)
130
-
131
- begin
132
- # 删除目标目录
133
- FileUtils.rm_rf(target_dir) if Dir.exist?(target_dir)
134
-
135
- # 从缓存拷贝到目标目录
136
- FileUtils.cp_r(cache_dir, target_dir, :remove_destination => true)
137
-
138
- # 删除缓存标记文件
139
- hash_file = File.join(target_dir, '.cache_hash')
140
- File.delete(hash_file) if File.exist?(hash_file)
141
-
142
- Pod::UI.puts "📦 Restored #{pod_name} (#{version}) from cache"
143
- return true
144
- rescue => e
145
- Pod::UI.puts "❌ Failed to restore #{pod_name} from cache: #{e.message}"
146
- return false
147
- end
148
- end
149
-
150
93
  # 保存到缓存(如果缓存不存在的话)
151
- def self.save_to_cache(pod_name, version, source_dir)
94
+ def self.save_to_cache(pod_name, source_dir)
152
95
  return unless Dir.exist?(source_dir)
153
96
 
154
97
  # 检查缓存是否已经存在,如果存在则不覆盖
155
- if cache_exists?(pod_name, version)
156
- 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"
157
100
  return true
158
101
  end
159
102
 
160
- cache_dir = cache_dir_for_pod(pod_name, version)
103
+ cache_dir = cache_dir_for_pod(pod_name)
161
104
 
162
105
  begin
163
106
  # 创建缓存目录
@@ -168,13 +111,6 @@ module Pod
168
111
 
169
112
  # 拷贝到缓存
170
113
  FileUtils.cp_r(source_dir, cache_dir, :remove_destination => true)
171
-
172
- # 保存哈希值
173
- source_hash = calculate_dir_hash(source_dir)
174
- hash_file = File.join(cache_dir, '.cache_hash')
175
- File.write(hash_file, source_hash)
176
-
177
- Pod::UI.puts "💾 Saved #{pod_name} (#{version}) to cache"
178
114
  return true
179
115
  rescue => e
180
116
  Pod::UI.puts "❌ Failed to save #{pod_name} to cache: #{e.message}"
@@ -182,138 +118,200 @@ module Pod
182
118
  end
183
119
  end
184
120
 
185
- # 尝试从缓存拷贝到目标目录(如果缓存存在)
186
- def self.copy_from_cache_if_exists(pod_name, version, target_dir)
187
- return false unless cache_exists?(pod_name, version)
188
-
189
- cache_dir = cache_dir_for_pod(pod_name, version)
190
-
121
+ # 保存当前manifest.lock到缓存目录
122
+ def self.save_manifest_to_cache(sandbox)
191
123
  begin
192
- # 删除目标目录
193
- FileUtils.rm_rf(target_dir) if Dir.exist?(target_dir)
194
-
195
- # 从缓存拷贝到目标目录
196
- FileUtils.cp_r(cache_dir, target_dir, :remove_destination => true)
197
-
198
- # 删除缓存标记文件
199
- hash_file = File.join(target_dir, '.cache_hash')
200
- File.delete(hash_file) if File.exist?(hash_file)
201
-
202
- Pod::UI.puts "📦 Copied #{pod_name} (#{version}) from cache"
203
- 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
204
136
  rescue => e
205
- 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}"
206
138
  return false
207
139
  end
208
140
  end
209
141
 
210
- # 清理过期缓存(可选功能)
211
- def self.clean_expired_cache(days = 30)
212
- return unless Dir.exist?(cache_root_dir)
213
-
214
- cutoff_time = Time.now - (days * 24 * 60 * 60)
215
- cleaned_count = 0
216
-
217
- Dir.glob("#{cache_root_dir}/*/*").each do |cache_dir|
218
- next unless Dir.exist?(cache_dir)
142
+ # 清空所有缓存
143
+ def self.clear_all_caches
144
+ begin
145
+ cache_dir = cache_root_dir
219
146
 
220
- if File.mtime(cache_dir) < cutoff_time
221
- begin
222
- FileUtils.rm_rf(cache_dir)
223
- cleaned_count += 1
224
- Pod::UI.puts "🗑️ Cleaned expired cache: #{File.basename(File.dirname(cache_dir))}/#{File.basename(cache_dir)}"
225
- rescue => e
226
- 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)}"
227
154
  end
228
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}"
229
161
  end
230
-
231
- Pod::UI.puts "✅ Cleaned #{cleaned_count} expired cache entries" if cleaned_count > 0
232
162
  end
233
163
 
234
- # 获取缓存统计信息
235
- def self.cache_stats
236
- return {} unless Dir.exist?(cache_root_dir)
237
-
238
- stats = {
239
- total_pods: 0,
240
- total_versions: 0,
241
- total_size: 0
242
- }
243
-
244
- Dir.glob("#{cache_root_dir}/*").each do |pod_dir|
245
- 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
246
173
 
247
- stats[:total_pods] += 1
174
+ # 创建基于缓存manifest的临时sandbox来获取缓存版本
175
+ cached_version = get_cached_pod_version(pod_name, cached_manifest_path)
248
176
 
249
- Dir.glob("#{pod_dir}/*").each do |version_dir|
250
- next unless Dir.exist?(version_dir)
251
-
252
- stats[:total_versions] += 1
253
-
254
- # 计算目录大小
255
- size = `du -sk "#{version_dir}" 2>/dev/null`.split.first.to_i * 1024
256
- 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
257
183
  end
184
+
185
+ rescue => e
186
+ Pod::UI.puts "⚠️ Error validating version consistency for #{pod_name}: #{e.message}"
187
+ return false
258
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?
259
223
 
260
- 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
261
238
  end
262
239
 
263
- # 打印缓存统计信息
264
- def self.print_cache_stats
265
- stats = cache_stats
266
- if stats[:total_pods] > 0
267
- size_mb = (stats[:total_size] / 1024.0 / 1024.0).round(2)
268
- Pod::UI.puts "📊 Cache Stats: #{stats[:total_pods]} pods, #{stats[:total_versions]} versions, #{size_mb} MB"
269
- else
270
- 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}"
271
247
  end
272
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
273
280
 
274
- # 从 ~/.PodCache 恢复缓存到 _prebuild 目录
281
+ # 从 ~/.PodCache 恢复缓存到 _prebuild 目录(版本感知版)
275
282
  def self.restore_from_pod_cache(pod_name, prebuild_sandbox)
276
283
  begin
277
- Pod::UI.puts "🔍 Checking cache for #{pod_name} #{prebuild_sandbox}"
278
-
279
- restored_count = 0
280
- missing_pods = []
284
+ Pod::UI.puts "🔍 Checking cache for #{pod_name}"
281
285
 
282
286
  # 获取pod版本信息
283
287
  pod_version = get_pod_version(prebuild_sandbox, pod_name)
284
288
 
285
289
  # 检查缓存是否存在
286
- if cache_exists?(pod_name, pod_version)
287
- # 从缓存复制到_prebuild目录
288
- cache_dir = cache_dir_for_pod(pod_name, pod_version)
289
- target_dir = prebuild_sandbox.framework_folder_path_for_pod_name(pod_name)
290
-
291
- # 确保目标目录存在
292
- target_dir.parent.mkpath unless target_dir.parent.exist?
293
-
294
- # 复制缓存到_prebuild
295
- FileUtils.cp_r(cache_dir, target_dir, :remove_destination => true)
296
-
297
- # 删除缓存标记文件
298
- hash_file = target_dir + '.cache_hash'
299
- hash_file.delete if hash_file.exist?
300
-
301
- Pod::UI.puts "📦 Restored #{pod_name} (#{pod_version}) from cache"
302
- restored_count += 1
303
- else
304
- missing_pods << pod_name
305
- end
306
-
307
- if missing_pods.empty?
308
- Pod::UI.puts "✅ Successfully restored all #{restored_count} pods from cache"
309
- return true
310
- else
311
- 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}"
312
292
  return false
313
293
  end
314
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
+
315
312
  rescue => e
316
313
  Pod::UI.puts "❌ Error restoring from cache: #{e.message}"
314
+ # 出错时也标记为失效
317
315
  return false
318
316
  end
319
317
  end
@@ -100,14 +100,12 @@ 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
- Pod::UI.puts "📱 Project iOS Version: #{project_ios_version.version}"
108
- Pod.min_deployment_target = project_ios_version.version
109
- end
110
103
 
104
+ main_target = installer_context.podfile.target_definition_list[1]
105
+ if main_target.platform
106
+ Pod::UI.puts "📱 Project Main Target name: #{main_target.name}"
107
+ Pod.main_deployment_target_name = main_target.name
108
+ end
111
109
 
112
110
  # -- step 1: prebuild framework ---
113
111
  # Execute a sperated pod install, to generate targets for building framework,
@@ -274,7 +272,6 @@ def scan_framework_resources(framework_dir, pod_name)
274
272
  framework_name = framework_dir.basename.to_s
275
273
 
276
274
  Pod::UI.puts " 🎯 Framework path: #{framework_dir}"
277
- Pod::UI.puts " 🎯 Pod name: #{pod_name}, Framework name: #{framework_name}"
278
275
 
279
276
  # 资源文件类型
280
277
  resource_patterns = [
@@ -296,28 +293,23 @@ def scan_framework_resources(framework_dir, pod_name)
296
293
  # 例如:${PODS_ROOT}/CocoaDebug/CocoaDebug.framework/App.storyboardc
297
294
  resource_entry = "${PODS_ROOT}/#{pod_name}/#{framework_name}/#{resource_file.basename}"
298
295
  resources << resource_entry
299
- Pod::UI.puts " 📄 Found: #{resource_file.basename} -> #{resource_entry}"
300
296
  end
301
297
  end
302
298
 
303
299
  # 扫描framework/Resources目录
304
300
  resources_dir = framework_dir + 'Resources'
305
301
  if resources_dir.exist?
306
- Pod::UI.puts " 📁 Scanning Resources subdirectory"
307
302
  resource_patterns.each do |pattern|
308
303
  Dir.glob(resources_dir + pattern).each do |resource_path|
309
304
  resource_file = Pathname(resource_path)
310
305
 
311
306
  # Resources目录中的资源也使用BUILT_PRODUCTS_DIR路径
312
307
  resource_entry = "${PODS_ROOT}/#{pod_name}/#{framework_name}/#{resource_file.basename}"
313
- resources << resource_entry
314
-
315
- Pod::UI.puts " 📄 Found in Resources/: #{resource_file.basename} -> #{resource_entry}"
308
+ resources << resource_entry
316
309
  end
317
310
  end
318
311
  end
319
312
 
320
- Pod::UI.puts " 📊 Total resources found: #{resources.count}"
321
313
  resources
322
314
  end
323
315
 
@@ -328,15 +320,15 @@ def modify_resources_script(script_path, framework_resources)
328
320
  original_content = script_path.read
329
321
 
330
322
  # 检查是否已经添加过framework资源(避免重复)
331
- if original_content.include?('# Prebuilt Framework Resources')
332
- Pod::UI.puts " ℹ️ Framework resources already added, skipping"
333
- return
334
- end
335
-
336
- Pod::UI.puts " 📝 Adding #{framework_resources.count} framework resources to script"
337
- framework_resources.each_with_index do |resource, index|
338
- Pod::UI.puts " #{index + 1}. #{resource}"
339
- 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
340
332
 
341
333
  # 构建要添加的资源安装代码
342
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.20"
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.20
4
+ version: 0.0.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - leavez