cocoapods-meitu-bin 1.2.2 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7d08ad747354eed564ac808dd84af6cf490739ff1567740fd4f99b636806226
4
- data.tar.gz: 17b14b936e21584f557b8a00d142c14bc0adaff059153595d22e9883bf1d2a9c
3
+ metadata.gz: 10fbbb2a4ad0c86bbae1e71d4c93482c4c41f3f09fb58b57dcf3f2f3a76d8907
4
+ data.tar.gz: fa321bbb4812aa3b48ea7b476df5d16554015d7c0d34b32e71cdcce24590ed79
5
5
  SHA512:
6
- metadata.gz: 2f34ef08407db4f94389575c817b67bafaa5fe64666e8ee78af4c22c27957d71f34a182653a0a7254bc1193aebefd444129c87b189329f12e6ac938a8f9d1ce5
7
- data.tar.gz: 926be1cd89841e7d649f8ccb61fc109ffe84d398fae226973d9550c1fe41824613fcd47d676a27780056869a5a305f6b1569375510605f9ba1ddbb8b33e830c0
6
+ metadata.gz: 41081d2f10314f7d6133608c9caae31a6aab43546199d5ec8759fa56e1f3acddd5068e616344d5543f7215258e5fb0c7907a87eee73dd873f19ce563f64cde6a
7
+ data.tar.gz: d875fa4ca53418bb58477892185cf4dcd4c4f6d7189b96aed8369dfb6b8177a6a6664e85768b1a831072fcc11e428c814ba9bb51352fc74cc6a648d49bb9b08d
@@ -5,6 +5,7 @@ require 'cocoapods-meitu-bin/helpers/buildAll/bin_helper'
5
5
  require 'cocoapods-meitu-bin/config/config'
6
6
  require 'yaml'
7
7
  require 'digest'
8
+ # require 'concurrent'
8
9
 
9
10
  module Pod
10
11
  class Command
@@ -28,6 +29,7 @@ module Pod
28
29
  def self.options
