pindo 5.17.5 → 5.18.4

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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pindo/base/git_handler.rb +120 -38
  3. data/lib/pindo/command/android/autobuild.rb +81 -40
  4. data/lib/pindo/command/appstore/adhocbuild.rb +1 -1
  5. data/lib/pindo/command/appstore/autobuild.rb +1 -1
  6. data/lib/pindo/command/appstore/autoresign.rb +1 -1
  7. data/lib/pindo/command/appstore/updateid.rb +229 -0
  8. data/lib/pindo/command/appstore.rb +1 -0
  9. data/lib/pindo/command/ios/autobuild.rb +70 -33
  10. data/lib/pindo/command/ios/podpush.rb +1 -1
  11. data/lib/pindo/command/jps/apptest.rb +2 -2
  12. data/lib/pindo/command/jps/bind.rb +1 -1
  13. data/lib/pindo/command/jps/media.rb +1 -1
  14. data/lib/pindo/command/jps/upload.rb +52 -22
  15. data/lib/pindo/command/unity/autobuild.rb +61 -44
  16. data/lib/pindo/command/utils/allcopyconfig.rb +144 -0
  17. data/lib/pindo/command/utils/copyconfig.rb +207 -0
  18. data/lib/pindo/command/utils/icon.rb +2 -2
  19. data/lib/pindo/command/utils/renewbundleid.rb +199 -0
  20. data/lib/pindo/command/utils/renewcert.rb +56 -54
  21. data/lib/pindo/command/utils.rb +3 -0
  22. data/lib/pindo/command/web/autobuild.rb +32 -26
  23. data/lib/pindo/config/build_info_manager.rb +1 -3
  24. data/lib/pindo/module/android/android_build_helper.rb +193 -33
  25. data/lib/pindo/module/android/android_config_helper.rb +305 -88
  26. data/lib/pindo/module/android/android_project_helper.rb +69 -14
  27. data/lib/pindo/module/android/android_res_helper.rb +349 -51
  28. data/lib/pindo/module/android/keystore_helper.rb +611 -295
  29. data/lib/pindo/module/android/workflow_gradle_injector.rb +702 -0
  30. data/lib/pindo/module/appselect.rb +4 -4
  31. data/lib/pindo/module/appstore/bundleid_helper.rb +204 -14
  32. data/lib/pindo/module/build/build_helper.rb +110 -10
  33. data/lib/pindo/module/build/git_repo_helper.rb +4 -4
  34. data/lib/pindo/module/cert/mode/base_cert_operator.rb +8 -6
  35. data/lib/pindo/module/pgyer/pgyerhelper.rb +105 -42
  36. data/lib/pindo/module/task/core/task_executor.rb +2 -0
  37. data/lib/pindo/module/task/model/build/android_build_dev_task.rb +64 -6
  38. data/lib/pindo/module/task/model/git/git_commit_task.rb +70 -54
  39. data/lib/pindo/module/task/model/git/git_tag_task.rb +13 -9
  40. data/lib/pindo/module/task/model/jps/jps_upload_task.rb +104 -1
  41. data/lib/pindo/module/task/model/unity/unity_export_task.rb +2 -1
  42. data/lib/pindo/module/task/model/unity/unity_update_task.rb +2 -1
  43. data/lib/pindo/module/task/model/unity/unity_yoo_asset_task.rb +2 -1
  44. data/lib/pindo/module/task/model/unity_task.rb +2 -1
  45. data/lib/pindo/module/task/task_manager.rb +8 -0
  46. data/lib/pindo/module/unity/unity_helper.rb +13 -10
  47. data/lib/pindo/module/unity/unity_proc_helper.rb +27 -2
  48. data/lib/pindo/module/xcode/applovin_xcode_helper.rb +4 -2
  49. data/lib/pindo/module/xcode/res/xcode_res_constant.rb +72 -0
  50. data/lib/pindo/module/xcode/xcode_build_config.rb +36 -17
  51. data/lib/pindo/module/xcode/xcode_build_helper.rb +180 -23
  52. data/lib/pindo/module/xcode/xcode_project_helper.rb +1 -1
  53. data/lib/pindo/module/xcode/xcode_res_helper.rb +32 -16
  54. data/lib/pindo/options/groups/build_options.rb +16 -5
  55. data/lib/pindo/options/groups/git_options.rb +7 -5
  56. data/lib/pindo/options/groups/unity_options.rb +11 -0
  57. data/lib/pindo/options/helpers/bundleid_selector.rb +25 -0
  58. data/lib/pindo/options/helpers/git_constants.rb +7 -6
  59. data/lib/pindo/version.rb +2 -2
  60. metadata +10 -5
@@ -0,0 +1,199 @@
1
+ require 'fileutils'
2
+ require 'json'
3
+ require 'spaceship'
4
+ require 'pindo/module/appstore/bundleid_helper'
5
+ require 'pindo/base/git_handler'
6
+ require 'pindo/config/build_info_manager'
7
+
8
+ module Pindo
9
+ class Command
10
+ class Utils < Command
11
+ class Renewbundleid < Utils
12
+
13
+ include Appselect
14
+
15
+ self.summary = '从Apple开发者中心同步所有bundle id的capabilities到config.json'
16
+
17
+ self.description = <<-DESC
18
+ 从Apple Developer Portal读取当前账号下所有Bundle ID的Capability状态,
19
+ 写入各项目config.json的capabilities字段并提交到Git仓库。
20
+
21
+ 支持功能:
22
+
23
+ * 批量读取所有Bundle ID的Capability状态
24
+
25
+ * 自动识别App Group、iCloud容器的关联ID
26
+
27
+ * 将capabilities写入config.json并提交到Git仓库
28
+
29
+ * 支持dry-run预览模式
30
+
31
+ 使用示例:
32
+
33
+ $ pindo utils renewbundleid # 同步所有bundle id的capabilities
34
+
35
+ $ pindo utils renewbundleid --dry-run # 预览模式,不修改文件
36
+
37
+ 注意事项:
38
+
39
+ * 确保已登录Apple Developer账号
40
+
41
+ * 该操作会修改所有相关项目的config.json
42
+ DESC
43
+
44
+ self.arguments = []
45
+
46
+ def self.options
47
+ [
48
+ ['--dry-run', '预览模式,只显示差异不修改文件']
49
+ ].concat(super)
50
+ end
51
+
52
+ def initialize(argv)
53
+ @dry_run = argv.flag?('dry-run', false)
54
+ super
55
+ end
56
+
57
+ def run
58
+ @dev_bundle_id_array = all_dev_bundleid()
59
+ @tool_bundle_id_array = all_tool_bundleid()
60
+ @deploy_bundle_id_array = all_release_bundleid()
61
+ all_bundle_ids = @dev_bundle_id_array + @deploy_bundle_id_array + @tool_bundle_id_array
62
+
63
+ puts "共 #{all_bundle_ids.length} 个 Bundle ID 需要处理"
64
+ puts
65
+
66
+ # 只登录一次
67
+ first_config = load_first_config(all_bundle_ids)
68
+ if first_config.nil?
69
+ puts "无法加载任何 config.json,退出"
70
+ return
71
+ end
72
+
73
+ apple_id = first_config.dig('account_info', 'apple_acount_id')
74
+ if apple_id.nil? || apple_id.empty? || apple_id.include?("__________")
75
+ puts "config.json 中缺少有效的 Apple ID"
76
+ return
77
+ end
78
+
79
+ puts "Login #{apple_id}..."
80
+ Spaceship.login(apple_id.to_s)
81
+ Spaceship.select_team
82
+ puts
83
+
84
+ success_count = 0
85
+ fail_count = 0
86
+ skip_count = 0
87
+
88
+ all_bundle_ids.each do |bundle_id|
89
+ if bundle_id.include?("*")
90
+ bundle_id = bundle_id.gsub(".*", "")
91
+ end
92
+
93
+ begin
94
+ result = update_bundleid_capabilities(bundle_id: bundle_id)
95
+ case result
96
+ when :success then success_count += 1
97
+ when :skip then skip_count += 1
98
+ end
99
+ rescue => err
100
+ puts " #{bundle_id} — 失败: #{err.message}"
101
+ fail_count += 1
102
+ end
103
+ end
104
+
105
+ puts
106
+ puts "完成: #{success_count} 成功, #{fail_count} 失败, #{skip_count} 跳过"
107
+ end
108
+
109
+ private
110
+
111
+ def load_first_config(bundle_ids)
112
+ bundle_ids.each do |bundle_id|
113
+ bid = bundle_id.include?("*") ? bundle_id.gsub(".*", "") : bundle_id
114
+ begin
115
+ app_config_dir = Pindo::GitHandler.clong_buildconfig_repo(repo_name: bid)
116
+ config_file = File.join(app_config_dir, "config.json")
117
+ if File.exist?(config_file)
118
+ return JSON.parse(File.read(config_file))
119
+ end
120
+ rescue
121
+ next
122
+ end
123
+ end
124
+ nil
125
+ end
126
+
127
+ def update_bundleid_capabilities(bundle_id: nil)
128
+ # 获取 config 仓库目录
129
+ app_config_dir = Pindo::GitHandler.clong_buildconfig_repo(repo_name: bundle_id)
130
+ config_file = File.join(app_config_dir, "config.json")
131
+
132
+ unless File.exist?(config_file)
133
+ puts " #{bundle_id} — config.json 不存在,跳过"
134
+ return :skip
135
+ end
136
+
137
+ config_json = JSON.parse(File.read(config_file))
138
+ app_info = config_json['app_info']
139
+
140
+ if app_info.nil? || app_info['app_identifier'].nil? || app_info['app_identifier'].empty?
141
+ puts " #{bundle_id} — 缺少 app_identifier,跳过"
142
+ return :skip
143
+ end
144
+
145
+ main_bundle_id = app_info['app_identifier']
146
+ puts "读取 #{main_bundle_id} 的 Capability..."
147
+
148
+ capabilities = Pindo::BundleIdHelper.fetch_capabilities_from_portal(bundle_id: main_bundle_id)
149
+
150
+ if capabilities.nil?
151
+ puts " #{main_bundle_id} — Portal 中未找到,跳过"
152
+ return :skip
153
+ end
154
+
155
+ # 显示 capabilities
156
+ capabilities.each do |key, value|
157
+ puts " #{key}: #{value.is_a?(String) ? "\"#{value}\"" : value}"
158
+ end
159
+
160
+ if @dry_run
161
+ old_capabilities = app_info['capabilities'] || {}
162
+ has_diff = false
163
+ capabilities.each do |key, new_value|
164
+ old_value = old_capabilities[key]
165
+ if old_value.nil?
166
+ puts " + #{key}: #{new_value.is_a?(String) ? "\"#{new_value}\"" : new_value}"
167
+ has_diff = true
168
+ elsif old_value != new_value
169
+ puts " ~ #{key}: #{old_value} -> #{new_value}"
170
+ has_diff = true
171
+ end
172
+ end
173
+ puts " (无差异)" unless has_diff
174
+ puts
175
+ return :success
176
+ end
177
+
178
+ # 写入 config.json
179
+ config_json['app_info']['capabilities'] = capabilities
180
+ File.open(config_file, "w") do |f|
181
+ f.write(JSON.pretty_generate(config_json) + "\n")
182
+ end
183
+
184
+ # 提交到 Git 仓库
185
+ Pindo::GitHandler.git_addpush_repo(
186
+ path: app_config_dir,
187
+ message: "sync capabilities from Apple Developer Portal",
188
+ commit_file_params: ["config.json"]
189
+ )
190
+
191
+ puts " #{main_bundle_id} — capabilities 已同步"
192
+ puts
193
+ :success
194
+ end
195
+
196
+ end
197
+ end
198
+ end
199
+ end
@@ -83,8 +83,8 @@ module Pindo
83
83
 
