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.
- checksums.yaml +4 -4
- data/lib/pindo/command/android/autobuild.rb +111 -184
- data/lib/pindo/command/android/build.rb +10 -2
- data/lib/pindo/command/ios/autobuild.rb +115 -210
- data/lib/pindo/command/ios/build.rb +12 -3
- data/lib/pindo/command/jps/upload.rb +257 -117
- data/lib/pindo/command/unity/autobuild.rb +308 -220
- data/lib/pindo/command/unity.rb +0 -3
- data/lib/pindo/command/utils/boss.rb +18 -15
- data/lib/pindo/command/utils/clearcert.rb +26 -18
- data/lib/pindo/command/utils/device.rb +28 -19
- data/lib/pindo/command/utils/feishu.rb +11 -4
- data/lib/pindo/command/utils/icon.rb +26 -20
- data/lib/pindo/command/utils/renewcert.rb +35 -29
- data/lib/pindo/command/utils/renewproj.rb +32 -25
- data/lib/pindo/command/utils/repoinit.rb +1 -1
- data/lib/pindo/command/utils/tag.rb +6 -180
- data/lib/pindo/command/utils/tgate.rb +34 -28
- data/lib/pindo/command/utils/xcassets.rb +30 -20
- data/lib/pindo/command/web/autobuild.rb +148 -128
- data/lib/pindo/module/android/android_build_helper.rb +0 -6
- data/lib/pindo/module/android/android_config_helper.rb +4 -26
- data/lib/pindo/module/build/build_helper.rb +18 -294
- data/lib/pindo/module/build/git_repo_helper.rb +519 -0
- data/lib/pindo/module/build/icon_downloader.rb +85 -0
- data/lib/pindo/module/pgyer/pgyerhelper.rb +16 -11
- data/lib/pindo/module/task/model/build/android_dev_build_task.rb +209 -0
- data/lib/pindo/module/task/model/build/android_release_build_task.rb +29 -0
- data/lib/pindo/module/task/model/build/ios_adhoc_build_task.rb +53 -0
- data/lib/pindo/module/task/model/build/ios_dev_build_task.rb +251 -0
- data/lib/pindo/module/task/model/build/ios_release_build_task.rb +53 -0
- data/lib/pindo/module/task/model/build/web_dev_build_task.rb +43 -0
- data/lib/pindo/module/task/model/build_task.rb +125 -301
- data/lib/pindo/module/task/model/git_tag_task.rb +80 -0
- data/lib/pindo/module/task/model/unity_export_task.rb +53 -41
- data/lib/pindo/module/task/model/upload_task.rb +149 -208
- data/lib/pindo/module/task/pindo_task.rb +135 -95
- data/lib/pindo/module/task/task_manager.rb +202 -352
- data/lib/pindo/module/unity/unity_helper.rb +7 -3
- data/lib/pindo/module/xcode/xcode_build_config.rb +4 -10
- data/lib/pindo/module/xcode/xcode_build_helper.rb +19 -0
- data/lib/pindo/version.rb +1 -1
- metadata +10 -4
- data/lib/pindo/command/unity/apk.rb +0 -185
- data/lib/pindo/command/unity/ipa.rb +0 -198
- data/lib/pindo/command/unity/web.rb +0 -163
|
@@ -6,7 +6,13 @@ require 'pindo/base/executable'
|
|
|
6
6
|
require 'pindo/module/build/build_helper'
|
|
7
7
|
require 'pindo/module/build/version_helper'
|
|
8
8
|
require 'pindo/module/xcode/xcode_build_config'
|
|
9
|
+
require 'pindo/module/xcode/xcode_build_helper'
|
|
9
10
|
require 'pindo/base/pindocontext'
|
|
11
|
+
require 'pindo/module/task/task_manager'
|
|
12
|
+
require 'pindo/module/task/model/git_tag_task'
|
|
13
|
+
require 'pindo/module/task/model/unity_export_task'
|
|
14
|
+
require 'pindo/module/task/model/build_task'
|
|
15
|
+
require 'pindo/module/task/model/upload_task'
|
|
10
16
|
|
|
11
17
|
module Pindo
|
|
12
18
|
class Command
|
|
@@ -102,239 +108,138 @@ module Pindo
|
|
|
102
108
|
# 确认并应用缓存(如果有)
|
|
103
109
|
context.confirm_and_apply_cache
|
|
104
110
|
|
|
111
|
+
# 准备配置
|
|
112
|
+
config = prepare_ios_config(pindo_project_dir)
|
|
105
113
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
@mainapp_bundleid = @args_bundle_id
|
|
109
|
-
else
|
|
110
|
-
if @args_deploy_flag
|
|
111
|
-
@mainapp_bundleid = get_selected_deploy_bundleid()
|
|
112
|
-
else
|
|
113
|
-
@mainapp_bundleid = get_selected_dev_bundleid()
|
|
114
|
-
end
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
build_helper = Pindo::BuildHelper.share_instance
|
|
119
|
-
project_type = build_helper.project_type(pindo_project_dir)
|
|
120
|
-
|
|
121
|
-
args_temp = []
|
|
122
|
-
args_temp << "--proj=#{@args_proj_name}" if @args_proj_name
|
|
123
|
-
args_temp << "--upload" if @args_upload_flag
|
|
124
|
-
args_temp << "--send" if @args_send_flag
|
|
125
|
-
args_temp << "--bundleid=#{@mainapp_bundleid}" if @mainapp_bundleid
|
|
126
|
-
case project_type
|
|
127
|
-
when :ios
|
|
128
|
-
ios_autobuild
|
|
129
|
-
when :android
|
|
130
|
-
puts "Android 工程, 请使用 pindo and build"
|
|
114
|
+
# 创建并执行任务
|
|
115
|
+
tasks = make_build_task(config)
|
|
131
116
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
117
|
+
# 添加到任务管理器并执行
|
|
118
|
+
task_manager = Pindo::TaskSystem::TaskManager.instance
|
|
119
|
+
task_manager.clear_all
|
|
120
|
+
tasks.each { |task| task_manager.add_task(task) }
|
|
121
|
+
task_manager.start
|
|
137
122
|
|
|
123
|
+
system "open #{pindo_project_dir}"
|
|
138
124
|
end
|
|
139
125
|
|
|
140
|
-
|
|
141
|
-
# 记录构建开始时间
|
|
142
|
-
build_start_time = Time.now
|
|
126
|
+
private
|
|
143
127
|
|
|
144
|
-
|
|
128
|
+
# 创建构建任务
|
|
129
|
+
def make_build_task(config)
|
|
130
|
+
# 检测项目类型
|
|
145
131
|
build_helper = Pindo::BuildHelper.share_instance
|
|
146
|
-
|
|
147
|
-
is_need_add_tag,tag_action_parms = build_helper.check_is_need_add_tag?(pindo_project_dir)
|
|
148
|
-
if is_need_add_tag
|
|
149
|
-
Pindo::Command::Utils::Tag::run(tag_action_parms)
|
|
150
|
-
end
|
|
151
|
-
end
|
|
152
|
-
new_project_fullname = Dir.glob(File.join(pindo_project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
|
|
153
|
-
if !new_project_fullname.nil? && File.exist?(new_project_fullname)
|
|
154
|
-
build_helper.delete_libtarget_firebase_shell(pindo_project_dir)
|
|
155
|
-
end
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
app_info_obj = nil
|
|
159
|
-
workflow_info = nil
|
|
160
|
-
proj_name = @args_proj_name
|
|
161
|
-
# 传入 package_type 获取 workflow_info
|
|
162
|
-
app_info_obj, workflow_info = PgyerHelper.share_instace.prepare_upload(
|
|
163
|
-
working_directory: Dir.pwd,
|
|
164
|
-
proj_name: proj_name,
|
|
165
|
-
package_type: 'ipa'
|
|
166
|
-
)
|
|
132
|
+
project_type = build_helper.project_type(config[:project_path])
|
|
167
133
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
puts " Workflow Package Name: #{workflow_packname}"
|
|
175
|
-
|
|
176
|
-
# 一次性更新 Display Name、Bundle ID、URL Schemes 和 JPS 快捷操作
|
|
177
|
-
Pindo::XcodeBuildConfig.update_project_with_workflow(
|
|
178
|
-
project_dir: pindo_project_dir,
|
|
179
|
-
workflow_packname: workflow_packname,
|
|
180
|
-
project_id: project_id
|
|
181
|
-
)
|
|
182
|
-
else
|
|
183
|
-
raise Informative, "未获取到工作流信息"
|
|
184
|
-
end
|
|
185
|
-
|
|
186
|
-
# ===== 从 JPS 下载并替换项目 Icon =====
|
|
187
|
-
if app_info_obj && app_info_obj["projectIcon"] && !app_info_obj["projectIcon"].empty?
|
|
188
|
-
icon_replace_success = Pindo::XcodeBuildConfig.download_and_replace_icon_from_url(
|
|
189
|
-
project_dir: pindo_project_dir,
|
|
190
|
-
icon_url: app_info_obj["projectIcon"]
|
|
191
|
-
)
|
|
192
|
-
|
|
193
|
-
# 如果 projectIcon 不为空且下载失败,抛出异常终止执行
|
|
194
|
-
unless icon_replace_success
|
|
195
|
-
raise Informative, "Icon 下载或替换失败,请检查 Icon URL 是否有效: #{app_info_obj["projectIcon"]}"
|
|
196
|
-
end
|
|
197
|
-
else
|
|
198
|
-
Funlog.warning("未配置 Icon URL,跳过 Icon 替换")
|
|
199
|
-
end
|
|
200
|
-
|
|
201
|
-
# ===== 更新版本号和Build号(仅在Git仓库中)=====
|
|
202
|
-
version_helper = Pindo::VersionHelper.share_instance
|
|
203
|
-
version_info = version_helper.get_version_info(project_dir: pindo_project_dir)
|
|
134
|
+
case project_type
|
|
135
|
+
when :android
|
|
136
|
+
raise Informative, "Android 工程, 请使用 pindo and build"
|
|
137
|
+
when :ios, :unity
|
|
138
|
+
# 判断是否是 Unity 工程
|
|
139
|
+
is_unity = (project_type == :unity)
|
|
204
140
|
|
|
205
|
-
|
|
206
|
-
# 更新iOS工程版本
|
|
207
|
-
Pindo::XcodeBuildConfig.update_ios_project_version(
|
|
208
|
-
project_dir: pindo_project_dir,
|
|
209
|
-
version: version_info[:version],
|
|
210
|
-
build_number: version_info[:build_number]
|
|
211
|
-
)
|
|
212
|
-
else
|
|
213
|
-
Funlog.warning("非Git仓库,保持工程原有版本号")
|
|
214
|
-
end
|
|
141
|
+
tasks = []
|
|
215
142
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
Dir.chdir(pindo_project_dir)
|
|
221
|
-
config_json_file = File.join(pindo_project_dir,"config.json")
|
|
222
|
-
|
|
223
|
-
# 处理entitlements配置
|
|
224
|
-
Pindo::XcodeBuildConfig.update_entitlements_config(project_dir: pindo_project_dir, config_file: config_json_file)
|
|
225
|
-
|
|
226
|
-
if File.exist?(File.join(pindo_project_dir, "Podfile"))
|
|
227
|
-
|
|
228
|
-
args_temp = []
|
|
229
|
-
args_temp << config_json_file
|
|
230
|
-
Pindo::Command::Ios::Podupdate::run([])
|
|
231
|
-
|
|
232
|
-
begin
|
|
233
|
-
if File.exist?(File.join(pindo_project_dir, "Podfile.lock"))
|
|
234
|
-
FileUtils.rm_rf(File.join(pindo_project_dir, "Podfile.lock"))
|
|
235
|
-
end
|
|
236
|
-
if File.exist?(File.join(pindo_project_dir,"Pods"))
|
|
237
|
-
FileUtils.rm_rf(File.join(pindo_project_dir, "Pods"))
|
|
238
|
-
end
|
|
239
|
-
puts "正在执行pod deintegrate..."
|
|
240
|
-
system 'pod deintegrate'
|
|
241
|
-
puts "正在执行pod install..."
|
|
242
|
-
system 'pod install'
|
|
243
|
-
rescue => error
|
|
244
|
-
puts(error.to_s)
|
|
245
|
-
raise Informative, "pod install失败!!先pod install 完成后成编译 !"
|
|
143
|
+
# 1. Git 标签任务(如果需要上传)
|
|
144
|
+
if @args_upload_flag
|
|
145
|
+
git_tag_task = Pindo::TaskSystem::GitTagTask.new(config[:project_path])
|
|
146
|
+
tasks << git_tag_task
|
|
246
147
|
end
|
|
247
148
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
149
|
+
# 2. Unity 导出任务(仅 Unity 工程)
|
|
150
|
+
if is_unity
|
|
151
|
+
# 确定 iOS 导出路径
|
|
152
|
+
base_ios_path = File.join(config[:project_path], "GoodPlatform", "BaseiOS")
|
|
153
|
+
ios_path = File.join(config[:project_path], "GoodPlatform", "iOS")
|
|
154
|
+
ios_export_path = File.exist?(base_ios_path) ? base_ios_path : ios_path
|
|
155
|
+
|
|
156
|
+
unity_context = {}
|
|
157
|
+
unity_context[:project_name] = @args_proj_name if @args_proj_name
|
|
158
|
+
|
|
159
|
+
unity_task = Pindo::TaskSystem::UnityExportTask.new(
|
|
160
|
+
'ios',
|
|
161
|
+
project_path: config[:project_path],
|
|
162
|
+
export_path: ios_export_path,
|
|
163
|
+
context: unity_context
|
|
164
|
+
)
|
|
165
|
+
unity_task.dependencies << tasks.first.id if tasks.any?
|
|
166
|
+
tasks << unity_task
|
|
252
167
|
end
|
|
253
168
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
args_temp = []
|
|
258
|
-
if @args_adhoc_flag
|
|
259
|
-
args_temp << "--adhoc"
|
|
260
|
-
else
|
|
261
|
-
args_temp << "--dev"
|
|
262
|
-
end
|
|
169
|
+
# 3. 构建任务
|
|
170
|
+
build_mode = @args_deploy_flag ? :release : (@args_adhoc_flag ? :adhoc : :dev)
|
|
263
171
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
@args_macos_flag = true
|
|
172
|
+
# 确定 iOS 项目路径
|
|
173
|
+
if is_unity
|
|
174
|
+
ios_project_path = ios_export_path
|
|
175
|
+
else
|
|
176
|
+
ios_project_path = config[:project_path]
|
|
270
177
|
end
|
|
271
|
-
end
|
|
272
|
-
|
|
273
|
-
if @args_macos_flag
|
|
274
|
-
args_temp << "--macos"
|
|
275
|
-
end
|
|
276
|
-
|
|
277
|
-
Pindo::Command::Deploy::Cert::run(args_temp)
|
|
278
|
-
|
|
279
|
-
# 根据证书配置后的实际 Bundle ID 重新更新 URL Schemes
|
|
280
|
-
# 因为 Cert::run 可能会修改 PRODUCT_BUNDLE_IDENTIFIER
|
|
281
|
-
Pindo::XcodeBuildConfig.update_url_schemes_with_bundleid(
|
|
282
|
-
project_dir: pindo_project_dir,
|
|
283
|
-
package_name: workflow_packname
|
|
284
|
-
)
|
|
285
|
-
|
|
286
|
-
Dir.chdir(pindo_project_dir)
|
|
287
|
-
Pindo::Command::Deploy::Build::run(args_temp)
|
|
288
178
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
app_info_obj: app_info_obj,
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
179
|
+
build_options = {
|
|
180
|
+
project_path: ios_project_path,
|
|
181
|
+
bundle_id: config[:bundle_id],
|
|
182
|
+
proj_name: @args_proj_name,
|
|
183
|
+
upload: @args_upload_flag,
|
|
184
|
+
send: @args_send_flag,
|
|
185
|
+
app_info_obj: config[:app_info_obj],
|
|
186
|
+
workflow_info: config[:workflow_info]
|
|
187
|
+
}
|
|
188
|
+
build_options[:unity_root_path] = config[:project_path] if is_unity
|
|
189
|
+
|
|
190
|
+
build_task = Pindo::TaskSystem::BuildTask.create_task(
|
|
191
|
+
platform: :ios,
|
|
192
|
+
mode: build_mode,
|
|
193
|
+
options: build_options
|
|
299
194
|
)
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
195
|
+
build_task.dependencies << tasks.last.id if tasks.any?
|
|
196
|
+
tasks << build_task
|
|
197
|
+
|
|
198
|
+
# 4. 上传任务(如果需要)
|
|
199
|
+
if @args_upload_flag
|
|
200
|
+
upload_task = Pindo::TaskSystem::UploadTask.new(
|
|
201
|
+
'ipa',
|
|
202
|
+
File.join(ios_project_path, 'build'),
|
|
203
|
+
nil,
|
|
204
|
+
app_info_obj: config[:app_info_obj],
|
|
205
|
+
workflow_info: config[:workflow_info],
|
|
206
|
+
project_name: @args_proj_name,
|
|
207
|
+
context: {
|
|
208
|
+
send_to_chat: @args_send_flag
|
|
209
|
+
},
|
|
210
|
+
dependencies: [build_task.id]
|
|
310
211
|
)
|
|
311
|
-
|
|
312
|
-
# 如果有 --send 参数,额外发送到测试群
|
|
313
|
-
if @args_send_flag
|
|
314
|
-
PgyerHelper.share_instace.send_apptest_msg(
|
|
315
|
-
app_info_obj: app_info_obj,
|
|
316
|
-
app_version_info_obj: result_data["data"],
|
|
317
|
-
chatEnv: "DevTest",
|
|
318
|
-
receiveType: "chat"
|
|
319
|
-
)
|
|
320
|
-
end
|
|
212
|
+
tasks << upload_task
|
|
321
213
|
end
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
# 计算并显示总耗时
|
|
325
|
-
total_time = Time.now - build_start_time
|
|
326
|
-
minutes = (total_time / 60).to_i
|
|
327
|
-
seconds = (total_time % 60).to_i
|
|
328
|
-
|
|
329
|
-
if minutes > 0
|
|
330
|
-
puts "\e[32m构建完成!总耗时: #{minutes}分#{seconds}秒\e[0m"
|
|
214
|
+
|
|
215
|
+
tasks
|
|
331
216
|
else
|
|
332
|
-
|
|
217
|
+
raise Informative, "当前目录不是工程目录,不能编译"
|
|
333
218
|
end
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
# 准备 iOS 配置
|
|
222
|
+
def prepare_ios_config(pindo_project_dir)
|
|
223
|
+
# 获取 Bundle ID
|
|
224
|
+
bundle_id = if @args_bundle_id
|
|
225
|
+
@args_bundle_id
|
|
226
|
+
else
|
|
227
|
+
@args_deploy_flag ? get_selected_deploy_bundleid() : get_selected_dev_bundleid()
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
# 获取 JPS 配置
|
|
231
|
+
app_info_obj, workflow_info = PgyerHelper.share_instace.prepare_upload(
|
|
232
|
+
working_directory: pindo_project_dir,
|
|
233
|
+
proj_name: @args_proj_name,
|
|
234
|
+
package_type: 'ipa'
|
|
235
|
+
)
|
|
337
236
|
|
|
237
|
+
{
|
|
238
|
+
project_path: pindo_project_dir,
|
|
239
|
+
bundle_id: bundle_id,
|
|
240
|
+
app_info_obj: app_info_obj,
|
|
241
|
+
workflow_info: workflow_info
|
|
242
|
+
}
|
|
338
243
|
end
|
|
339
244
|
|
|
340
245
|
end
|
|
@@ -4,7 +4,9 @@ require 'json'
|
|
|
4
4
|
require 'xcodeproj'
|
|
5
5
|
require 'gym'
|
|
6
6
|
require 'pindo/module/build/build_helper'
|
|
7
|
+
require 'pindo/module/build/git_repo_helper'
|
|
7
8
|
require 'pindo/module/xcode/xcode_build_config'
|
|
9
|
+
require 'pindo/module/xcode/xcode_build_helper'
|
|
8
10
|
|
|
9
11
|
module Pindo
|
|
10
12
|
class Command
|
|
@@ -101,16 +103,23 @@ module Pindo
|
|
|
101
103
|
pindo_project_dir = Dir.pwd
|
|
102
104
|
build_helper = Pindo::BuildHelper.share_instance
|
|
103
105
|
if @args_upload_flag
|
|
104
|
-
|
|
106
|
+
git_repo_helper = Pindo::GitRepoHelper.share_instance
|
|
107
|
+
is_need_add_tag, tag_action_parms = git_repo_helper.check_is_need_add_tag?(pindo_project_dir)
|
|
105
108
|
if is_need_add_tag
|
|
106
|
-
|
|
109
|
+
git_repo_helper.create_and_push_tag(
|
|
110
|
+
project_dir: pindo_project_dir,
|
|
111
|
+
mode: 'minor',
|
|
112
|
+
force_retag: tag_action_parms&.include?('--retag') || false,
|
|
113
|
+
custom_tag: nil,
|
|
114
|
+
release_branch: 'master'
|
|
115
|
+
)
|
|
107
116
|
end
|
|
108
117
|
end
|
|
109
118
|
|
|
110
119
|
new_project_fullname = Dir.glob(File.join(pindo_project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
|
|
111
120
|
puts "new_project_fullname: #{new_project_fullname}"
|
|
112
121
|
if !new_project_fullname.nil? && File.exist?(new_project_fullname)
|
|
113
|
-
|
|
122
|
+
Pindo::XcodeBuildHelper.delete_libtarget_firebase_shell(pindo_project_dir)
|
|
114
123
|
end
|
|
115
124
|
|
|
116
125
|
app_info_obj = nil
|