29
30
  [
30
31
  %w[--clean 全部二进制包制作完成后删除编译临时目录],
32
+ %w[--shell-project 是否依赖壳工程编译产物一次编译生成所有组件的编译产物],
31
33
  %w[--clean-single 每制作完一个二进制包就删除该编译临时目录],
32
34
  %w[--repo-update 更新Podfile中指定的repo仓库],
33
35
  %w[--full-build 是否全量打包],
@@ -40,6 +42,7 @@ module Pod
40
42
  @pods = argv.shift_argument
41
43
  @clean = argv.flag?('clean', false)
42
44
  @clean_single = argv.flag?('clean-single', false)
45
+ @shell_project = argv.flag?('shell-project', false)
43
46
  @repo_update = argv.flag?('repo-update', false)
44
47
  @full_build = argv.flag?('full-build', false)
45
48
  @skip_simulator = argv.flag?('skip-simulator', false)
@@ -70,7 +73,11 @@ module Pod
70
73
  # 删除编译产物
71
74
  clean_build_pods
72
75
  # 编译所有pod_targets
73
- results = build_pod_targets
76
+ #根据@shell_project 判断是执行 build_shell_project_pod_targets 还是 build_pod_targets
77
+ if @shell_project
78
+ PodUpdateConfig.set_shell_project
79
+ end
80
+ results = @shell_project ? build_shell_project_pod_targets : build_pod_targets
74
81
  # 执行post_build命令
75
82
  post_build(results)
76
83
  # 删除编译产物
@@ -250,25 +257,25 @@ module Pod
250
257
  end
251
258
  # 构建产物
252
259
  builder = Builder.new(pod_target, @sandbox.checkout_sources, @skip_simulator, @configuration)
253
- # result = builder.build
254
- # fail_pods << pod_target.pod_name unless result
255
- # next unless result
260
+ result = builder.build
261
+ fail_pods << pod_target.pod_name unless result
262
+ next unless result
256
263
  builder.create_binary
257
264
  # 压缩并上传zip
258
265
  zip_helper = ZipFileHelper.new(pod_target, version, builder.product_dir, builder.build_as_framework?, @configuration)
259
266
  result = zip_helper.zip_lib
260
267
  fail_pods << pod_target.pod_name unless result
261
268
  next unless result
262
- # result = zip_helper.upload_zip_lib
263
- # fail_pods << pod_target.pod_name unless result
264
- # next unless result
269
+ result = zip_helper.upload_zip_lib
270
+ fail_pods << pod_target.pod_name unless result
271
+ next unless result
265
272
  # 生成二进制podspec并上传
266
273
  podspec_creator = PodspecUtil.new(pod_target, version, builder.build_as_framework?, @configuration)
267
274
  bin_spec = podspec_creator.create_binary_podspec
268
275
  bin_spec_file = podspec_creator.write_binary_podspec(bin_spec)
269
- # result = podspec_creator.push_binary_podspec(bin_spec_file)
270
- # fail_pods << pod_target.pod_name unless result
271
- # success_pods << pod_target.pod_name if result
276
+ result = podspec_creator.push_binary_podspec(bin_spec_file)
277
+ fail_pods << pod_target.pod_name unless result
278
+ success_pods << pod_target.pod_name if result
272
279
  rescue Pod::StandardError => e
273
280
  UI.info "`#{pod_target}`编译失败,原因:#{e}".red
274
281
  fail_pods << pod_target.pod_name
@@ -292,6 +299,129 @@ module Pod
292
299
  results
293
300
  end
294
301
  end
302
+ # 基于壳工程编译产物进行个组件的zip压缩 上传和对应二进制podspec生成上传
303
+ def build_shell_project_pod_targets
304
+ UI.title "Build all pod targets(#{@full_build ? '全量打包' : '非全量打包'})".green do
305
+ pod_targets = @analyze_result.pod_targets.uniq
306
+ success_pods = []
307
+ fail_pods = []
308
+ local_pods = []
309
+ external_pods = []
310
+ binary_pods = []
311
+ created_pods = []
312
+ # # 指定线程池的大小(例如,这里创建一个拥有 16 个线程的池)
313
+ # pool = Concurrent::ThreadPoolExecutor.new(max_threads: 16)
314
+ # # 创建一个互斥锁
315
+ # mutex = Mutex.new
316
+ pod_targets.map do |pod_target|
317
+ begin
318
+ version = @version_helper.version(pod_target.pod_name, pod_target.root_spec.version.to_s, @analyze_result.specifications, @configuration, podfile.include_dependencies?)
319
+ # 黑名单(不分全量和非全量)
320
+ next if skip_build?(pod_target)
321
+ # 白名单(有白名单,只看白名单,不分全量和非全量)
322
+ next if !@write_list.nil? && !@write_list.empty? && !@write_list.include?(pod_target.pod_name)
323
+ # 本地库
324
+ if @sandbox.local?(pod_target.pod_name)
325
+ local_pods << pod_target.pod_name
326
+ show_skip_tip("#{pod_target.pod_name} 是本地库")
327
+ next
328
+ end
329
+ # 外部源(如 git)
330
+ if @sandbox.checkout_sources[pod_target.pod_name]
331
+ external_pods << pod_target.pod_name
332
+ show_skip_tip("#{pod_target.pod_name} 以external方式引入")
333
+ next
334
+ end
335
+ # 无源码
336
+ if !@sandbox.local?(pod_target.pod_name) && !pod_target.should_build?
337
+ binary_pods << pod_target.pod_name
338
+ show_skip_tip("#{pod_target.pod_name} 无需编译")
339
+ next
340
+ end
341
+ # 非全量编译、不在白名单中且已经有相应的二进制版本
342
+ if has_created_binary?(pod_target.pod_name, version)
343
+ created_pods << pod_target.pod_name
344
+ show_skip_tip("#{pod_target.pod_name}(#{version}) 已经有二进制版本了")
345
+ next
346
+ end
347
+ # # 提交一个任务给线程池
348
+ # pool.post do
349
+ # # 在这里执行你的任务逻辑
350
+ # # 构建产物
351
+ # builder = Builder.new(pod_target, @sandbox.checkout_sources, @skip_simulator, @configuration)
352
+ # # result = builder.build
353
+ # # fail_pods << pod_target.pod_name unless result
354
+ # # next unless result
355
+ # builder.create_binary
356
+ # # 压缩并上传zip
357
+ # zip_helper = ZipFileHelper.new(pod_target, version, builder.product_dir, builder.build_as_framework?, @configuration)
358
+ # result = zip_helper.zip_lib
359
+ # mutex.synchronize do
360
+ # # 在互斥锁的保护下,安全地修改共享资源
361
+ # fail_pods << pod_target.pod_name unless result
362
+ # end
363
+ # next unless result
364
+ # # result = zip_helper.upload_zip_lib
365
+ # # fail_pods << pod_target.pod_name unless result
366
+ # # next unless result
367
+ # # 生成二进制podspec并上传
368
+ # podspec_creator = PodspecUtil.new(pod_target, version, builder.build_as_framework?, @configuration)
369
+ # bin_spec = podspec_creator.create_binary_podspec
370
+ # bin_spec_file = podspec_creator.write_binary_podspec(bin_spec)
371
+ # # result = podspec_creator.push_binary_podspec(bin_spec_file)
372
+ # # fail_pods << pod_target.pod_name unless result
373
+ # mutex.synchronize do
374
+ # # 在互斥锁的保护下,安全地修改共享资源
375
+ # success_pods << pod_target.pod_name if result
376
+ # end
377
+ # end
378
+ # 在这里执行你的任务逻辑
379
+ # 构建产物
380
+ builder = Builder.new(pod_target, @sandbox.checkout_sources, @skip_simulator, @configuration)
381
+ # result = builder.build
382
+ # fail_pods << pod_target.pod_name unless result
383
+ # next unless result
384
+ builder.create_binary
385
+ # 压缩并上传zip
386
+ zip_helper = ZipFileHelper.new(pod_target, version, builder.product_dir, builder.build_as_framework?, @configuration)
387
+ result = zip_helper.zip_lib
388
+ fail_pods << pod_target.pod_name unless result
389
+ next unless result
390
+ result = zip_helper.upload_zip_lib
391
+ fail_pods << pod_target.pod_name unless result
392
+ next unless result
393
+ # 生成二进制podspec并上传
394
+ podspec_creator = PodspecUtil.new(pod_target, version, builder.build_as_framework?, @configuration)
395
+ bin_spec = podspec_creator.create_binary_podspec
396
+ bin_spec_file = podspec_creator.write_binary_podspec(bin_spec)
397
+ result = podspec_creator.push_binary_podspec(bin_spec_file)
398
+ fail_pods << pod_target.pod_name unless result
399
+ success_pods << pod_target.pod_name if result
400
+ rescue Pod::StandardError => e
401
+ UI.info "`#{pod_target}`失败,原因:#{e}".red
402
+ fail_pods << pod_target.pod_name
403
+ next
404
+ end
405
+ end
406
+ # 关闭线程池,等待所有任务完成
407
+ # pool.shutdown
408
+ # pool.wait_for_termination
409
+ results = {
410
+ 'Total' => pod_targets,
411
+ 'Success' => success_pods,
412
+ 'Fail' => fail_pods,
413
+ 'Local' => local_pods,
414
+ 'External' => external_pods,
415
+ 'No Source File' => binary_pods,
416
+ 'Created Binary' => created_pods,
417
+ 'Black List' => @black_list || [],
418
+ 'Write List' => @write_list || []
419
+ }
420
+
421
+ show_results(results)
422
+ results
423
+ end
424
+ end
295
425
 
296
426
  def show_skip_tip(title)
297
427
  UI.info title.yellow
@@ -156,7 +156,16 @@ class PodUpdateConfig
156
156
  @@checksum = nil
157
157
  @@large_pod_hash = {}
158
158
  @@is_mtxx = false
159
+ @@is_clear = false
160
+ @@shell_project = false
159
161
 
162
+
163
+ def self.set_shell_project
164
+ @@shell_project = true
165
+ end
166
+ def self.shell_project
167
+ @@shell_project
168
+ end
160
169
  def self.add_value(value)
161
170
  @@pods << value
162
171
  end
@@ -205,5 +214,9 @@ class PodUpdateConfig
205
214
  def self.clear
206
215
  @@pods = []
207
216
  @@lockfile = nil
217
+ @@is_clear = true
218
+ end
219
+ def self.is_clear
220
+ @@is_clear
208
221
  end
209
222
  end
@@ -1,5 +1,5 @@
1
1
  module CBin
2
- VERSION = "1.2.2"
2
+ VERSION = "1.3.0"
3
3
  end
4
4
 
5
5
  module Pod
@@ -1,3 +1,4 @@
1
+ require 'cocoapods-meitu-bin/config/config'
1
2
 
2
3
  module CBin
3
4
  module BuildAll
@@ -10,7 +11,10 @@ module CBin
10
11
  @skip_simulator = skip_simulator
11
12
  @configuration = configuration
12
13
  @file_accessors = pod_target.file_accessors unless pod_target.nil?
13
- @base_dir = "#{Pathname.pwd}/all_build/Build"
14
+ @base_dir = "#{Pathname.pwd}/build_pods"
15
+ if PodUpdateConfig.shell_project
16
+ @base_dir = "#{Pathname.pwd}/all_build/Build"
17
+ end
14
18
  end
15
19
 
16
20
  # 构建
@@ -1,4 +1,4 @@
1
-
1
+ require 'cocoapods-meitu-bin/config/config'
2
2
  module CBin
3
3
  module BuildAll
4
4
  class PodspecUtil
@@ -48,11 +48,10 @@ module CBin
48
48
  # podspec写入文件
49
49
  def write_binary_podspec(spec)
50
50
  UI.info "写入podspec:`#{@pod_target}`".yellow
51
- podspec_dir = "#{Pathname.pwd}/all_build/Build/Products/podspec"
51
+ podspec_dir = PodUpdateConfig.shell_project ? "#{Pathname.pwd}/all_build/Build/Products/podspec" : "#{Pathname.pwd}/build_pods/#{@pod_target}/Products/podspec"
52
52
  FileUtils.mkdir(podspec_dir) unless File.exist?(podspec_dir)
53
53
  file = "#{podspec_dir}/#{@pod_target.pod_name}.podspec.json"
54
54
  FileUtils.rm_rf(file) if File.exist?(file)
55
-
56
55
  File.open(file, "w+") do |f|
57
56
  f.write(spec.to_pretty_json)
58
57
  end
@@ -47,6 +47,9 @@ module Pod
47
47
  if PodUpdateConfig.lockfile
48
48
  self.instance_variable_set("@lockfile",PodUpdateConfig.lockfile)
49
49
  end
50
+ if PodUpdateConfig.is_clear
51
+ self.instance_variable_set("@lockfile",PodUpdateConfig.lockfile)
52
+ end
50
53
 
51
54
  plugin_sources = run_source_provider_hooks
52
55
  analyzer = create_analyzer(plugin_sources)
@@ -12,6 +12,9 @@ def get_podfile_lock
12
12
  begin
13
13
  # 默认是获取要获取服务端podfile.lock文件
14
14
  is_load_podfile_lock = true
15
+ #获取 PODFILE CHECKSUM 用来判断服务端是否存在该podfile.lock
16
+ checksum = get_checksum(Pod::Config.instance.podfile_path)
17
+ PodUpdateConfig.set_checksum(checksum)
15
18
  #目前只支持MTXX target "MTXX" 项目 #想要支持其他项目可以添加对应 target "xxx"
16
19
  content = File.read(Pod::Config.instance.podfile_path)
17
20
  if content
@@ -35,9 +38,6 @@ def get_podfile_lock
35
38
  end
36
39
  # podfile.lock文件下载和使用逻辑
37
40
  if is_load_podfile_lock
38
- #获取 PODFILE CHECKSUM 用来判断服务端是否存在该podfile.lock
39
- checksum = get_checksum(Pod::Config.instance.podfile_path)
40
- PodUpdateConfig.set_checksum(checksum)
41
41
  Pod::UI.puts "当前podfile文件的checksum:#{checksum}".green
42
42
  # zip下载地址
43
43
  curl = "https://xiuxiu-dl-meitu-com.obs.cn-north-4.myhuaweicloud.com/ios/binary/MTXX/#{checksum}/podfile.lock.zip"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-meitu-bin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jensen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-02 00:00:00.000000000 Z
11
+ date: 2023-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel