cocoapods-binary-matchup 0.0.27 → 0.0.29

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: 78793c741a6a34286a3218fccb88e27c9a90353694c603ea38fecf548dc14ece
4
- data.tar.gz: 3c23ec57b14ebc590c3804abcc299b06be47bb3101bc3395dffe85932cbe854c
3
+ metadata.gz: ab869750d66f2c06adb0360e3161f97100a4d52a4a3061e4823cfc4625a43081
4
+ data.tar.gz: 6713416c0a38d48fca05c72c5b9059725efe662963fc11482ebb74a2c582577b
5
5
  SHA512:
6
- metadata.gz: f6318ba2e323ab8c7747c1a49edaff6816d22615a951ea202a402af2c42e09a8bd90bf09685c5061d67f90119712f01cc769b496fe462221156ec5281a75f137
7
- data.tar.gz: 58d8c1ba281ac40cc2714948d0e0beca44e3a82d0ca4a93e02b5c659cd6170937a59d6c4009cb3322f62b61ee04628023d41a1ad417ae9af1ebac12da012bbce
6
+ metadata.gz: 88ccf73373ccbce3eb8026bf6ece983ff0f70633884713a022a1edb7f842d4a75a821edf2e02bba33b24f015e1f2030aa37d04b512ef99244d8941f68da4d6db
7
+ data.tar.gz: 56f3efa320ecff52e8f4be474d4312ffeaecccd4204a4de4f6842ca5829cdfb8cc0eddd91d2d8c0a4e999488aa559f5d986264505baadd42c12a6be11ca76674
@@ -13,14 +13,19 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = 'https://github.com/omiapp/cocoapod_binary_matchup'
14
14
  spec.license = 'MIT'
15
15
 
16
- spec.files = `git ls-files`.split($/).reject{|f| f.start_with?("test/") || f.start_with?('demo/')}
16
+ # 不要用 git ls-files:子目录嵌套 .git / 路径前缀会导致打出空包(0.0.28 踩过坑)
17
+ spec.files = Dir.chdir(__dir__) do
18
+ Dir.glob('{lib,spec}/**/*').reject { |f| File.directory?(f) } +
19
+ Dir.glob('{LICENSE*,README*,*.gemspec,Gemfile,Rakefile}')
20
+ end
17
21
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
22
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
23
  spec.require_paths = ['lib']
20
24
 
21
25
  spec.add_dependency "cocoapods", ">= 1.5.0", "< 2.0"
22
26
  spec.add_dependency "fourflusher", "~> 2.0"
23
- spec.add_dependency "xcpretty", "~> 0.4.1"
27
+ # CI/Fastlane 可能仍锁 xcpretty 0.3.x,放宽避免插件激活失败导致 all_binary! 未定义
28
+ spec.add_dependency "xcpretty", ">= 0.3.0", "< 1.0"
24
29
 
25
30
  spec.add_development_dependency 'bundler', '~> 2.6.9'
26
31
  spec.add_development_dependency 'rake'
@@ -219,6 +219,8 @@ Pod::HooksManager.register('cocoapods-binary-matchup', :post_install) do |instal
219
219
 
220
220
  # 收集预编译framework的资源
221
221
  framework_resources = collect_prebuilt_framework_resources(installer, aggregate_target)
222
+ # 仅扩展 .bin(嵌套路径),不改动原有资源注入逻辑
223
+ bin_resources = collect_prebuilt_framework_bin_resources(installer, aggregate_target)
222
224
 
223
225
  if framework_resources.any?
224
226
  # 修改资源脚本
@@ -227,6 +229,11 @@ Pod::HooksManager.register('cocoapods-binary-matchup', :post_install) do |instal
227
229
  else
228
230
  Pod::UI.puts " ℹ️ No framework resources found for #{aggregate_target.name}"
229
231
  end
232
+
233
+ if bin_resources.any?
234
+ append_bin_resources_script(script_path, bin_resources)
235
+ Pod::UI.puts " ✅ Added #{bin_resources.count} bin resource(s) to #{script_path.basename}"
236
+ end
230
237
  end
231
238
 
232
239
  Pod::UI.puts "✅ Framework resources processing completed"
@@ -266,6 +273,32 @@ def collect_prebuilt_framework_resources(installer, aggregate_target)
266
273
  framework_resources.uniq
267
274
  end