84
84
  fixed_bundleid_array.each do |bundle_id|
85
85
  # begin
86
- if bundle_id.eql?("com.heroneverdie101.*")
87
- bundle_id = "com.heroneverdie101"
86
+ if bundle_id.include?("*")
87
+ bundle_id = bundle_id.gsub(".*", "")
88
88
  end
89
89
  fixed_cert(bundle_id:bundle_id, renew_flag:@renew_cert_flag, upload_flag:@upload_flag, fixed_bundleid_flag:@fixedid_flag)
90
90
  # rescue => err
@@ -123,58 +123,60 @@ module Pindo
123
123
  )
124
124
  end
125
125
 
126
- if @fast_flag
127
-
128
- if @dev_bundle_id_array.include?(bundle_id) || @tool_bundle_id_array.include?(bundle_id)
129
- args_temp = []
130
- args_temp << "--config=#{config_file_path}"
131
- args_temp << "--build_type=dev"
132
- if renew_flag
133
- args_temp << "--renew"
134
- end
135
- if upload_flag
136
- args_temp << "--upload"
137
- end
138
- Pindo::Command::Appstore::Cert::run(args_temp)
139
- end
140
-
141
- if @deploy_bundle_id_array.include?(bundle_id)
142
- args_temp = []
143
- args_temp << "--config=#{config_file_path}"
144
- args_temp << "--build_type=adhoc"
145
- if renew_flag
146
- args_temp << "--renew"
147
- end
148
- if upload_flag
149
- args_temp << "--upload"
150
- end
151
- Pindo::Command::Appstore::Cert::run(args_temp)
152
- end
153
-
154
- else
155
-
156
- args_temp = []
157
- args_temp << "--config=#{config_file_path}"
158
- args_temp << "--build_type=dev"
159
- if renew_flag
160
- args_temp << "--renew"
161
- end
162
- if upload_flag
163
- args_temp << "--upload"
164
- end
165
- Pindo::Command::Appstore::Cert::run(args_temp)
166
-
167
- args_temp = []
168
- args_temp << "--config=#{config_file_path}"
169
- args_temp << "--build_type=adhoc"
170
- if renew_flag
171
- args_temp << "--renew"
172
- end
173
- if upload_flag
174
- args_temp << "--upload"
175
- end
176
- Pindo::Command::Appstore::Cert::run(args_temp)
177
- end
126
+ Pindo::Command::Appstore::Bundleid::run([])
127
+
128
+ # if @fast_flag
129
+
130
+ # if @dev_bundle_id_array.include?(bundle_id) || @tool_bundle_id_array.include?(bundle_id)
131
+ # args_temp = []
132
+ # args_temp << "--config=#{config_file_path}"
133
+ # args_temp << "--build_type=dev"
134
+ # if renew_flag
135
+ # args_temp << "--renew"
136
+ # end
137
+ # if upload_flag
138
+ # args_temp << "--upload"
139
+ # end
140
+ # Pindo::Command::Appstore::Cert::run(args_temp)
141
+ # end
142
+
143
+ # if @deploy_bundle_id_array.include?(bundle_id)
144
+ # args_temp = []
145
+ # args_temp << "--config=#{config_file_path}"
146
+ # args_temp << "--build_type=adhoc"
147
+ # if renew_flag
148
+ # args_temp << "--renew"
149
+ # end
150
+ # if upload_flag
151
+ # args_temp << "--upload"
152
+ # end
153
+ # Pindo::Command::Appstore::Cert::run(args_temp)
154
+ # end
155
+
156
+ # else
157
+
158
+ # args_temp = []
159
+ # args_temp << "--config=#{config_file_path}"
160
+ # args_temp << "--build_type=dev"
161
+ # if renew_flag
162
+ # args_temp << "--renew"
163
+ # end
164
+ # if upload_flag
165
+ # args_temp << "--upload"
166
+ # end
167
+ # Pindo::Command::Appstore::Cert::run(args_temp)
168
+
169
+ # args_temp = []
170
+ # args_temp << "--config=#{config_file_path}"
171
+ # args_temp << "--build_type=adhoc"
172
+ # if renew_flag
173
+ # args_temp << "--renew"
174
+ # end
175
+ # if upload_flag
176
+ # args_temp << "--upload"
177
+ # end
178
+ # Pindo::Command::Appstore::Cert::run(args_temp)
179
+ # end
178
180
  end
