pindo 5.11.3 → 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
@@ -0,0 +1,209 @@
1
+ require_relative '../build_task'
2
+ require 'pindo/module/build/build_helper'
3
+ require 'pindo/module/build/version_helper'
4
+ require 'pindo/module/build/git_repo_helper'
5
+ require 'pindo/module/android/android_config_helper'
6
+ require 'pindo/module/android/android_build_helper'
7
+ require 'pindo/module/pgyer/pgyerhelper'
8
+ require 'pindo/base/githelper'
9
+
10
+ module Pindo
11
+ module TaskSystem
12
+ # Android Dev 模式构建任务
13
+ # 使用 Debug 模式编译 Android 工程
14
+ class AndroidDevBuildTask < BuildTask
15
+ include Pindo::Githelper
16
+ def initialize(options = {})
17
+ @bundle_name = options[:bundle_name]
18
+ @proj_name = options[:proj_name]
19
+ @upload_flag = options[:upload] || false
20
+ @send_flag = options[:send] || false
21
+
22
+ # 接收外部传入的 JPS 配置
23
+ @app_info_obj = options[:app_info_obj]
24
+ @workflow_info = options[:workflow_info]
25
+
26
+ super(:android, :dev, options)
27
+ end
28
+
29
+ protected
30
+
31
+ def build_task_name
32
+ "构建 APK (Debug)"
33
+ end
34
+
35
+ def prepare_build
36
+ # 校验必需的参数
37
+ Dir.chdir(@project_path)
38
+ validate_workflow_info
39
+ check_git_tag if @upload_flag
40
+ update_project_config
41
+ update_version_info
42
+ handle_bundle_name_config if @bundle_name
43
+ add_application_id_scheme
44
+ end
45
+
46
+ def execute_build
47
+ build_android_project
48
+ end
49
+
50
+ def find_output
51
+ # 搜索 APK 和 AAB 文件
52
+ search_paths = []
53
+ search_paths.concat(TaskConfig::BUILD_OUTPUT_PATTERNS[:apk].map { |p| File.join(@project_path, p) })
54
+ search_paths.concat(TaskConfig::BUILD_OUTPUT_PATTERNS[:aab].map { |p| File.join(@project_path, p) })
55
+
56
+ package_files = []
57
+ search_paths.each do |pattern|
58
+ package_files.concat(Dir.glob(pattern))
59
+ end
60
+
61
+ # 过滤测试包和未签名包
62
+ package_files.reject! do |f|
63
+ basename = File.basename(f).downcase
64
+ TaskConfig::EXCLUDED_PATTERNS.any? { |pattern| basename.include?(pattern) }
65
+ end
66
+
67
+ if package_files.any?
68
+ # 优先返回 AAB,其次 APK
69
+ aab_files = package_files.select { |f| f.end_with?(".aab") }
70
+ apk_files = package_files.select { |f| f.end_with?(".apk") }
71
+
72
+ latest_package = if aab_files.any?
73
+ aab_files.max_by { |f| File.mtime(f) }
74
+ elsif apk_files.any?
75
+ apk_files.max_by { |f| File.mtime(f) }
76
+ else
77
+ package_files.max_by { |f| File.mtime(f) }
78
+ end
79
+
80
+ puts " 找到 Android 包文件: #{latest_package}"
81
+ latest_package
82
+ else
83
+ puts " 警告: 未找到 APK/AAB 文件"
84
+ nil
85
+ end
86
+ end
87
+
88
+ private
89
+
90
+ # 校验工作流信息
91
+ def validate_workflow_info
92
+ unless @workflow_info && @workflow_info[:package_name]
93
+ raise Informative, "未提供工作流信息,请在创建任务时传入 workflow_info 参数"
94
+ end
95
+ end
96
+
97
+ # Git 标签检查
98
+ def check_git_tag
99
+ git_repo_helper = Pindo::GitRepoHelper.share_instance
100
+ is_need_add_tag, tag_action_params = git_repo_helper.check_is_need_add_tag?(@project_path)
101
+ if is_need_add_tag
102
+ git_repo_helper.create_and_push_tag(
103
+ project_dir: @project_path,
104
+ mode: 'minor',
105
+ force_retag: tag_action_params&.include?('--retag') || false,
106
+ custom_tag: nil,
107
+ release_branch: 'master'
108
+ )
109
+ end
110
+ end
111
+
112
+ # 更新工程配置
113
+ def update_project_config
114
+ workflow_packname = @workflow_info[:package_name]
115
+
116
+ puts "\n使用工作流配置更新 Android 项目:"
117
+ puts " Workflow Package Name: #{workflow_packname}"
118
+
119
+ # 更新 App Name、Application ID 和 URL Schemes
120
+ Pindo::AndroidConfigHelper.update_project_with_workflow(
121
+ project_dir: @project_path,
122
+ workflow_packname: workflow_packname
123
+ )
124
+
125
+ # 下载并替换 Icon
126
+ if @app_info_obj && @app_info_obj["projectIcon"] && !@app_info_obj["projectIcon"].empty?
127
+ icon_replace_success = Pindo::AndroidConfigHelper.download_and_replace_icon_from_url(
128
+ project_dir: @project_path,
129
+ icon_url: @app_info_obj["projectIcon"]
130
+ )
131
+
132
+ unless icon_replace_success
133
+ raise Informative, "Icon 下载或替换失败,请检查 Icon URL 是否有效: #{@app_info_obj["projectIcon"]}"
134
+ end
135
+ else
136
+ Funlog.warning("未配置 Icon URL,跳过 Icon 替换")
137
+ end
138
+ end
139
+
140
+ # 更新版本号
141
+ def update_version_info
142
+ version_helper = Pindo::VersionHelper.share_instance
143
+ version_info = version_helper.get_version_info(project_dir: @project_path)
144
+
145
+ if version_info[:is_git_repo]
146
+ Pindo::AndroidConfigHelper.update_android_project_version(
147
+ project_dir: @project_path,
148
+ version_name: version_info[:version],
149
+ version_code: version_info[:build_number]
150
+ )
151
+ else
152
+ Funlog.warning("非Git仓库,保持工程原有版本号")
153
+ end
154
+ end
155
+
156
+ # 处理 Bundle Name 特殊配置
157
+ def handle_bundle_name_config
158
+ return unless @bundle_name && !@bundle_name.empty?
159
+
160
+ puts "\n正在处理指定的 Bundle Name: #{@bundle_name}..."
161
+
162
+ # 检查是否为通配符
163
+ is_wildcard = @bundle_name.include?('*') ||
164
+ @bundle_name.end_with?('.') ||
165
+ ['com.test', 'com.example', 'com.demo'].include?(@bundle_name)
166
+
167
+ if is_wildcard
168
+ puts " ⚠️ 检测到通配符或通用 Bundle Name: #{@bundle_name}"
169
+ puts " ⚠️ 跳过 google-services.json 和 Application ID 更新"
170
+ else
171
+ # 拉取配置仓库
172
+ config_repo_dir = clong_buildconfig_repo(repo_name: @bundle_name)
173
+
174
+ if config_repo_dir && File.exist?(config_repo_dir)
175
+ # 拷贝 google-services.json
176
+ Pindo::AndroidConfigHelper.copy_google_services_from_config_repo(
177
+ config_repo_dir: config_repo_dir,
178
+ project_dir: @project_path
179
+ )
180
+
181
+ # 更新 Application ID
182
+ Pindo::AndroidConfigHelper.update_application_id(
183
+ project_dir: @project_path,
184
+ application_id: @bundle_name
185
+ )
186
+
187
+ puts " ✓ Bundle Name 配置处理完成"
188
+ else
189
+ raise Informative, "无法获取配置仓库"
190
+ end
191
+ end
192
+ end
193
+
194
+ # 添加基于 Application ID 的 Scheme
195
+ def add_application_id_scheme
196
+ Pindo::AndroidConfigHelper.add_application_id_based_scheme(
197
+ project_dir: @project_path
198
+ )
199
+ end
200
+
201
+ # 构建 Android 工程
202
+ def build_android_project
203
+ android_build_helper = Pindo::AndroidBuildHelper.share_instance
204
+ # 第二个参数 true 表示 debug 模式
205
+ android_build_helper.auto_build_apk(@project_path, true)
206
+ end
207
+ end
208
+ end
209
+ end
@@ -0,0 +1,29 @@
1
+ require_relative 'android_dev_build_task'
2
+
3
+ module Pindo
4
+ module TaskSystem
5
+ # Android Release 模式构建任务
6
+ # 使用 Release 模式编译 Android 工程
7
+ class AndroidReleaseBuildTask < AndroidDevBuildTask
8
+ def initialize(options = {})
9
+ super(options)
10
+ @mode = :release
11
+ end
12
+
13
+ protected
14
+
15
+ def build_task_name
16
+ "构建 APK (Release)"
17
+ end
18
+
19
+ private
20
+
21
+ # 构建 Android 工程(覆盖父类方法)
22
+ def build_android_project
23
+ android_build_helper = Pindo::AndroidBuildHelper.share_instance
24
+ # 第二个参数 false 表示 release 模式
25
+ android_build_helper.auto_build_apk(@project_path, false)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,53 @@
1
+ require_relative 'ios_dev_build_task'
2
+
3
+ module Pindo
4
+ module TaskSystem
5
+ # iOS AdHoc 模式构建任务
6
+ # 使用 AdHoc 证书编译 iOS 工程
7
+ class IosAdhocBuildTask < IosDevBuildTask
8
+ def initialize(options = {})
9
+ super(options)
10
+ @mode = :adhoc
11
+ end
12
+
13
+ protected
14
+
15
+ def build_task_name
16
+ "构建 IPA (AdHoc)"
17
+ end
18
+
19
+ private
20
+
21
+ # 配置证书(覆盖父类方法)
22
+ def configure_certificate
23
+ detect_macos_platform
24
+
25
+ args_temp = ['--adhoc']
26
+ args_temp << '--macos' if @macos_flag
27
+
28
+ # 如果有 Unity 根目录路径,需要从那里读取 config.json
29
+ if @unity_root_path
30
+ config_path = File.join(@unity_root_path, 'config.json')
31
+ if File.exist?(config_path)
32
+ args_temp << config_path
33
+ end
34
+ end
35
+
36
+ # 切换到 iOS 工程目录,确保 Cert::run 能找到 xcodeproj
37
+ Dir.chdir(@project_path) do
38
+ Pindo::Command::Deploy::Cert::run(args_temp)
39
+ end
40
+ end
41
+
42
+ # 编译 iOS 工程(覆盖父类方法)
43
+ def build_ios_project
44
+ Dir.chdir(@project_path)
45
+
46
+ args_temp = ['--adhoc']
47
+ args_temp << '--macos' if @macos_flag
48
+
49
+ Pindo::Command::Deploy::Build::run(args_temp)
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,251 @@
1
+ require_relative '../build_task'
2
+ require 'pindo/module/build/build_helper'
3
+ require 'pindo/module/build/version_helper'
4
+ require 'pindo/module/build/git_repo_helper'
5
+ require 'pindo/module/xcode/xcode_build_config'
6
+ require 'pindo/module/xcode/xcode_build_helper'
7
+ require 'pindo/module/pgyer/pgyerhelper'
8
+
9
+ module Pindo
10
+ module TaskSystem
11
+ # iOS Dev 模式构建任务
12
+ # 使用 Development 证书编译 iOS 工程
13
+ class IosDevBuildTask < BuildTask
14
+ def initialize(options = {})
15
+ @bundle_id = options[:bundle_id]
16
+ @proj_name = options[:proj_name]
17
+ @upload_flag = options[:upload] || false
18
+ @send_flag = options[:send] || false
19
+ @macos_flag = false
20
+
21
+ # 接收外部传入的 JPS 配置
22
+ @app_info_obj = options[:app_info_obj]
23
+ @workflow_info = options[:workflow_info]
24
+
25
+ # 保存 Unity 根目录路径(用于查找 config.json)
26
+ @unity_root_path = options[:unity_root_path]
27
+
28
+ super(:ios, :dev, options)
29
+ end
30
+
31
+ protected
32
+
33
+ def build_task_name
34
+ "构建 IPA (Dev)"
35
+ end
36
+
37
+ def prepare_build
38
+ # 校验必需的参数
39
+ validate_workflow_info
40
+
41
+ Dir.chdir(@project_path)
42
+ check_git_tag if @upload_flag
43
+ cleanup_firebase_shell
44
+ update_project_config
45
+ update_version_info
46
+ pull_config
47
+ update_entitlements
48
+ handle_cocoapods
49
+ end
50
+
51
+ def execute_build
52
+ configure_certificate
53
+ update_url_schemes_final
54
+ build_ios_project
55
+ end
56
+
57
+ def find_output
58
+ build_path = File.join(@project_path, "build", "*.{ipa,app}")
59
+ ipa_files = Dir.glob(build_path)
60
+
61
+ if ipa_files.any?
62
+ latest_ipa = ipa_files.max_by { |f| File.mtime(f) }
63
+ puts " 找到 IPA 文件: #{latest_ipa}"
64
+ latest_ipa
65
+ else
66
+ puts " 警告: 未找到 IPA 文件"
67
+ nil
68
+ end
69
+ end
70
+
71
+ private
72
+
73
+ # Git 标签检查
74
+ def check_git_tag
75
+ git_repo_helper = Pindo::GitRepoHelper.share_instance
76
+ is_need_add_tag, tag_action_params = git_repo_helper.check_is_need_add_tag?(@project_path)
77
+ if is_need_add_tag
78
+ git_repo_helper.create_and_push_tag(
79
+ project_dir: @project_path,
80
+ mode: 'minor',
81
+ force_retag: tag_action_params&.include?('--retag') || false,
82
+ custom_tag: nil,
83
+ release_branch: 'master'
84
+ )
85
+ end
86
+ end
87
+
88
+ # 校验工作流信息
89
+ def validate_workflow_info
90
+ unless @workflow_info && @workflow_info[:package_name]
91
+ raise Informative, "未提供工作流信息,请在创建任务时传入 workflow_info 参数"
92
+ end
93
+ end
94
+
95
+ # 清理 Firebase Shell Script
96
+ def cleanup_firebase_shell
97
+ project_fullname = Dir.glob(File.join(@project_path, "/*.xcodeproj")).max_by { |f| File.mtime(f) }
98
+ if !project_fullname.nil? && File.exist?(project_fullname)
99
+ Pindo::XcodeBuildHelper.delete_libtarget_firebase_shell(@project_path)
100
+ end
101
+ end
102
+
103
+ # 更新工程配置
104
+ def update_project_config
105
+ workflow_packname = @workflow_info[:package_name]
106
+ project_id = @app_info_obj ? @app_info_obj["id"] : nil
107
+
108
+ puts "\n使用工作流配置更新 iOS 项目:"
109
+ puts " Workflow Package Name: #{workflow_packname}"
110
+
111
+ # 更新 Display Name、Bundle ID、URL Schemes 和 JPS 快捷操作
112
+ Pindo::XcodeBuildConfig.update_project_with_workflow(
113
+ project_dir: @project_path,
114
+ workflow_packname: workflow_packname,
115
+ project_id: project_id
116
+ )
117
+
118
+ # 下载并替换 Icon
119
+ if @app_info_obj && @app_info_obj["projectIcon"] && !@app_info_obj["projectIcon"].empty?
120
+ icon_replace_success = Pindo::XcodeBuildConfig.download_and_replace_icon_from_url(
121
+ project_dir: @project_path,
122
+ icon_url: @app_info_obj["projectIcon"]
123
+ )
124
+
125
+ unless icon_replace_success
126
+ raise Informative, "Icon 下载或替换失败,请检查 Icon URL 是否有效: #{@app_info_obj["projectIcon"]}"
127
+ end
128
+ else
129
+ Funlog.warning("未配置 Icon URL,跳过 Icon 替换")
130
+ end
131
+ end
132
+
133
+ # 更新版本号
134
+ def update_version_info
135
+ version_helper = Pindo::VersionHelper.share_instance
136
+ version_info = version_helper.get_version_info(project_dir: @project_path)
137
+
138
+ if version_info[:is_git_repo]
139
+ Pindo::XcodeBuildConfig.update_ios_project_version(
140
+ project_dir: @project_path,
141
+ version: version_info[:version],
142
+ build_number: version_info[:build_number]
143
+ )
144
+ else
145
+ Funlog.warning("非Git仓库,保持工程原有版本号")
146
+ end
147
+ end
148
+
149
+ # 拉取配置
150
+ def pull_config
151
+ args_temp = []
152
+ args_temp << @bundle_id if @bundle_id
153
+ Pindo::Command::Deploy::Pullconfig::run(args_temp)
154
+ end
155
+
156
+ # 更新 Entitlements
157
+ def update_entitlements
158
+ config_json_file = File.join(@project_path, "config.json")
159
+ Pindo::XcodeBuildConfig.update_entitlements_config(
160
+ project_dir: @project_path,
161
+ config_file: config_json_file
162
+ )
163
+ end
164
+
165
+ # 处理 CocoaPods
166
+ def handle_cocoapods
167
+ return unless File.exist?(File.join(@project_path, "Podfile"))
168
+
169
+ Dir.chdir(@project_path)
170
+ Pindo::Command::Ios::Podupdate::run([])
171
+
172
+ begin
173
+ # 清理现有 Pods
174
+ FileUtils.rm_rf(File.join(@project_path, "Podfile.lock")) if File.exist?(File.join(@project_path, "Podfile.lock"))
175
+ FileUtils.rm_rf(File.join(@project_path, "Pods")) if File.exist?(File.join(@project_path, "Pods"))
176
+
177
+ puts "正在执行 pod deintegrate..."
178
+ system 'pod deintegrate'
179
+
180
+ puts "正在执行 pod install..."
181
+ system 'pod install'
182
+ rescue => error
183
+ puts(error.to_s)
184
+ raise Informative, "pod install 失败!!先 pod install 完成后再编译!"
185
+ end
186
+
187
+ # 检查 pod install 是否成功
188
+ pod_lock_file = File.join(@project_path, "Podfile.lock")
189
+ unless File.exist?(pod_lock_file)
190
+ raise Informative, "pod install 失败!!先 pod install 完成后再编译!"
191
+ end
192
+ end
193
+
194
+ # 配置证书
195
+ def configure_certificate
196
+ # 检查是否是 macOS 工程
197
+ detect_macos_platform
198
+
199
+ args_temp = ['--dev']
200
+ args_temp << '--macos' if @macos_flag
201
+
202
+ # 如果有 Unity 根目录路径,需要从那里读取 config.json
203
+ if @unity_root_path
204
+ # 临时切换到 Unity 根目录读取 config.json
205
+ config_path = File.join(@unity_root_path, 'config.json')
206
+ if File.exist?(config_path)
207
+ args_temp << config_path
208
+ end
209
+ end
210
+
211
+ # 切换到 iOS 工程目录,确保 Cert::run 能找到 xcodeproj
212
+ Dir.chdir(@project_path) do
213
+ Pindo::Command::Deploy::Cert::run(args_temp)
214
+ end
215
+ end
216
+
217
+ # 检测是否为 macOS 平台
218
+ def detect_macos_platform
219
+ project_fullname = Dir.glob(File.join(@project_path, "/*.xcodeproj")).max_by { |f| File.mtime(f) }
220
+ return if project_fullname.nil?
221
+
222
+ require 'xcodeproj'
223
+ project_obj = Xcodeproj::Project.open(project_fullname)
224
+ project_build_platform = project_obj.root_object.build_configuration_list.get_setting("SDKROOT")["Release"]
225
+
226
+ if !project_build_platform.nil? && project_build_platform.eql?("macosx")
227
+ @macos_flag = true
228
+ end
229
+ end
230
+
231
+ # 更新 URL Schemes(基于最终 Bundle ID)
232
+ def update_url_schemes_final
233
+ workflow_packname = @workflow_info[:package_name]
234
+ Pindo::XcodeBuildConfig.update_url_schemes_with_bundleid(
235
+ project_dir: @project_path,
236
+ package_name: workflow_packname
237
+ )
238
+ end
239
+
240
+ # 编译 iOS 工程
241
+ def build_ios_project
242
+ Dir.chdir(@project_path)
243
+
244
+ args_temp = ['--dev']
245
+ args_temp << '--macos' if @macos_flag
246
+
247
+ Pindo::Command::Deploy::Build::run(args_temp)
248
+ end
249
+ end
250
+ end
251
+ end
@@ -0,0 +1,53 @@
1
+ require_relative 'ios_dev_build_task'
2
+
3
+ module Pindo
4
+ module TaskSystem
5
+ # iOS Release 模式构建任务
6
+ # 使用 Distribution/App Store 证书编译 iOS 工程
7
+ class IosReleaseBuildTask < IosDevBuildTask
8
+ def initialize(options = {})
9
+ super(options)
10
+ @mode = :release
11
+ end
12
+
13
+ protected
14
+
15
+ def build_task_name
16
+ "构建 IPA (Release)"
17
+ end
18
+
19
+ private
20
+
21
+ # 配置证书(覆盖父类方法)
22
+ def configure_certificate
23
+ detect_macos_platform
24
+
25
+ args_temp = ['--deploy']
26
+ args_temp << '--macos' if @macos_flag
27
+
28
+ # 如果有 Unity 根目录路径,需要从那里读取 config.json
29
+ if @unity_root_path
30
+ config_path = File.join(@unity_root_path, 'config.json')
31
+ if File.exist?(config_path)
32
+ args_temp << config_path
33
+ end
34
+ end
35
+
36
+ # 切换到 iOS 工程目录,确保 Cert::run 能找到 xcodeproj
37
+ Dir.chdir(@project_path) do
38
+ Pindo::Command::Deploy::Cert::run(args_temp)
39
+ end
40
+ end
41
+
42
+ # 编译 iOS 工程(覆盖父类方法)
43
+ def build_ios_project
44
+ Dir.chdir(@project_path)
45
+
46
+ args_temp = ['--deploy']
47
+ args_temp << '--macos' if @macos_flag
48
+
49
+ Pindo::Command::Deploy::Build::run(args_temp)
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,43 @@
1
+ require_relative '../build_task'
2
+
3
+ module Pindo
4
+ module TaskSystem
5
+ # Web 构建任务
6
+ # Web 平台不需要编译,Unity 导出后即为最终产物
7
+ # 此任务只检查构建产物是否存在
8
+ class WebDevBuildTask < BuildTask
9
+ def initialize(options = {})
10
+ super(:web, :dev, options)
11
+ end
12
+
13
+ protected
14
+
15
+ def build_task_name
16
+ "构建 WebGL"
17
+ end
18
+
19
+ def prepare_build
20
+ # Web 不需要准备,Unity 导出后即完成
21
+ end
22
+
23
+ def execute_build
24
+ # Web 不需要编译,Unity 导出后即为最终产物
25
+ # 这里不做任何操作
26
+ end
27
+
28
+ def find_output
29
+ # 检查 Unity 导出的 WebGL 文件是否存在
30
+ web_export_dir = File.join(@project_path, "GoodPlatform/WebGL")
31
+ build_path = File.join(web_export_dir, "build", "*.html")
32
+ html_files = Dir.glob(build_path)
33
+
34
+ if html_files.any?
35
+ html_file = html_files.max_by { |f| File.mtime(f) }
36
+ html_file
37
+ else
38
+ raise "未找到 WebGL 构建产物 (#{build_path})"
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end