pindo 5.11.4 → 5.12.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.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pindo/command/android/autobuild.rb +111 -184
  3. data/lib/pindo/command/android/build.rb +10 -2
  4. data/lib/pindo/command/ios/autobuild.rb +115 -210
  5. data/lib/pindo/command/ios/build.rb +12 -3
  6. data/lib/pindo/command/jps/upload.rb +257 -117
  7. data/lib/pindo/command/unity/autobuild.rb +308 -220
  8. data/lib/pindo/command/unity.rb +0 -3
  9. data/lib/pindo/command/utils/boss.rb +18 -15
  10. data/lib/pindo/command/utils/clearcert.rb +26 -18
  11. data/lib/pindo/command/utils/device.rb +28 -19
  12. data/lib/pindo/command/utils/feishu.rb +11 -4
  13. data/lib/pindo/command/utils/icon.rb +26 -20
  14. data/lib/pindo/command/utils/renewcert.rb +35 -29
  15. data/lib/pindo/command/utils/renewproj.rb +32 -25
  16. data/lib/pindo/command/utils/repoinit.rb +1 -1
  17. data/lib/pindo/command/utils/tag.rb +6 -180
  18. data/lib/pindo/command/utils/tgate.rb +34 -28
  19. data/lib/pindo/command/utils/xcassets.rb +30 -20
  20. data/lib/pindo/command/web/autobuild.rb +148 -128
  21. data/lib/pindo/module/android/android_build_helper.rb +0 -6
  22. data/lib/pindo/module/android/android_config_helper.rb +4 -26
  23. data/lib/pindo/module/build/build_helper.rb +18 -294
  24. data/lib/pindo/module/build/git_repo_helper.rb +519 -0
  25. data/lib/pindo/module/build/icon_downloader.rb +85 -0
  26. data/lib/pindo/module/pgyer/pgyerhelper.rb +16 -11
  27. data/lib/pindo/module/task/model/build/android_dev_build_task.rb +209 -0
  28. data/lib/pindo/module/task/model/build/android_release_build_task.rb +29 -0
  29. data/lib/pindo/module/task/model/build/ios_adhoc_build_task.rb +53 -0
  30. data/lib/pindo/module/task/model/build/ios_dev_build_task.rb +251 -0
  31. data/lib/pindo/module/task/model/build/ios_release_build_task.rb +53 -0
  32. data/lib/pindo/module/task/model/build/web_dev_build_task.rb +43 -0
  33. data/lib/pindo/module/task/model/build_task.rb +125 -301
  34. data/lib/pindo/module/task/model/git_tag_task.rb +80 -0
  35. data/lib/pindo/module/task/model/unity_export_task.rb +53 -41
  36. data/lib/pindo/module/task/model/upload_task.rb +149 -208
  37. data/lib/pindo/module/task/pindo_task.rb +135 -95
  38. data/lib/pindo/module/task/task_manager.rb +202 -352
  39. data/lib/pindo/module/unity/unity_helper.rb +7 -3
  40. data/lib/pindo/module/xcode/xcode_build_config.rb +4 -10
  41. data/lib/pindo/module/xcode/xcode_build_helper.rb +19 -0
  42. data/lib/pindo/version.rb +1 -1
  43. metadata +10 -4
  44. data/lib/pindo/command/unity/apk.rb +0 -185
  45. data/lib/pindo/command/unity/ipa.rb +0 -198
  46. data/lib/pindo/command/unity/web.rb +0 -163
@@ -355,14 +355,16 @@ module Pindo
355
355
 
356
356
  # 检查 GoodUnityBuild 版本是否满足要求
357
357
  def check_goodunitybuild_version(unity_exe_full_path, project_path)
358
+ Funlog.instance.fancyinfo_start("检查 GoodUnityBuild 版本")
359
+
358
360
  library_version = get_library_version(unity_exe_full_path: unity_exe_full_path, project_path: project_path)
359
361
 
360
362
  return unless library_version
361
363
 
362
364
  required_version = Pindoconfig.instance.pindo_user_config_json["goodunitybuild_version"]
363
365
 