179
181
 
180
182
 
@@ -7,6 +7,9 @@ require 'pindo/command/utils/device'
7
7
  # require 'pindo/command/utils/tgate'
8
8
  # require 'pindo/command/utils/boss'
9
9
  require 'pindo/command/utils/renewcert'
10
+ require 'pindo/command/utils/renewbundleid'
11
+ require 'pindo/command/utils/copyconfig'
12
+ require 'pindo/command/utils/allcopyconfig'
10
13
  require 'pindo/command/utils/repoinit'
11
14
  require 'pindo/command/utils/tag'
12
15
  require 'pindo/command/utils/updateconfig'
@@ -154,31 +154,35 @@ module Pindo
154
154
  def run
155
155
  pindo_project_dir = Dir.pwd
156
156
 
157
- # 加载 JPS 配置(如果存在)
158
- Pindo::BuildHelper.share_instance.load_jps_build_config(pindo_project_dir)
157
+ begin
158
+ # 加载 JPS 配置(如果存在)
159
+ Pindo::BuildHelper.share_instance.load_jps_build_config(pindo_project_dir, conf: @args_conf)
159
160
 
160
- # 准备配置
161
- config = prepare_web_config(pindo_project_dir)
161
+ # 准备配置
162
+ config = prepare_web_config(pindo_project_dir)
162
163
 
