pindo 5.19.5 → 5.20.1
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/git_handler.rb +55 -10
- data/lib/pindo/command/android/autobuild.rb +1 -1
- data/lib/pindo/command/appstore/autobuild.rb +1 -1
- data/lib/pindo/command/appstore/iap.rb +2 -2
- data/lib/pindo/command/appstore/updateid.rb +1 -1
- data/lib/pindo/command/ios/autobuild.rb +1 -1
- data/lib/pindo/command/ios/podpush.rb +1 -1
- data/lib/pindo/command/jps/apptest.rb +6 -3
- data/lib/pindo/command/jps/bind.rb +7 -3
- data/lib/pindo/command/jps/config.rb +354 -0
- data/lib/pindo/command/jps/download.rb +3 -2
- data/lib/pindo/command/jps/media.rb +7 -3
- data/lib/pindo/command/jps/upload.rb +7 -3
- data/lib/pindo/command/jps.rb +1 -0
- data/lib/pindo/command/unity/autobuild.rb +1 -1
- data/lib/pindo/command/unity/packbuild.rb +1 -1
- data/lib/pindo/command/utils/copyconfig.rb +1 -1
- data/lib/pindo/command/utils/renewbundleid.rb +1 -1
- data/lib/pindo/command/utils/tag.rb +1 -1
- data/lib/pindo/command/web/autobuild.rb +1 -1
- data/lib/pindo/config/build_info_manager.rb +2 -2
- data/lib/pindo/module/appstore/itcapp_helper.rb +1 -1
- data/lib/pindo/module/build/swark_helper.rb +1 -1
- data/lib/pindo/module/cert/cert_helper.rb +1 -1
- data/lib/pindo/module/cert/pem_helper.rb +1 -1
- data/lib/pindo/module/pgyer/pgyerhelper.rb +259 -100
- data/lib/pindo/module/source_files_guard.rb +83 -0
- data/lib/pindo/module/task/model/build/ios_build_adhoc_task.rb +1 -1
- data/lib/pindo/module/task/model/build/ios_build_appstore_task.rb +1 -1
- data/lib/pindo/module/task/model/build/ios_build_dev_task.rb +3 -3
- data/lib/pindo/module/task/model/git/git_commit_task.rb +14 -4
- data/lib/pindo/module/task/model/git/git_tag_task.rb +66 -10
- data/lib/pindo/module/utils/git_repo_helper.rb +2 -2
- data/lib/pindo/module/xcode/applovin_xcode_helper.rb +1 -1
- data/lib/pindo/module/xcode/cocoapods_helper.rb +2 -2
- data/lib/pindo/module/xcode/xcode_build_helper.rb +3 -3
- data/lib/pindo/module/xcode/xcode_swark_helper.rb +1 -1
- data/lib/pindo/options/groups/jps_options.rb +43 -0
- data/lib/pindo/version.rb +1 -1
- metadata +3 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require 'pindo/module/task/model/git_task'
|
|
2
2
|
require 'pindo/base/git_handler'
|
|
3
|
+
require 'pindo/module/source_files_guard'
|
|
3
4
|
require 'pindo/module/utils/git_repo_helper'
|
|
4
5
|
|
|
5
6
|
module Pindo
|
|
@@ -26,9 +27,9 @@ module Pindo
|
|
|
26
27
|
# - tag_pre: tag前缀,默认 'v'
|
|
27
28
|
# 注意:版本号从 GitCommitTask 获取(GitTagTask 必须依赖 GitCommitTask)
|
|
28
29
|
def initialize(project_path, options = {})
|
|
29
|
-
options[:
|
|
30
|
+
@process_type = options[:process_type]
|
|
30
31
|
# 调用基类初始化(基类会设置所有通用属性)
|
|
31
|
-
super("Git仓库打Tag", options)
|
|
32
|
+
super("Git仓库打Tag", options.merge(project_path: project_path))
|
|
32
33
|
end
|
|
33
34
|
|
|
34
35
|
def validate
|
|
@@ -57,19 +58,25 @@ module Pindo
|
|
|
57
58
|
stash_saved = false
|
|
58
59
|
|
|
59
60
|
begin
|
|
60
|
-
# 1.
|
|
61
|
+
# 1. 先从 GitCommitTask 回填 process_type,再决定提交或 stash
|
|
62
|
+
backfill_params_from_commit_task(git_commit_data)
|
|
63
|
+
|
|
64
|
+
build_changes_committed = commit_build_changes? && commit_build_changes(root_dir)
|
|
65
|
+
|
|
66
|
+
# 未命中固定源码清单的构建产物不进入提交;暂存后再合并、打 tag。
|
|
61
67
|
stash_saved = stash_if_dirty(root_dir, stash_name)
|
|
62
68
|
|
|
63
|
-
|
|
64
|
-
|
|
69
|
+
if build_changes_committed
|
|
70
|
+
Pindo::GitHandler.check_unpushed_commits(project_dir: root_dir, branch: coding_branch)
|
|
71
|
+
end
|
|
65
72
|
|
|
66
|
-
#
|
|
73
|
+
# 2. 合并到发布分支
|
|
67
74
|
merge_to_release_branch(root_dir, coding_branch)
|
|
68
75
|
|
|
69
|
-
#
|
|
76
|
+
# 3. 解析版本号
|
|
70
77
|
resolve_build_version(root_dir, git_commit_data, git_repo_helper)
|
|
71
78
|
|
|
72
|
-
#
|
|
79
|
+
# 4. 创建并推送 Tag
|
|
73
80
|
tag_name = "#{@tag_pre}#{@build_version}"
|
|
74
81
|
git_repo_helper.create_and_push_tag(
|
|
75
82
|
project_dir: root_dir,
|
|
@@ -77,7 +84,7 @@ module Pindo
|
|
|
77
84
|
tag_type: @tag_type
|
|
78
85
|
)
|
|
79
86
|
ensure
|
|
80
|
-
#
|
|
87
|
+
# 5. 还原 stash
|
|
81
88
|
restore_stash(root_dir, stash_name) if stash_saved
|
|
82
89
|
end
|
|
83
90
|
end
|
|
@@ -94,7 +101,7 @@ module Pindo
|
|
|
94
101
|
true
|
|
95
102
|
end
|
|
96
103
|
|
|
97
|
-
# 从 GitCommitTask 回填
|
|
104
|
+
# 从 GitCommitTask 回填 Git 参数和未提交文件处理方式
|
|
98
105
|
def backfill_params_from_commit_task(git_commit_data)
|
|
99
106
|
return unless git_commit_data && git_commit_data[:task_param]
|
|
100
107
|
|
|
@@ -103,10 +110,59 @@ module Pindo
|
|
|
103
110
|
@tag_pre = param[:tag_pre] if param[:tag_pre]
|
|
104
111
|
@tag_type = param[:tag_type] if param[:tag_type]
|
|
105
112
|
@ver_inc = param[:ver_inc] if param[:ver_inc]
|
|
113
|
+
@process_type = param[:process_type] if param[:process_type]
|
|
114
|
+
@build_version = param[:build_version] if param[:build_version]
|
|
115
|
+
@build_number = param[:build_number] if param[:build_number]
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def commit_build_changes?
|
|
119
|
+
@process_type == Pindo::UncommittedFilesProcessType::COMMIT
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# 只提交 autobuild 明确注入的源码文件,避免把 Pods、DerivedData 等构建产物带入发布提交。
|
|
123
|
+
def commit_build_changes(root_dir)
|
|
124
|
+
guard_paths = existing_guard_paths(
|
|
125
|
+
root_dir,
|
|
126
|
+
Pindo::BuildSourceFilesGuard.for_project(@project_path)
|
|
127
|
+
)
|
|
128
|
+
return false if guard_paths.empty?
|
|
129
|
+
|
|
130
|
+
Pindo::GitHandler.git!(git_command(root_dir, 'add', '--', *guard_paths))
|
|
131
|
+
staged_files = Pindo::GitHandler.git!(
|
|
132
|
+
git_command(root_dir, 'diff', '--cached', '--name-only', '--', *guard_paths)
|
|
133
|
+
).lines.map(&:strip).reject(&:empty?)
|
|
134
|
+
return false if staged_files.empty?
|
|
135
|
+
|
|
136
|
+
commit_message = "chore(build): 更新版本至 #{@build_version}"
|
|
137
|
+
Pindo::GitHandler.git!(
|
|
138
|
+
git_command(root_dir, 'commit', '--only', '-m', commit_message, '--', *staged_files)
|
|
139
|
+
)
|
|
140
|
+
Funlog.instance.fancyinfo_success("已提交构建注入源码: #{staged_files.join(', ')}")
|
|
141
|
+
true
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def existing_guard_paths(root_dir, source_files)
|
|
145
|
+
expanded_root = File.realpath(root_dir)
|
|
146
|
+
root_prefix = "#{expanded_root}#{File::SEPARATOR}"
|
|
147
|
+
|
|
148
|
+
Array(source_files).filter_map do |path|
|
|
149
|
+
next unless File.exist?(path)
|
|
150
|
+
|
|
151
|
+
expanded_path = File.realpath(path)
|
|
152
|
+
next unless expanded_path.start_with?(root_prefix)
|
|
153
|
+
|
|
154
|
+
expanded_path.delete_prefix(root_prefix)
|
|
155
|
+
end.uniq
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def git_command(root_dir, command, *arguments)
|
|
159
|
+
['--literal-pathspecs', '-C', root_dir, command, *arguments]
|
|
106
160
|
end
|
|
107
161
|
|
|
108
162
|
# 将编码分支双向合并到发布分支,确保两分支同步到同一节点
|
|
109
163
|
def merge_to_release_branch(root_dir, coding_branch)
|
|
164
|
+
# 解析发布分支(独立运行、或未经 GitCommitTask 回填时也能得到正确分支)
|
|
165
|
+
@release_branch = Pindo::GitHandler.resolve_release_branch(local_repo_dir: root_dir, preferred: @release_branch)
|
|
110
166
|
return if coding_branch == @release_branch
|
|
111
167
|
|
|
112
168
|
Pindo::GitHandler.merge_branches(
|
|
@@ -57,7 +57,7 @@ module Pindo
|
|
|
57
57
|
current_branch = Pindo::GitHandler.git!(%W(-C #{current_git_root_path} rev-parse --abbrev-ref HEAD)).strip
|
|
58
58
|
Pindo::GitHandler.git!(%W(-C #{current_git_root_path} add cliff.toml))
|
|
59
59
|
# .gitignore 已由 check_gitignore 自动添加到暂存区,无需重复添加
|
|
60
|
-
commit_message = "docs(config): 添加日志变更配置".encode('UTF-8')
|
|
60
|
+
commit_message = "docs(config): pindo 添加日志变更配置".encode('UTF-8')
|
|
61
61
|
Pindo::GitHandler.git!(%W(-C #{current_git_root_path} commit -m #{commit_message}))
|
|
62
62
|
Pindo::GitHandler.git!(%W(-C #{current_git_root_path} push origin #{current_branch}))
|
|
63
63
|
else
|
|
@@ -158,7 +158,7 @@ module Pindo
|
|
|
158
158
|
current_branch = Pindo::GitHandler.git!(%W(-C #{git_root_dir} rev-parse --abbrev-ref HEAD)).strip
|
|
159
159
|
|
|
160
160
|
# 提交
|
|
161
|
-
commit_message = "chore(config): 更新 .gitignore 规则"
|
|
161
|
+
commit_message = "chore(config): pindo 更新 .gitignore 规则"
|
|
162
162
|
Pindo::GitHandler.git!(%W(-C #{git_root_dir} commit -m #{commit_message}))
|
|
163
163
|
Funlog.instance.fancyinfo_success("已自动提交 .gitignore 更改")
|
|
164
164
|
|
|
@@ -230,7 +230,7 @@ module Pindo
|
|
|
230
230
|
begin
|
|
231
231
|
Pindo::GitHandler.git_addpush_repo(
|
|
232
232
|
path: config_dir,
|
|
233
|
-
message: "chore(config): 更新 Applovin SKAdNetworkItems",
|
|
233
|
+
message: "chore(config): pindo 更新 Applovin SKAdNetworkItems",
|
|
234
234
|
commit_file_params: ["applovin_client_config.json"]
|
|
235
235
|
)
|
|
236
236
|
puts "✓ 配置已保存到远程仓库"
|
|
@@ -187,7 +187,7 @@ module Pindo
|
|
|
187
187
|
FileUtils.cp(proj_pod_file, File.join(app_config_dir, "Podfile.lock"))
|
|
188
188
|
Pindo::GitHandler.git_addpush_repo(
|
|
189
189
|
path: app_config_dir,
|
|
190
|
-
message: "chore(pod): 备份 #{app_version} 的 Podfile.lock",
|
|
190
|
+
message: "chore(pod): pindo 备份 #{app_version} 的 Podfile.lock",
|
|
191
191
|
commit_file_params: ["Podfile.lock"]
|
|
192
192
|
)
|
|
193
193
|
|
|
@@ -218,7 +218,7 @@ module Pindo
|
|
|
218
218
|
|
|
219
219
|
Pindo::GitHandler.git_addpush_repo(
|
|
220
220
|
path: app_config_dir,
|
|
221
|
-
message: "chore(build): 备份 #{app_version} 的构建输出信息",
|
|
221
|
+
message: "chore(build): pindo 备份 #{app_version} 的构建输出信息",
|
|
222
222
|
commit_file_params: ["build_verify.json"]
|
|
223
223
|
)
|
|
224
224
|
|
|
@@ -48,7 +48,7 @@ module Pindo
|
|
|
48
48
|
file.close
|
|
49
49
|
end
|
|
50
50
|
|
|
51
|
-
git_addpush_repo(path:app_config_dir, message:"chore(build): 回写发布信息", commit_file_params:["build_verify.json"])
|
|
51
|
+
git_addpush_repo(path:app_config_dir, message:"chore(build): pindo 回写发布信息", commit_file_params:["build_verify.json"])
|
|
52
52
|
|
|
53
53
|
if File.exist?(src_pod_file)
|
|
54
54
|
FileUtils.cp_r(src_pod_file, File.join(project_dir, "Podfile.lock"))
|
|
@@ -64,7 +64,7 @@ module Pindo
|
|
|
64
64
|
begin
|
|
65
65
|
proj_pod_file = File.join(project_dir, "Podfile.lock")
|
|
66
66
|
FileUtils.cp_r(proj_pod_file, File.join(app_config_dir, "Podfile.lock"))
|
|
67
|
-
git_addpush_repo(path:app_config_dir, message:"chore(pod): 备份 #{appversion} 的 Podfile.lock", commit_file_params:["Podfile.lock"])
|
|
67
|
+
git_addpush_repo(path:app_config_dir, message:"chore(pod): pindo 备份 #{appversion} 的 Podfile.lock", commit_file_params:["Podfile.lock"])
|
|
68
68
|
|
|
69
69
|
bytes = File.binread(proj_pod_file)
|
|
70
70
|
checksum = Digest::MD5.hexdigest(bytes)
|
|
@@ -84,7 +84,7 @@ module Pindo
|
|
|
84
84
|
file.write(JSON.pretty_generate(build_verify_json))
|
|
85
85
|
file.close
|
|
86
86
|
end
|
|
87
|
-
git_addpush_repo(path:app_config_dir, message:"chore(build): 备份 #{appversion} 的构建输出信息", commit_file_params:["build_verify.json"])
|
|
87
|
+
git_addpush_repo(path:app_config_dir, message:"chore(build): pindo 备份 #{appversion} 的构建输出信息", commit_file_params:["build_verify.json"])
|
|
88
88
|
|
|
89
89
|
rescue => error
|
|
90
90
|
raise Informative, "保存Podfile.lock 文件失败!!!"
|
|
@@ -333,7 +333,7 @@ module Pindo
|
|
|
333
333
|
end
|
|
334
334
|
|
|
335
335
|
# 提交到配置仓库
|
|
336
|
-
Pindo::GitHandler.git_addpush_repo(path: app_config_dir, message: "chore(config): 完成 swark 授权")
|
|
336
|
+
Pindo::GitHandler.git_addpush_repo(path: app_config_dir, message: "chore(config): pindo 完成 swark 授权")
|
|
337
337
|
|
|
338
338
|
Funlog.instance.fancyinfo_success("Swark 授权完成!")
|
|
339
339
|
return true
|
|
@@ -141,6 +141,49 @@ module Pindo
|
|
|
141
141
|
env_name: 'PINDO_JPS_INDEX',
|
|
142
142
|
optional: true,
|
|
143
143
|
example: 'pindo jps download --index=1'
|
|
144
|
+
),
|
|
145
|
+
|
|
146
|
+
type: OptionItem.new(
|
|
147
|
+
key: :type,
|
|
148
|
+
name: '工作流类型',
|
|
149
|
+
description: '指定要配置的工作流类型,逗号分隔(ipa,apk,zip,mac,exe,git);不指定时弹出交互多选菜单',
|
|
150
|
+
type: String,
|
|
151
|
+
env_name: 'PINDO_JPS_CONFIG_TYPE',
|
|
152
|
+
optional: true,
|
|
153
|
+
cacheable: false,
|
|
154
|
+
example: 'pindo jps config --type=ipa,apk,git'
|
|
155
|
+
),
|
|
156
|
+
|
|
157
|
+
clean: OptionItem.new(
|
|
158
|
+
key: :clean,
|
|
159
|
+
name: '清除配置',
|
|
160
|
+
description: '清除 JPSBuildConfig.json 中指定或选中的工作流绑定',
|
|
161
|
+
type: OptionItem::Boolean,
|
|
162
|
+
env_name: 'PINDO_JPS_CONFIG_CLEAN',
|
|
163
|
+
optional: true,
|
|
164
|
+
example: 'pindo jps config --clean'
|
|
165
|
+
),
|
|
166
|
+
|
|
167
|
+
proj: OptionItem.new(
|
|
168
|
+
key: :proj,
|
|
169
|
+
name: 'JPS项目名',
|
|
170
|
+
description: '直接指定 JPS 上的项目名称,跳过项目选择菜单(非交互场景使用)',
|
|
171
|
+
type: String,
|
|
172
|
+
env_name: 'PINDO_JPS_PROJ',
|
|
173
|
+
optional: true,
|
|
174
|
+
cacheable: false,
|
|
175
|
+
example: 'pindo jps config --proj=MyApp --type=ipa'
|
|
176
|
+
),
|
|
177
|
+
|
|
178
|
+
workflow_name: OptionItem.new(
|
|
179
|
+
key: :workflow_name,
|
|
180
|
+
name: '工作流名称',
|
|
181
|
+
description: '按名称指定工作流,用于某类型匹配到多个工作流时消歧(非交互场景使用)',
|
|
182
|
+
type: String,
|
|
183
|
+
env_name: 'PINDO_JPS_WORKFLOW_NAME',
|
|
184
|
+
optional: true,
|
|
185
|
+
cacheable: false,
|
|
186
|
+
example: 'pindo jps config --proj=MyApp --type=ipa --workflow_name="iOS IPA Upload"'
|
|
144
187
|
)
|
|
145
188
|
}
|
|
146
189
|
end
|
data/lib/pindo/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pindo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.
|
|
4
|
+
version: 5.20.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- wade
|
|
@@ -333,6 +333,7 @@ files:
|
|
|
333
333
|
- lib/pindo/command/jps.rb
|
|
334
334
|
- lib/pindo/command/jps/apptest.rb
|
|
335
335
|
- lib/pindo/command/jps/bind.rb
|
|
336
|
+
- lib/pindo/command/jps/config.rb
|
|
336
337
|
- lib/pindo/command/jps/download.rb
|
|
337
338
|
- lib/pindo/command/jps/login.rb
|
|
338
339
|
- lib/pindo/command/jps/media.rb
|
|
@@ -408,6 +409,7 @@ files:
|
|
|
408
409
|
- lib/pindo/module/pgyer/pgyerhelper.rb
|
|
409
410
|
- lib/pindo/module/resign/ipa_resign_adapter.rb
|
|
410
411
|
- lib/pindo/module/resign/mac_app_resign_adapter.rb
|
|
412
|
+
- lib/pindo/module/source_files_guard.rb
|
|
411
413
|
- lib/pindo/module/task/core/concurrent_execution_strategy.rb
|
|
412
414
|
- lib/pindo/module/task/core/dependency_checker.rb
|
|
413
415
|
- lib/pindo/module/task/core/execution_strategy.rb
|