364
- puts "当前使用的 GoodUnityBuild 版本: #{library_version}"
365
- puts "要求的 GoodUnityBuild 最底版本: #{required_version}"
366
+ Funlog.info("当前使用的 GoodUnityBuild 版本: #{library_version}")
367
+ Funlog.info("要求的 GoodUnityBuild 最底版本: #{required_version}")
366
368
 
367
369
  return unless required_version
368
370
 
@@ -374,10 +376,12 @@ module Pindo
374
376
  请更新 GoodUnityBuild 库到 #{required_version} 或更高版本
375
377
  MSG
376
378
  end
379
+
380
+ Funlog.instance.fancyinfo_success("GoodUnityBuild 版本检查通过")
377
381
  rescue Informative
378
382
  raise
379
383
  rescue => e
380
- puts "GoodUnityBuild 库版本检查失败: #{e.message}"
384
+ Funlog.warning("GoodUnityBuild 库版本检查失败: #{e.message}")
381
385
  end
382
386
 
383
387
  # 获取 GoodUnityBuild 库版本
@@ -2,6 +2,7 @@ require 'fileutils'
2
2
  require 'xcodeproj'
3
3
  require 'json'
4
4
  require 'pindo/module/xcode/xcode_res_helper'
5
+ require 'pindo/module/build/icon_downloader'
5
6
  require 'open-uri'
6
7
  require_relative '../../base/funlog'
7
8
 
@@ -449,16 +450,9 @@ module Pindo
449
450
  FileUtils.mkdir_p(temp_icon_dir) unless File.exist?(temp_icon_dir)
450
451
  icon_download_path = File.join(temp_icon_dir, "downloaded_icon.png")
451
452
 
452
- # 下载 icon
453
- Funlog.instance.fancyinfo_start("正在从 JPS 下载项目 Icon...")
454
- URI.open(icon_url) do |file|
455
- File.binwrite(icon_download_path, file.read)
456
- end
457
- Funlog.instance.fancyinfo_success("Icon 下载成功!")
458
-
459
- # 验证文件已下载
460
- unless File.exist?(icon_download_path)
461
- Funlog.instance.fancyinfo_error("Icon 下载失败: 文件未创建")
453
+ # 使用带重试机制的下载
454
+ unless IconDownloader.download_icon_with_retry(icon_url: icon_url, save_path: icon_download_path, max_retries: 3)
455
+ Funlog.instance.fancyinfo_error("Icon 下载失败: 已重试3次")
462
456
  return false
463
457
  end
464
458
 
@@ -8,6 +8,25 @@ module Pindo
8
8
  class XcodeBuildHelper
9
9
  class << self
10
10
 
11
+ # 删除 Unity-iPhone 项目中的 Firebase Crashlytics 脚本
12
+ def delete_libtarget_firebase_shell(project_path)
13
+ puts "[-] 开始检查并删除 Unity-iPhone下的Firebase Crashlytics脚本..."
14
+ if File.directory?(File.join(project_path, 'Unity')) && File.exist?(File.join(project_path, 'Unity', 'Unity-iPhone.xcodeproj'))
15
+ unity_project_path = File.join(project_path, 'Unity', 'Unity-iPhone.xcodeproj')
16
+ xcdoe_unitylib_project = Xcodeproj::Project::open(unity_project_path)
17
+ xcdoe_unitylib_project.targets.each do |target|
18
+ target.shell_script_build_phases&.each do |phase|
19
+ if phase.name.eql?("Crashlytics Run Script")
20
+ puts " 从target:#{target.name}中删除: #{phase.name} ..."
21
+ target.build_phases.delete(phase)
22
+ end
23
+ end
24
+ end
25
+ xcdoe_unitylib_project.save()
26
+ puts "[✔] 完成检查并删除 Unity-iPhone下的Firebase Crashlytics脚本..."
27
+ end
28
+ end
29
+
11
30
  def pull_podfile_lock(project_dir:nil, app_config_dir:nil)
12
31
  begin
13
32
  src_pod_file = File.join(app_config_dir, "Podfile.lock")
data/lib/pindo/version.rb CHANGED
@@ -6,7 +6,7 @@ require 'time'
6
6
 
7
7
  module Pindo
