pindo 5.14.3 → 5.14.5
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 +4 -4
- data/lib/pindo/base/aeshelper.rb +1 -0
- data/lib/pindo/base/executable.rb +2 -0
- data/lib/pindo/base/git_handler.rb +45 -7
- data/lib/pindo/base/informative.rb +11 -0
- data/lib/pindo/base/plistbuddyexecutable.rb +2 -0
- data/lib/pindo/client/feishuclient.rb +1 -1
- data/lib/pindo/client/httpclient.rb +88 -12
- data/lib/pindo/command/android/autobuild.rb +3 -7
- data/lib/pindo/command/appstore/autobuild.rb +8 -18
- data/lib/pindo/command/gplay/pullconfig.rb +3 -2
- data/lib/pindo/command/ios/autobuild.rb +3 -7
- data/lib/pindo/command/jps/bind.rb +284 -121
- data/lib/pindo/command/jps/media.rb +1 -15
- data/lib/pindo/command/unity/autobuild.rb +5 -14
- data/lib/pindo/command/unity/packbuild.rb +3 -8
- data/lib/pindo/command/utils/tag.rb +2 -7
- data/lib/pindo/command/utils/updateconfig.rb +3 -2
- data/lib/pindo/command/web/autobuild.rb +23 -33
- data/lib/pindo/command.rb +1 -8
- data/lib/pindo/config/ios_config_parser.rb +26 -25
- data/lib/pindo/module/android/android_build_helper.rb +1 -1
- data/lib/pindo/module/android/android_config_helper.rb +1 -1
- data/lib/pindo/module/android/android_res_helper.rb +1 -1
- data/lib/pindo/module/pgyer/pgyerhelper.rb +87 -0
- data/lib/pindo/module/task/model/build/android_build_dev_task.rb +29 -15
- data/lib/pindo/module/task/model/build/ios_build_adhoc_task.rb +2 -3
- data/lib/pindo/module/task/model/build/ios_build_dev_task.rb +30 -16
- data/lib/pindo/module/task/model/git/git_commit_task.rb +68 -13
- data/lib/pindo/module/task/model/git/git_tag_task.rb +16 -7
- data/lib/pindo/module/task/model/jps/jps_bind_package_task.rb +217 -0
- data/lib/pindo/module/task/model/jps/jps_message_task.rb +3 -2
- data/lib/pindo/module/task/model/jps/jps_upload_media_task.rb +168 -49
- data/lib/pindo/module/task/model/jps/jps_workflow_message_task.rb +190 -0
- data/lib/pindo/module/task/model/unity/unity_config_task.rb +4 -0
- data/lib/pindo/module/task/pindo_task.rb +1 -0
- data/lib/pindo/module/xcode/xcode_app_config.rb +26 -16
- data/lib/pindo/module/xcode/xcode_build_config.rb +2 -2
- data/lib/pindo/module/xcode/xcode_swark_helper.rb +5 -5
- data/lib/pindo/version.rb +1 -1
- metadata +13 -54
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 60289998ea7be5f175400dbd6038a6aebe104095280ee7fe10aba1ea513d20f8
|
|
4
|
+
data.tar.gz: 1a4fddd44fa17a17716a4e55a9c3ad7df41fed6357934e2b179801779dd7a139
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 99b491f10a169e0aeac7fef944d969b48bfa8520a220f3705f4762e3643515dd9e978bef2f5d519abc3970dc29ca734d41d5d6532beb61157389a92aee562ff2
|
|
7
|
+
data.tar.gz: b806779564f476de930e152265f2b36a340bd0a1dc82a7d703d8a3789f162910991a2a50d26a5c9b5ae9da719ba9b61032d9b4c58eec6ab5360305213547a700
|
data/lib/pindo/base/aeshelper.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require 'fileutils'
|
|
2
2
|
require 'pindo/base/executable'
|
|
3
|
+
require 'pindo/base/informative'
|
|
3
4
|
require 'etc'
|
|
4
5
|
require 'claide'
|
|
5
6
|
require 'highline/import'
|
|
@@ -460,11 +461,21 @@ module Pindo
|
|
|
460
461
|
raise ArgumentError, "项目目录不能为空" if project_dir.nil?
|
|
461
462
|
|
|
462
463
|
begin
|
|
464
|
+
# 1. 检查是否是 Git 仓库,并获取 Git 根目录
|
|
465
|
+
git_root = git_root_directory(local_repo_dir: project_dir)
|
|
466
|
+
|
|
467
|
+
# 2. 如果不是 Git 仓库,返回 nil
|
|
468
|
+
unless git_root
|
|
469
|
+
Funlog.instance.fancyinfo_warning("当前目录不是Git仓库,跳过Git操作")
|
|
470
|
+
return nil
|
|
471
|
+
end
|
|
472
|
+
|
|
473
|
+
# 3. 使用 Git 根目录执行 Git 命令
|
|
463
474
|
# 重置暂存区
|
|
464
|
-
git!(%W(-C #{
|
|
475
|
+
git!(%W(-C #{git_root} restore --staged #{git_root}))
|
|
465
476
|
|
|
466
477
|
# 获取未跟踪和已修改的文件
|
|
467
|
-
files_list = git!(%W(-C #{
|
|
478
|
+
files_list = git!(%W(-C #{git_root} ls-files --other --modified --exclude-standard)) || []
|
|
468
479
|
|
|
469
480
|
# 返回文件列表(如果为空则返回 nil)
|
|
470
481
|
if files_list.nil? || files_list.empty?
|
|
@@ -488,7 +499,14 @@ module Pindo
|
|
|
488
499
|
raise ArgumentError, "项目目录不能为空" if project_dir.nil?
|
|
489
500
|
raise ArgumentError, "处理方式不能为空" if process_type.nil?
|
|
490
501
|
|
|
491
|
-
|
|
502
|
+
# 获取 Git 根目录
|
|
503
|
+
git_root = git_root_directory(local_repo_dir: project_dir)
|
|
504
|
+
unless git_root
|
|
505
|
+
Funlog.instance.fancyinfo_warning("当前目录不是Git仓库,跳过处理未提交文件")
|
|
506
|
+
return
|
|
507
|
+
end
|
|
508
|
+
|
|
509
|
+
current_project_dir = git_root
|
|
492
510
|
origin_path = Dir.pwd
|
|
493
511
|
|
|
494
512
|
begin
|
|
@@ -555,9 +573,23 @@ module Pindo
|
|
|
555
573
|
|
|
556
574
|
Funlog.instance.fancyinfo_start("开始提交文件...")
|
|
557
575
|
git! ['add', '-A']
|
|
558
|
-
|
|
576
|
+
|
|
577
|
+
# 检查是否有文件需要提交
|
|
578
|
+
begin
|
|
579
|
+
git! ['commit', '-m', message]
|
|
580
|
+
Funlog.instance.fancyinfo_success("commit文件完成!")
|
|
581
|
+
rescue => e
|
|
582
|
+
# 如果是 "nothing to commit" 错误,说明没有变更,这是正常情况
|
|
583
|
+
if e.message.include?("nothing to commit") || e.message.include?("working tree clean")
|
|
584
|
+
Funlog.instance.fancyinfo_warning("没有需要提交的变更")
|
|
585
|
+
return # 直接返回,不需要 push
|
|
586
|
+
else
|
|
587
|
+
# 其他错误则继续抛出
|
|
588
|
+
raise e
|
|
589
|
+
end
|
|
590
|
+
end
|
|
591
|
+
|
|
559
592
|
git!(%W(-C #{project_dir} fetch origin))
|
|
560
|
-
Funlog.instance.fancyinfo_success("commit文件完成!")
|
|
561
593
|
Funlog.instance.fancyinfo_start("正在push...")
|
|
562
594
|
if remote_branch_exists?(local_repo_dir: project_dir, branch: branch)
|
|
563
595
|
git!(%W(-C #{project_dir} branch --set-upstream-to=origin/#{branch} #{branch}))
|
|
@@ -802,8 +834,14 @@ module Pindo
|
|
|
802
834
|
return 'skip'
|
|
803
835
|
end
|
|
804
836
|
|
|
805
|
-
# 4.
|
|
806
|
-
|
|
837
|
+
# 4. 获取 Git 根目录并获取当前分支名
|
|
838
|
+
git_root = git_root_directory(local_repo_dir: project_dir)
|
|
839
|
+
unless git_root
|
|
840
|
+
Funlog.instance.fancyinfo_warning("当前目录不是Git仓库")
|
|
841
|
+
return 'skip'
|
|
842
|
+
end
|
|
843
|
+
|
|
844
|
+
current_branch = git!(%W(-C #{git_root} rev-parse --abbrev-ref HEAD)).strip
|
|
807
845
|
display_file_status(current_branch, uncommitted_files)
|
|
808
846
|
|
|
809
847
|
# 5. 交互式选择
|
|
@@ -3,13 +3,80 @@ require 'uri'
|
|
|
3
3
|
require 'json'
|
|
4
4
|
require 'faraday'
|
|
5
5
|
require 'pindo/base/aeshelper'
|
|
6
|
-
require '
|
|
6
|
+
require 'typhoeus'
|
|
7
|
+
require 'typhoeus/adapters/faraday'
|
|
7
8
|
|
|
8
9
|
module Pindo
|
|
9
|
-
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
# 简单的 Faraday 重试中间件(替代 faraday-retry)
|
|
12
|
+
class SimpleRetryMiddleware < Faraday::Middleware
|
|
13
|
+
# 默认幂等的 HTTP 方法(可安全重试)
|
|
14
|
+
IDEMPOTENT_METHODS = [:get, :head, :put, :delete, :options, :trace].freeze
|
|
15
|
+
# 可重试的 HTTP 状态码(5xx 服务器错误)
|
|
16
|
+
RETRIABLE_STATUS_CODES = (500..599).freeze
|
|
17
|
+
|
|
18
|
+
def initialize(app, options = {})
|
|
19
|
+
super(app)
|
|
20
|
+
@max = options[:max] || 3 # 最大重试次数(不包括首次尝试)
|
|
21
|
+
@interval = options[:interval] || 0.5
|
|
22
|
+
@backoff_factor = options[:backoff_factor] || 2
|
|
23
|
+
@interval_randomness = options[:interval_randomness] || 0.5
|
|
24
|
+
@exceptions = options[:exceptions] || [Faraday::TimeoutError, Faraday::ConnectionFailed]
|
|
25
|
+
@methods = options[:methods] || IDEMPOTENT_METHODS # 允许重试的 HTTP 方法
|
|
26
|
+
@retry_statuses = options[:retry_statuses] || RETRIABLE_STATUS_CODES
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def call(env)
|
|
30
|
+
retries = 0
|
|
31
|
+
|
|
32
|
+
loop do
|
|
33
|
+
begin
|
|
34
|
+
response = @app.call(env)
|
|
35
|
+
|
|
36
|
+
# 检查 HTTP 状态码是否需要重试(5xx 错误)
|
|
37
|
+
# 同时必须满足幂等性要求,避免非幂等请求(如 POST)被意外重试
|
|
38
|
+
if retriable_response?(response) && retriable_request?(env) && retries < @max
|
|
39
|
+
retries += 1
|
|
40
|
+
sleep_with_jitter(retries)
|
|
41
|
+
next # 继续下一次循环(重试)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
return response # 成功,返回响应
|
|
45
|
+
|
|
46
|
+
rescue *@exceptions => e
|
|
47
|
+
# 检查是否为幂等方法,非幂等方法不自动重试
|
|
48
|
+
if retriable_request?(env) && retries < @max
|
|
49
|
+
retries += 1
|
|
50
|
+
sleep_with_jitter(retries)
|
|
51
|
+
next # 继续下一次循环(重试)
|
|
52
|
+
else
|
|
53
|
+
raise e # 不能重试,抛出异常
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
private
|
|
12
60
|
|
|
61
|
+
# 检查请求是否可重试(幂等性检查)
|
|
62
|
+
def retriable_request?(env)
|
|
63
|
+
@methods.include?(env[:method])
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# 检查响应是否需要重试(5xx 状态码)
|
|
67
|
+
def retriable_response?(response)
|
|
68
|
+
@retry_statuses.include?(response.status)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# 指数退避 + 随机抖动
|
|
72
|
+
def sleep_with_jitter(retry_count)
|
|
73
|
+
sleep_time = @interval * (@backoff_factor ** (retry_count - 1))
|
|
74
|
+
jitter = rand * sleep_time * @interval_randomness
|
|
75
|
+
sleep(sleep_time + jitter)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
class HttpClient
|
|
13
80
|
|
|
14
81
|
attr_accessor :token
|
|
15
82
|
attr_accessor :baseurl
|
|
@@ -25,23 +92,32 @@ module Pindo
|
|
|
25
92
|
}
|
|
26
93
|
|
|
27
94
|
retry_options = {
|
|
28
|
-
max: 3,
|
|
29
|
-
interval: 0.5,
|
|
30
|
-
backoff_factor: 2,
|
|
31
|
-
interval_randomness: 0.5
|
|
95
|
+
max: 3,
|
|
96
|
+
interval: 0.5,
|
|
97
|
+
backoff_factor: 2,
|
|
98
|
+
interval_randomness: 0.5
|
|
32
99
|
}
|
|
33
100
|
|
|
34
101
|
con = Faraday.new do |config|
|
|
35
|
-
|
|
36
|
-
config.
|
|
102
|
+
# 使用自定义重试中间件
|
|
103
|
+
config.use SimpleRetryMiddleware, retry_options
|
|
104
|
+
# 使用 Typhoeus 适配器(支持代理和连接池)
|
|
105
|
+
config.adapter :typhoeus
|
|
106
|
+
config.proxy = proxy_options.compact if proxy_options[:uri]
|
|
37
107
|
end
|
|
38
|
-
|
|
108
|
+
|
|
39
109
|
con
|
|
40
110
|
end
|
|
41
111
|
|
|
42
112
|
def self.create_instance()
|
|
43
|
-
|
|
44
|
-
con = Faraday.new
|
|
113
|
+
|
|
114
|
+
con = Faraday.new do |config|
|
|
115
|
+
# 使用自定义重试中间件
|
|
116
|
+
config.use SimpleRetryMiddleware, max: 3, interval: 0.5, backoff_factor: 2
|
|
117
|
+
# 使用 Typhoeus 适配器
|
|
118
|
+
config.adapter :typhoeus
|
|
119
|
+
end
|
|
120
|
+
|
|
45
121
|
con
|
|
46
122
|
end
|
|
47
123
|
|
|
@@ -276,14 +276,10 @@ module Pindo
|
|
|
276
276
|
tasks << build_task
|
|
277
277
|
|
|
278
278
|
# 4. Git 标签任务(依赖第一个编译任务)
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
release_branch: @args_release_branch,
|
|
282
|
-
ver_inc: @args_ver_inc,
|
|
283
|
-
tag_type: @args_tag_type,
|
|
284
|
-
tag_pre: @args_tag_pre
|
|
285
|
-
)
|
|
279
|
+
# 所有参数都从 GitCommitTask 获取
|
|
280
|
+
git_tag_task = Pindo::TaskSystem::GitTagTask.new(config[:project_path])
|
|
286
281
|
git_tag_task.dependencies << build_task.id
|
|
282
|
+
git_tag_task.dependencies << git_commit_task.id
|
|
287
283
|
tasks << git_tag_task
|
|
288
284
|
|
|
289
285
|
# 5. 上传和消息发送任务(如果需要)
|
|
@@ -280,33 +280,23 @@ module Pindo
|
|
|
280
280
|
build_task.dependencies << last_task.id
|
|
281
281
|
tasks << build_task
|
|
282
282
|
|
|
283
|
-
# 3. Git 标签任务 -
|
|
284
|
-
|
|
285
|
-
git_tag_task = Pindo::TaskSystem::GitTagTask.new(
|
|
286
|
-
project_path,
|
|
287
|
-
release_branch: @args_release_branch,
|
|
288
|
-
tag_type: @args_tag_type,
|
|
289
|
-
tag_pre: @args_tag_pre,
|
|
290
|
-
fixed_version: fixed_version
|
|
291
|
-
)
|
|
283
|
+
# 3. Git 标签任务 - 项目仓库
|
|
284
|
+
# 所有参数(版本号、tag_pre、release_branch 等)都从 GitCommitTask 获取
|
|
285
|
+
git_tag_task = Pindo::TaskSystem::GitTagTask.new(project_path)
|
|
292
286
|
git_tag_task.dependencies << build_task.id
|
|
287
|
+
git_tag_task.dependencies << git_commit_task.id
|
|
293
288
|
tasks << git_tag_task
|
|
294
289
|
|
|
295
|
-
# 4. Git 标签任务 -
|
|
290
|
+
# 4. Git 标签任务 - 配置仓库
|
|
291
|
+
# 所有参数都从 GitCommitTask 获取
|
|
296
292
|
app_repo_name = Pindo::IosConfigParser.instance.app_repo_name
|
|
297
293
|
if app_repo_name && !app_repo_name.empty?
|
|
298
294
|
pindo_dir = File.expand_path(Pindoconfig.instance.pindo_dir)
|
|
299
295
|
config_repo_path = File.join(pindo_dir, app_repo_name)
|
|
300
296
|
|
|
301
297
|
if File.exist?(config_repo_path)
|
|
302
|
-
config_git_tag_task = Pindo::TaskSystem::GitTagTask.new(
|
|
303
|
-
|
|
304
|
-
release_branch: @args_release_branch,
|
|
305
|
-
tag_type: @args_tag_type,
|
|
306
|
-
tag_pre: @args_tag_pre,
|
|
307
|
-
fixed_version: fixed_version
|
|
308
|
-
)
|
|
309
|
-
config_git_tag_task.dependencies << git_tag_task.id
|
|
298
|
+
config_git_tag_task = Pindo::TaskSystem::GitTagTask.new(config_repo_path)
|
|
299
|
+
config_git_tag_task.dependencies << git_commit_task.id
|
|
310
300
|
tasks << config_git_tag_task
|
|
311
301
|
end
|
|
312
302
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'fileutils'
|
|
2
|
+
require 'pindo/base/git_handler'
|
|
2
3
|
|
|
3
4
|
module Pindo
|
|
4
5
|
class Command
|
|
@@ -35,8 +36,8 @@ module Pindo
|
|
|
35
36
|
end
|
|
36
37
|
|
|
37
38
|
def run
|
|
38
|
-
#
|
|
39
|
-
app_config_dir = clong_buildconfig_repo(repo_name: @bundle_name)
|
|
39
|
+
# 克隆配置仓库
|
|
40
|
+
app_config_dir = Pindo::GitHandler.clong_buildconfig_repo(repo_name: @bundle_name)
|
|
40
41
|
|
|
41
42
|
# 返回配置仓库路径
|
|
42
43
|
app_config_dir
|
|
@@ -295,14 +295,10 @@ module Pindo
|
|
|
295
295
|
tasks << build_task
|
|
296
296
|
|
|
297
297
|
# 4. Git 标签任务(依赖第一个编译任务)
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
release_branch: @args_release_branch,
|
|
301
|
-
ver_inc: @args_ver_inc,
|
|
302
|
-
tag_type: @args_tag_type,
|
|
303
|
-
tag_pre: @args_tag_pre
|
|
304
|
-
)
|
|
298
|
+
# 所有参数都从 GitCommitTask 获取
|
|
299
|
+
git_tag_task = Pindo::TaskSystem::GitTagTask.new(config[:project_path])
|
|
305
300
|
git_tag_task.dependencies << build_task.id
|
|
301
|
+
git_tag_task.dependencies << git_commit_task.id
|
|
306
302
|
tasks << git_tag_task
|
|
307
303
|
|
|
308
304
|
# 5. 上传和消息发送任务(如果需要)
|