268
275
 
276
+ # 仅收集 framework 内 .bin(支持 m/m.bin 嵌套)
277
+ def collect_prebuilt_framework_bin_resources(installer, aggregate_target)
278
+ bin_resources = []
279
+ prebuilt_pod_names = installer.refresh_prebuild_pod_names!
280
+
281
+ aggregate_target.pod_targets.each do |pod_target|
282
+ next unless prebuilt_pod_names.include?(pod_target.pod_name)
283
+
284
+ pod_dir = installer.sandbox.pod_dir(pod_target.pod_name)
285
+ next unless pod_dir.exist?
286
+
287
+ pod_dir.children.select { |c| c.directory? && c.extname == '.framework' }.each do |framework_dir|
288
+ framework_name = framework_dir.basename.to_s
289
+ Dir.glob(framework_dir.join('**/*.bin')).each do |bin_path|
290
+ rel = Pathname(bin_path).relative_path_from(framework_dir).to_s
291
+ bin_resources << {
292
+ source: "${PODS_ROOT}/#{pod_target.pod_name}/#{framework_name}/#{rel}",
293
+ relative: rel
294
+ }
295
+ end
296
+ end
297
+ end
298
+
299
+ bin_resources.uniq { |r| r[:source] }
300
+ end
301
+
269
302
  # 扫描framework中的资源文件
270
303
  def scan_framework_resources(framework_dir, pod_name)
271
304
  resources = []
@@ -273,7 +306,7 @@ def scan_framework_resources(framework_dir, pod_name)
273
306
 
274
307
  Pod::UI.puts " 🎯 Framework path: #{framework_dir}"
275
308
 
276
- # 资源文件类型
309
+ # 资源文件类型(.bin 由 append_bin_resources_script 单独处理,避免平铺路径错误)
277
310
  resource_patterns = [
278
311
  '*.png', '*.jpg', '*.jpeg', '*.gif', '*.webp', # 图片
279
312
  '*.storyboard', '*.xib', # 界面文件
@@ -282,7 +315,6 @@ def scan_framework_resources(framework_dir, pod_name)
282
315
  '*.bundle', # 资源包
283
316
  '*.ttf', '*.otf', # 字体
284
317
  '*.mp3', '*.wav', '*.m4a', '*.mp4', '*.mov', # 媒体
285
- '*.bin', # 二进制资源
286
318
  '*.metallib' # metal or opengl文件
287
319
  ]
288
320
 
@@ -384,3 +416,33 @@ def build_framework_resources_block(framework_resources)
384
416
 
385
417
  return block
386
418
  end
419
+
420
+ # 仅追加 .bin 安装(保留相对路径;不改动原有 Debug 资源块)
421
+ def append_bin_resources_script(script_path, bin_resources)
422
+ return if bin_resources.empty?
423
+
424
+ content = script_path.read
425
+ content = content.gsub(
426
+ /\n?[ \t]*# Prebuilt Framework Bin Resources\n.*?echo "Prebuilt framework bin resources installation completed"\n/m,
427
+ "\n"
428
+ )
429
+
430
+ block = "# Prebuilt Framework Bin Resources\n"
431
+ block += "echo \"Installing prebuilt framework bin resources...\"\n"
432
+ bin_resources.each do |resource|
433
+ block += "PREBUILT_BIN_SRC=\"#{resource[:source]}\"\n"
434
+ block += "PREBUILT_BIN_DST=\"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/#{resource[:relative]}\"\n"
435
+ block += "mkdir -p \"$(dirname \"$PREBUILT_BIN_DST\")\"\n"
436
+ block += "if [[ -e \"$PREBUILT_BIN_SRC\" ]]; then\n"
437
+ block += " cp -f \"$PREBUILT_BIN_SRC\" \"$PREBUILT_BIN_DST\"\n"
438
+ block += "fi\n"
439
+ end
440
+ block += "echo \"Prebuilt framework bin resources installation completed\"\n"
441
+
442
+ if content.include?('exit 0')
443
+ content = content.sub(/exit 0/, "#{block}\nexit 0")
444
+ else
445
+ content = content + "\n#{block}"
446
+ end
447
+ script_path.write(content)
448
+ end
@@ -1,3 +1,3 @@
1
1
  module CocoapodsBinary
2
- VERSION = "0.0.27"
2
+ VERSION = "0.0.29"
3
3
  end