8
8
 
9
- VERSION = "5.11.4"
9
+ VERSION = "5.12.1"
10
10
 
11
11
  class VersionCheck
12
12
  RUBYGEMS_API = 'https://rubygems.org/api/v1/gems/pindo.json'
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.11.4
4
+ version: 5.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - wade
@@ -389,13 +389,10 @@ files:
389
389
  - lib/pindo/command/repo/search.rb
390
390
  - lib/pindo/command/setup.rb
391
391
  - lib/pindo/command/unity.rb
392
- - lib/pindo/command/unity/apk.rb
393
392
  - lib/pindo/command/unity/autobuild.rb
394
- - lib/pindo/command/unity/ipa.rb
395
393
  - lib/pindo/command/unity/packbuild.rb
396
394
  - lib/pindo/command/unity/packinit.rb
397
395
  - lib/pindo/command/unity/packpush.rb
398
- - lib/pindo/command/unity/web.rb
399
396
  - lib/pindo/command/utils.rb
400
397
  - lib/pindo/command/utils/boss.rb
401
398
  - lib/pindo/command/utils/clearcert.rb
@@ -429,6 +426,8 @@ files:
429
426
  - lib/pindo/module/appstore/appstore_metadata_fastlane_helper.rb
430
427
  - lib/pindo/module/build/build_helper.rb
431
428
  - lib/pindo/module/build/confuse_xcodeproj.rb
429
+ - lib/pindo/module/build/git_repo_helper.rb
430
+ - lib/pindo/module/build/icon_downloader.rb
432
431
  - lib/pindo/module/build/swark_helper.rb
433
432
  - lib/pindo/module/build/version_helper.rb
434
433
  - lib/pindo/module/cert/cert_helper.rb
@@ -437,7 +436,14 @@ files:
437
436
  - lib/pindo/module/cert/provisioning_helper.rb
438
437
  - lib/pindo/module/cert/xcodecerthelper.rb
439
438
  - lib/pindo/module/pgyer/pgyerhelper.rb
439
+ - lib/pindo/module/task/model/build/android_dev_build_task.rb
440
+ - lib/pindo/module/task/model/build/android_release_build_task.rb
441
+ - lib/pindo/module/task/model/build/ios_adhoc_build_task.rb
442
+ - lib/pindo/module/task/model/build/ios_dev_build_task.rb
443
+ - lib/pindo/module/task/model/build/ios_release_build_task.rb
444
+ - lib/pindo/module/task/model/build/web_dev_build_task.rb
440
445
  - lib/pindo/module/task/model/build_task.rb
446
+ - lib/pindo/module/task/model/git_tag_task.rb
441
447
  - lib/pindo/module/task/model/unity_export_task.rb
442
448
  - lib/pindo/module/task/model/upload_task.rb
443
449
  - lib/pindo/module/task/pindo_task.rb
