cocoapods-meitu-bin 1.2.3 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cocoapods-meitu-bin/command/bin/build_all.rb +131 -1
- data/lib/cocoapods-meitu-bin/config/config.rb +13 -0
- data/lib/cocoapods-meitu-bin/gem_version.rb +1 -1
- data/lib/cocoapods-meitu-bin/helpers/buildAll/builder.rb +5 -1
- data/lib/cocoapods-meitu-bin/helpers/buildAll/podspec_util.rb +2 -3
- data/lib/cocoapods-meitu-bin/native/installer.rb +3 -0
- data/lib/cocoapods-meitu-bin/source_provider_hook.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10fbbb2a4ad0c86bbae1e71d4c93482c4c41f3f09fb58b57dcf3f2f3a76d8907
|
4
|
+
data.tar.gz: fa321bbb4812aa3b48ea7b476df5d16554015d7c0d34b32e71cdcce24590ed79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
# 删除编译产物
|
@@ -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,3 +1,4 @@
|
|
1
|
+
require 'cocoapods-meitu-bin/config/config'
|
1
2
|
|
2
3
|
module CBin
|
3
4
|
module BuildAll
|
@@ -11,6 +12,9 @@ module CBin
|
|
11
12
|
@configuration = configuration
|
12
13
|
@file_accessors = pod_target.file_accessors unless pod_target.nil?
|
13
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
|
# 构建
|
@@ -92,7 +96,7 @@ module CBin
|
|
92
96
|
|
93
97
|
# xxx.framework 所在目录
|
94
98
|
def product_dir
|
95
|
-
@product_dir = "#{@base_dir}
|
99
|
+
@product_dir = "#{@base_dir}/Products"
|
96
100
|
@product_dir
|
97
101
|
end
|
98
102
|
|
@@ -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}/build_pods/#{@pod_target}/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.
|
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-
|
11
|
+
date: 2023-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel
|