@@ -172,6 +172,18 @@ def scan_and_copy_resources_flat(source_dir, target_dir)
172
172
  find_and_copy_resources_recursively(source_dir, target_dir, source_dir, resource_extensions, special_directory_extensions)
173
173
  end
174
174
 
175
+ # 仅 .bin:Apps/Cocome/Resources/m/m.bin -> m/m.bin
176
+ def bin_relative_path_for_copy(child, source_root_dir)
177
+ rel_parts = child.relative_path_from(source_root_dir).each_filename.to_a
178
+ if (idx = rel_parts.index('Resources')) && idx < rel_parts.length - 1
179
+ return Pathname.new(rel_parts[(idx + 1)..-1].join('/'))
180
+ end
181
+ if rel_parts.length >= 2
182
+ return Pathname.new(rel_parts[-2..-1].join('/'))
183
+ end
184
+ Pathname.new(child.basename)
185
+ end
186
+
175
187
  # 递归查找资源文件并拷贝
176
188
  def find_and_copy_resources_recursively(current_dir, target_dir, source_root_dir, resource_extensions, special_extensions)
177
189
  # 确保所有参数都是Pathname类型
@@ -199,19 +211,28 @@ def find_and_copy_resources_recursively(current_dir, target_dir, source_root_dir
199
211
  else
200
212
  # 检查是否是资源文件
201
213
  if resource_extensions.include?(child.extname.downcase)
202
- Pod::UI.puts " 📄 Copying resource file: #{child.basename}"
203
- target_path = target_dir + child.basename
204
-
205
- # 处理文件名冲突(如果有重名文件,添加路径前缀)
206
- if target_path.exist?
207
- # 计算相对于根目录的路径作为前缀
208
- relative_dir = child.dirname.relative_path_from(source_root_dir)
209
- safe_name = "#{relative_dir.to_s.gsub('/', '_')}_#{child.basename}"
210
- target_path = target_dir + safe_name
211
- Pod::UI.puts " ⚠️ File name conflict, renamed to: #{safe_name}"
214
+ # .bin:仅扩展路径保留(m/m.bin),其它资源仍平铺,逻辑不变
215
+ if child.extname.downcase == '.bin'
216
+ relative_path = bin_relative_path_for_copy(child, source_root_dir)
217
+ target_path = target_dir + relative_path
218
+ Pod::UI.puts " 📄 Copying bin resource: #{relative_path}"
219
+ target_path.dirname.mkpath unless target_path.dirname.exist?
220
+ FileUtils.cp(child.to_s, target_path.to_s)
221
+ else
222
+ Pod::UI.puts " 📄 Copying resource file: #{child.basename}"
223
+ target_path = target_dir + child.basename
224
+
225
+ # 处理文件名冲突(如果有重名文件,添加路径前缀)
226
+ if target_path.exist?
227
+ # 计算相对于根目录的路径作为前缀
228
+ relative_dir = child.dirname.relative_path_from(source_root_dir)
229
+ safe_name = "#{relative_dir.to_s.gsub('/', '_')}_#{child.basename}"
230
+ target_path = target_dir + safe_name
231
+ Pod::UI.puts " ⚠️ File name conflict, renamed to: #{safe_name}"
232
+ end
233
+
234
+ FileUtils.cp(child.to_s, target_path.to_s)
212
235
  end
213
-
214
- FileUtils.cp(child.to_s, target_path.to_s)
215
236
  end
216
237
  end
217
238
  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.27
4
+ version: 0.0.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - leavez
@@ -47,16 +47,22 @@ dependencies:
47
47
  name: xcpretty
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  requirements:
50
- - - "~>"
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 0.3.0
53
+ - - "<"
51
54
  - !ruby/object:Gem::Version
52
- version: 0.4.1
55
+ version: '1.0'
53
56
  type: :runtime
54
57
  prerelease: false
55
58
  version_requirements: !ruby/object:Gem::Requirement
56
59
  requirements:
57
- - - "~>"
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 0.3.0
63
+ - - "<"
58
64
  - !ruby/object:Gem::Version
59
- version: 0.4.1
65
+ version: '1.0'
60
66
  - !ruby/object:Gem::Dependency
61
67
  name: bundler
62
68
  requirement: !ruby/object:Gem::Requirement
@@ -93,10 +99,7 @@ executables: []
93
99
  extensions: []
94
100
  extra_rdoc_files: []
95
101
  files:
96
- - ".gitignore"
97
- - ".travis.yml"
98
102
  - Gemfile
99
- - Gemfile.lock
100
103
  - LICENSE.txt
101
104
  - README.md
102
105
  - Rakefile
data/.gitignore DELETED
@@ -1,32 +0,0 @@
1
- .DS_Store
2
- pkg
3
- .idea/
4
-
5
- test/Pods
6
-
7
- ## Various settings
8
- *.pbxuser
9
- !default.pbxuser
10
- *.mode1v3
11
- !default.mode1v3
12
- *.mode2v3
13
- !default.mode2v3
14
- *.perspectivev3
15
- !default.perspectivev3
16
- xcuserdata/
17
-
18
- ## Other
19
- *.moved-aside
20
- *.xccheckout
21
- *.xcscmblueprint
22
-
23
- ### Xcode Patch ###
24
- *.xcodeproj/*
25
- !*.xcodeproj/project.pbxproj
26
- !*.xcodeproj/xcshareddata/
27
- !*.xcworkspace/contents.xcworkspacedata
28
- /*.gcno
29
- test/Binary.xcworkspace/contents.xcworkspacedata
30
- test/Binary.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
31
- test/Podfile
32
- test/Podfile.lock
data/.travis.yml DELETED
@@ -1,23 +0,0 @@
1
- osx_image: xcode9.3
2
- language: objective-c
3
- cache:
4
- - cocoapods
5
- - bundler
6
- before_install:
7
- - gem install cocoapods
8
- script:
9
- - rake install
10
- - cd test
11
- - sh test.sh
12
- - cd ..
13
-
14
- # auto deploy on tagging
15
- # automatically set by `travis setup rubygems`
16
- deploy:
17
- provider: rubygems
18
- api_key:
19
- secure: rubygems_36250bc5acbeefaa1a7985a22146376d17725f0583417826
20
- gem: cocoapods-binary-matchup
21
- on:
22
- tags: true
23
- repo: omiapp/cocoapods-binary-matchup
data/Gemfile.lock DELETED
@@ -1,161 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- cocoapods-binary-matchup (0.0.14)
5
- cocoapods (>= 1.5.0, < 2.0)
6
- fourflusher (~> 2.0)
7
- xcpretty (~> 0.3.0)
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- CFPropertyList (3.0.7)
13
- base64
14
- nkf
15
- rexml
16
- activesupport (7.2.2.1)
17
- base64
18
- benchmark (>= 0.3)
19
- bigdecimal
20
- concurrent-ruby (~> 1.0, >= 1.3.1)
21
- connection_pool (>= 2.2.5)
22
- drb
23
- i18n (>= 1.6, < 2)
24
- logger (>= 1.4.2)
25
- minitest (>= 5.1)
26
- securerandom (>= 0.3)
27
- tzinfo (~> 2.0, >= 2.0.5)
28
- addressable (2.8.7)
29
- public_suffix (>= 2.0.2, < 7.0)
30
- algoliasearch (1.27.5)
31
- httpclient (~> 2.8, >= 2.8.3)
32
- json (>= 1.5.1)
33
- atomos (0.1.3)
34
- bacon (1.2.0)
35
- base64 (0.3.0)
36
- benchmark (0.4.1)
37
- bigdecimal (3.2.2)
38
- claide (1.1.0)
39
- cocoapods (1.16.2)
40
- addressable (~> 2.8)
41
- claide (>= 1.0.2, < 2.0)
42
- cocoapods-core (= 1.16.2)
43
- cocoapods-deintegrate (>= 1.0.3, < 2.0)
44
- cocoapods-downloader (>= 2.1, < 3.0)
45
- cocoapods-plugins (>= 1.0.0, < 2.0)
46
- cocoapods-search (>= 1.0.0, < 2.0)
47
- cocoapods-trunk (>= 1.6.0, < 2.0)
48
- cocoapods-try (>= 1.1.0, < 2.0)
49
- colored2 (~> 3.1)
50
- escape (~> 0.0.4)
51
- fourflusher (>= 2.3.0, < 3.0)
52
- gh_inspector (~> 1.0)
53
- molinillo (~> 0.8.0)
54
- nap (~> 1.0)
55
- ruby-macho (>= 2.3.0, < 3.0)
56
- xcodeproj (>= 1.27.0, < 2.0)
57
- cocoapods-core (1.16.2)
58
- activesupport (>= 5.0, < 8)
59
- addressable (~> 2.8)
60
- algoliasearch (~> 1.0)
61
- concurrent-ruby (~> 1.1)
62
- fuzzy_match (~> 2.0.4)
63
- nap (~> 1.0)
64
- netrc (~> 0.11)
65
- public_suffix (~> 4.0)
66
- typhoeus (~> 1.0)
67
- cocoapods-deintegrate (1.0.5)
68
- cocoapods-downloader (2.1)
69
- cocoapods-plugins (1.0.0)
70
- nap
71
- cocoapods-search (1.0.1)
72
- cocoapods-trunk (1.6.0)
73
- nap (>= 0.8, < 2.0)
74
- netrc (~> 0.11)
75
- cocoapods-try (1.2.0)
76
- colored2 (3.1.2)
77
- concurrent-ruby (1.3.5)
78
- connection_pool (2.5.3)
79
- drb (2.2.3)
80
- escape (0.0.4)
81
- ethon (0.16.0)
82
- ffi (>= 1.15.0)
83
- ffi (1.17.2)
84
- ffi (1.17.2-aarch64-linux-gnu)
85
- ffi (1.17.2-aarch64-linux-musl)
86
- ffi (1.17.2-arm-linux-gnu)
87
- ffi (1.17.2-arm-linux-musl)
88
- ffi (1.17.2-arm64-darwin)
89
- ffi (1.17.2-x86-linux-gnu)
90
- ffi (1.17.2-x86-linux-musl)
91
- ffi (1.17.2-x86_64-darwin)
92
- ffi (1.17.2-x86_64-linux-gnu)
93
- ffi (1.17.2-x86_64-linux-musl)
94
- fourflusher (2.3.1)
95
- fuzzy_match (2.0.4)
96
- gh_inspector (1.1.3)
97
- httpclient (2.9.0)
98
- mutex_m
99
- i18n (1.14.7)
100
- concurrent-ruby (~> 1.0)
101
- json (2.12.2)
102
- logger (1.7.0)
103
- minitest (5.25.5)
104
- mocha (2.7.1)
105
- ruby2_keywords (>= 0.0.5)
106
- mocha-on-bacon (0.2.3)
107
- mocha (>= 0.13.0)
108
- molinillo (0.8.0)
109
- mutex_m (0.3.0)
110
- nanaimo (0.4.0)
111
- nap (1.1.0)
112
- netrc (0.11.0)
113
- nkf (0.2.0)
114
- prettybacon (0.0.2)
115
- bacon (~> 1.2)
116
- public_suffix (4.0.7)
117
- rake (13.3.0)
118
- rexml (3.4.1)
119
- rouge (2.0.7)
120
- ruby-macho (2.5.1)
121
- ruby2_keywords (0.0.5)
122
- securerandom (0.4.1)
123
- typhoeus (1.4.1)
124
- ethon (>= 0.9.0)
125
- tzinfo (2.0.6)
126
- concurrent-ruby (~> 1.0)
127
- xcodeproj (1.27.0)
128
- CFPropertyList (>= 2.3.3, < 4.0)
129
- atomos (~> 0.1.3)
130
- claide (>= 1.0.2, < 2.0)
131
- colored2 (~> 3.1)
132
- nanaimo (~> 0.4.0)
133
- rexml (>= 3.3.6, < 4.0)
134
- xcpretty (0.3.0)
135
- rouge (~> 2.0.7)
136
-
137
- PLATFORMS
138
- aarch64-linux-gnu
139
- aarch64-linux-musl
140
- arm-linux-gnu
141
- arm-linux-musl
142
- arm64-darwin
143
- ruby
144
- x86-linux-gnu
145
- x86-linux-musl
146
- x86_64-darwin
147
- x86_64-linux-gnu
148
- x86_64-linux-musl
149
-
150
- DEPENDENCIES
151
- bacon
152
- bundler (~> 2.6.9)
153
- cocoapods
154
- cocoapods-binary-matchup!
155
- mocha
156
- mocha-on-bacon
157
- prettybacon
158
- rake
159
-
160
- BUNDLED WITH
161
- 2.6.9