@@ -1,185 +0,0 @@
1
- require 'highline/import'
2
- require 'xcodeproj'
3
- require 'find'
4
- require 'fileutils'
5
- require 'pindo/base/executable'
6
- require 'pindo/module/unity/unity_helper'
7
- require 'pindo/module/build/build_helper'
8
-
9
- module Pindo
10
- class Command
11
- class Unity < Command
12
- class Apk < Unity
13
- include Appselect
14
-
15
- # 命令的简要说明 - 编译Unity工程生成Android APK
16
- self.summary = 'Unity工程编译APK(优先使用pindo and autobuild命令)'
17
-
18
- # 启用缓存机制
19
- def self.use_cache?
20
- true # 此命令启用缓存
21
- end
22
-
23
- # 命令的详细说明,包含用法示例
24
- self.description = <<-DESC
25
- Unity工程编译APK(优先使用pindo and autobuild命令)
26
-
27
- 支持功能:
28
-
29
- * 自动检测Unity版本
30
-
31
- * 编译生成Android APK文件
32
-
33
- * 支持上传到JPS测试平台
34
-
35
- * 支持发送测试通知
36
-
37
- * 支持CI/CD自动化构建
38
-
39
- 使用示例:
40
-
41
- $ pindo unity apk # 编译APK
42
-
43
- $ pindo unity apk --upload # 编译并上传到JPS
44
-
45
- $ pindo unity apk --send # 编译、上传并发送通知
46
-
47
- $ pindo unity apk --proj="My App" # 指定项目名称
48
-
49
- $ pindo unity apk --base # Unity lib模式
50
- DESC
51
-
52
- # 命令的参数列表
53
- self.arguments = [
54
-
55
- ]
56
-
57
- # 命令的选项列表
58
- def self.options
59
- [
60
- ['--proj=NAME', '指定上传到测试平台的项目名称'],
61
- ['--bundle_name=NAME', '指定Android Package Name(如com.example.app,会拉取对应配置)'],
62
- ['--upload', '编译后上传到测试平台(自动发送给自己)'],
63
- ['--send', '发送通知到测试群组(同时发送给自己)']
64
- ].concat(super)
65
- end
66
-
67
- def initialize(argv)
68
-
69
- @args_proj_name = argv.option('proj')
70
- @args_bundle_name = argv.option('bundle_name')
71
- @args_upload_flag = argv.flag?('upload', false)
72
- @args_send_flag = argv.flag?('send', false)
73
-
74
- if @args_send_flag
75
- @args_upload_flag = true
76
- end
77
-
78
- super
79
- end
80
-
81
- def run
82
- pindo_project_dir = Dir.pwd
83
-
84
- # 加载 JPS 配置(如果存在)
85
- context = Pindo::PindoContext.instance
86
- context.load_and_apply_jps_config(pindo_project_dir)
87
-
88
- # 确认并应用缓存(如果有)
89
- context.confirm_and_apply_cache
90
-
91
- @main_bundle_name = nil
92
- if @args_bundle_name
93
- @main_bundle_name = @args_bundle_name
94
- else
95
- @main_bundle_name = get_selected_dev_bundle_name()
96
- end
97
-
98
-
99
- # 检查是否是Unity工程
100
- unity_helper = Pindo::Client::UnityHelper.share_instance
101
- unless unity_helper.unity_project?(pindo_project_dir)
102
- raise Informative, "当前目录不是Unity工程,请在Unity工程根目录下执行此命令"
103
- end
104
- build_helper = Pindo::BuildHelper.share_instance
105
- if @args_upload_flag
106
- is_need_add_tag,tag_action_parms = build_helper.check_is_need_add_tag?(pindo_project_dir)
107
- if is_need_add_tag
108
- Pindo::Command::Utils::Tag::run(tag_action_parms)
109
- end
110
- end
111
-
112
- project_unity_version = unity_helper.get_unity_version(pindo_project_dir)
113
- puts
114
- puts "工程的Unity版本: #{project_unity_version}"
115
- unity_exe_path = unity_helper.find_unity_path(project_unity_version:project_unity_version, force_change_version: @force_select_unity)
116
- puts "选择的Unity路径: #{unity_exe_path}"
117
- puts
118
-
119
- app_info_obj = nil
120
- workflow_info = nil
121
- proj_name = @args_proj_name
122
- # 传入 package_type 获取 workflow_info
123
- app_info_obj, workflow_info = PgyerHelper.share_instace.prepare_upload(
124
- working_directory: Dir.pwd,
125
- proj_name: proj_name,
126
- package_type: 'apk'
127
- )
128
-
129
- isLibrary = @args_base_flag
130
-
131
- android_export_lib_dir = File.join(pindo_project_dir, "GoodPlatform/BaseAndroid")
132
- if File.directory?(android_export_lib_dir)
133
- isLibrary = true
134
- end
135
-
136
- pindo_android_project_dir = File.join(pindo_project_dir, "GoodPlatform/Android")
137
- if isLibrary
138
- pindo_android_project_dir = android_export_lib_dir
139
- end
140
-
141
- # 获取 apkCount 用于传递给 Unity 构建
142
- apk_count = app_info_obj&.dig("apkCount") || -1
143
-
144
- puts "开始构建Unity项目..."
145
-
146
- begin
147
- unity_helper.build_project(
148
- unity_exe_full_path: unity_exe_path,
149
- project_path: pindo_project_dir,
150
- platform: 'Android',
151
- isLibrary: isLibrary,
152
- indexNo: apk_count
153
- )
154
- rescue => e
155
- Funlog.instance.fancyinfo_error("调用GoodUnityBuild导出工程失败!")
156
- Funlog.instance.fancyinfo_error("错误信息: #{e.message}")
157
- raise e
158
- end
159
-
160
- puts "Unity项目构建完成,准备处理Android项目..."
161
-
162
- args_temp = []
163
-
164
- # 传递 bundle_name 参数
165
- if @main_bundle_name
166
- args_temp << "--bundle_name=#{@main_bundle_name}"
167
- end
168
-
169
- if @args_upload_flag
170
- args_temp << "--proj=#{app_info_obj["projectName"]}"
171
- args_temp << "--upload"
172
- end
173
- if @args_send_flag
174
- args_temp << "--send"
175
- end
176
-
177
- Dir.chdir(pindo_android_project_dir)
178
-
179
- Pindo::Command::Android::Autobuild::run(args_temp)
180
- end
181
-
182
- end
183
- end
184
- end
185
- end
@@ -1,198 +0,0 @@
1
- require 'highline/import'
2
- require 'xcodeproj'
3
- require 'find'
4
- require 'fileutils'
5
- require 'pindo/base/executable'
6
- require 'pindo/module/unity/unity_helper'
7
- require 'pindo/module/build/build_helper'
8
- require 'pindo/base/pindocontext'
9
-
10
- module Pindo
11
- class Command
12
- class Unity < Command
13
- class Ipa < Unity
14
-
15
- include Appselect
16
-
17
- include Pindo::Githelper
18
- # Unity IPA包编译和上传命令
19
- self.summary = 'Unity工程编译IPA (优先使用pindo ios autobuild命令)'
20
-
21
- # 启用缓存机制
22
- def self.use_cache?
23
- true # 此命令启用缓存
24
- end
25
- # 缓存组已在 PindoContext#get_command_group 中定义
26
- # unity:ipa 与 ios:autobuild 共享 'ios:autobuild' 缓存组
27
-
28
- # 详细说明
29
- self.description = <<-DESC
30
- Unity工程编译IPA (优先使用pindo ios autobuild命令)
31
-
32
- 支持功能:
33
-
34
- * 自动检测Unity版本
35
-
36
- * 编译生成iOS IPA文件
37
-
38
- * 支持上传到JPS测试平台
39
-
40
- * 支持发送测试通知
41
-
42
- * 支持CI/CD自动化构建
43
-
44
- 使用示例:
45
-
46
- $ pindo unity ipa # 编译IPA
47
-
48
- $ pindo unity ipa --upload # 编译并上传到JPS
49
-
50
- $ pindo unity ipa --send # 编译、上传并发送通知
51
-
52
- $ pindo unity ipa --bundleid=com.example.app # 指定Bundle ID
53
-
54
- $ pindo unity ipa --proj="My App" # 指定项目名称
55
-
56
- $ pindo unity ipa --base # Unity lib模式
57
- DESC
58
-
59
- # 命令参数
60
- self.arguments = [
61
- # 暂无参数
62
- ]
63
-
64
- # 命令选项
65
- def self.options
66
- [
67
- ['--bundleid=ID', '指定打包的Bundle ID'],
68
- ['--proj=NAME', '指定上传到测试平台的项目名称'],
69
- ['--upload', '编译后上传到测试平台(上传成功后自动发送给自己)'],
70
- ['--send', '发送通知到测试群组(同时也会发送给自己)'],
71
- ['--base', 'Unity工程编译lib模式'],
72
- ['--unity-version', '强制选择Unity版本'],
73
- ['--deploy', '使用发布证书打包']
74
- ].concat(super)
75
- end
76
-
77
-
78
- def initialize(argv)
79
-
80
- @args_proj_name = argv.option('proj')
81
- @args_upload_flag = argv.flag?('upload', false)
82
- @args_send_flag = argv.flag?('send', false)
83
- @args_deploy_flag = argv.flag?('deploy', false)
84
- @args_base_flag = argv.flag?('base', false)
85
- @force_select_unity = argv.flag?('unity-version', false)
86
- @args_bundle_id = argv.option('bundleid')
87
-
88
- if @args_send_flag
89
- @args_upload_flag = true
90
- end
91
-
92
- super
93
- end
94
-
95
-
96
- def run
97
- pindo_project_dir = Dir.pwd
98
-
99
- # 加载 JPS 配置(如果存在)
100
- context = Pindo::PindoContext.instance
101
- context.load_and_apply_jps_config(pindo_project_dir)
102
-
103
- # 确认并应用缓存(如果有)
104
- context.confirm_and_apply_cache
105
-
106
-
107
- @mainapp_bundleid= nil
108
- if @args_bundle_id
109
- @mainapp_bundleid = @args_bundle_id
110
- else
111
- if @args_deploy_flag
112
- @mainapp_bundleid = get_selected_deploy_bundleid()
113
- else
114
- @mainapp_bundleid = get_selected_dev_bundleid()
115
- end
116
- end
117
-
118
-
119
-
120
- # 检查是否是Unity工程
121
- unity_helper = Pindo::Client::UnityHelper.share_instance
122
- unless unity_helper.unity_project?(pindo_project_dir)
123
- raise Informative, "当前目录不是Unity工程,请在Unity工程根目录下执行此命令"
124
- end
125
-
126
- build_helper = Pindo::BuildHelper.share_instance
127
- if @args_upload_flag
128
- is_need_add_tag,tag_action_parms = build_helper.check_is_need_add_tag?(pindo_project_dir)
129
- if is_need_add_tag
130
- Pindo::Command::Utils::Tag::run(tag_action_parms)
131
- end
132
- end
133
-
134
- project_unity_version = unity_helper.get_unity_version(pindo_project_dir)
135
- puts
136
- puts "工程的Unity版本: #{project_unity_version}"
137
- unity_exe_path = unity_helper.find_unity_path(project_unity_version:project_unity_version, force_change_version: @force_select_unity)
138
- puts "选择的Unity路径: #{unity_exe_path}"
139
- puts
140
-
141
- app_info_obj = nil
142
- workflow_info = nil
143
- proj_name = @args_proj_name
144
- # 传入 package_type 获取 workflow_info
145
- app_info_obj, workflow_info = PgyerHelper.share_instace.prepare_upload(
146
- working_directory: Dir.pwd,
147
- proj_name: proj_name,
148
- package_type: 'ipa'
149
- )
150
-
151
- isLibrary = @args_base_flag
152
-
153
- ios_export_lib_dir = File.join(pindo_project_dir, "GoodPlatform/BaseiOS")
154
- if File.directory?(ios_export_lib_dir)
155
- isLibrary = true
156
- end
157
-
158
- pindo_ios_project_dir = File.join(pindo_project_dir, "GoodPlatform/iOS")
159
- if isLibrary
160
- pindo_ios_project_dir = ios_export_lib_dir
161
- end
162
-
163
- # 获取 ipaCount 用于传递给 Unity 构建
164
- ipa_count = app_info_obj&.dig("ipaCount") || -1
165
-
166
- begin
167
- unity_helper.build_project(unity_exe_full_path:unity_exe_path, project_path:pindo_project_dir, platform:'iOS', isLibrary:isLibrary, indexNo:ipa_count)
168
- rescue => e
169
- Funlog.instance.fancyinfo_error("调用GoodUnityBuild导出工程失败!")
170
- Funlog.instance.fancyinfo_error("错误信息: #{e.message}")
171
- raise e
172
- end
173
-
174
-
175
- args_temp = []
176
- args_temp << "--bundleid=#{@mainapp_bundleid}"
177
-
178
- if @args_upload_flag
179
- args_temp << "--proj=#{app_info_obj["projectName"]}"
180
- args_temp << "--upload"
181
- end
182
- if @args_send_flag
183
- args_temp << "--send"
184
- end
185
-
186
-
187
- Dir.chdir(pindo_ios_project_dir)
188
-
189
- Pindo::Command::Ios::Autobuild::run(args_temp)
190
-
191
-
192
- end
193
-
194
-
195
- end
196
- end
197
- end
198
- end