163
- # 创建并执行任务
164
- tasks = make_build_task(config)
164
+ # 创建并执行任务
165
+ tasks = make_build_task(config)
165
166
 
166
- # 添加到任务管理器并执行
167
- task_manager = Pindo::TaskSystem::TaskManager.instance
168
- task_manager.clear_all
169
- tasks.each { |task| task_manager.add_task(task) }
167
+ # 添加到任务管理器并执行
168
+ task_manager = Pindo::TaskSystem::TaskManager.instance
169
+ task_manager.clear_all
170
+ tasks.each { |task| task_manager.add_task(task) }
170
171
 
171
- # 执行任务(根据 --multi 参数决定模式)
172
- if @args_multi_flag
173
- task_manager.start(mode: :concurrent, max_workers: 3)
174
- else
175
- task_manager.start
176
- end
172
+ # 执行任务(根据 --multi 参数决定模式)
173
+ if @args_multi_flag
174
+ task_manager.start(mode: :concurrent, max_workers: 3)
175
+ else
176
+ task_manager.start
177
+ end
177
178
 
178
- system "open #{pindo_project_dir}"
179
+ system "open #{pindo_project_dir}"
179
180
 
180
- # 可选运行 WebGL
181
- Pindo::Command::Web::Run.run([]) if @args_run_flag
181
+ # 可选运行 WebGL
182
+ Pindo::Command::Web::Run.run([]) if @args_run_flag
183
+ ensure
184
+ Pindo::Options::GlobalOptionsState.instance.clear
185
+ end
182
186
  end
183
187
 
184
188
  private
@@ -270,12 +274,14 @@ module Pindo
270
274
  )
271
275
  tasks << git_commit_task
272
276
 
273
- # 2. Git 标签任务(总是创建,依赖提交任务,在 Unity 导出之前创建)
274
- # 所有参数都从 GitCommitTask 获取
275
- git_tag_task = Pindo::TaskSystem::GitTagTask.new(config[:project_path])
276
- git_tag_task.dependencies << git_commit_task.id
277
- tasks << git_tag_task
278
- last_task = git_tag_task
277
+ # 2. Git 标签任务(skip_without_tag 模式下不创建)
278
+ git_tag_task = nil
279
+ unless process_type == Pindo::UncommittedFilesProcessType::SKIP_WITHOUT_TAG
280
+ git_tag_task = Pindo::TaskSystem::GitTagTask.new(config[:project_path])
281
+ git_tag_task.dependencies << git_commit_task.id
282
+ tasks << git_tag_task
283
+ last_task = git_tag_task
284
+ end
279
285
 
280
286
  # 3. Unity 更新必备库任务(可选)
281
287
  unless @args_skip_lib
@@ -417,7 +423,7 @@ module Pindo
417
423
  )
418
424
  # 依赖 Git Commit、Git Tag 和 Bind Package 任务
419
425
  workflow_message_task.dependencies << git_commit_task.id
420
- workflow_message_task.dependencies << git_tag_task.id
426
+ workflow_message_task.dependencies << git_tag_task.id if git_tag_task
421
427
  workflow_message_task.dependencies << bind_package_task.id
422
428
  tasks << workflow_message_task
423
429
  end
@@ -174,9 +174,7 @@ module Pindo
174
174
  end
175
175
  end
176
176
 
177
- private
178
-
179
- # 修改仓库设置(测试环境)
177
+ # 将仓库注册到 git_base_url.json,指定其所属 org
180
178
  def modify_repo_setting(repo_name:, owner_org:)
181
179
  pindo_setting_dir = pindo_single_config.pindo_env_configdir
182
180
  git_repo_file = pindo_single_config.git_base_url_fullname