pindo 5.13.2 → 5.13.3
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/appstore/adhocbuild.rb +14 -16
- data/lib/pindo/command/ios/applovin.rb +24 -182
- data/lib/pindo/command/ios/podupdate.rb +6 -37
- data/lib/pindo/module/cert/xcode_cert_helper.rb +7 -4
- data/lib/pindo/module/pgyer/pgyerhelper.rb +13 -5
- data/lib/pindo/module/task/model/build/ios_build_adhoc_task.rb +219 -74
- data/lib/pindo/module/task/model/build/ios_build_appstore_task.rb +78 -104
- data/lib/pindo/module/task/model/build/ios_build_dev_task.rb +17 -46
- data/lib/pindo/module/task/model/build/ios_build_task.rb +12 -2
- data/lib/pindo/module/xcode/applovin_xcode_helper.rb +271 -0
- data/lib/pindo/module/xcode/cocoapods_helper.rb +153 -0
- data/lib/pindo/module/xcode/xcode_app_config.rb +1 -1
- data/lib/pindo/module/xcode/xcode_swark_helper.rb +5 -5
- data/lib/pindo/version.rb +1 -1
- metadata +3 -1
|
@@ -4,26 +4,26 @@ require 'pindo/module/build/version_helper'
|
|
|
4
4
|
require 'pindo/module/build/git_repo_helper'
|
|
5
5
|
require 'pindo/module/xcode/xcode_build_config'
|
|
6
6
|
require 'pindo/module/xcode/xcode_build_helper'
|
|
7
|
+
require 'pindo/module/xcode/xcode_app_config'
|
|
8
|
+
require 'pindo/module/xcode/cocoapods_helper'
|
|
9
|
+
require 'pindo/module/xcode/applovin_xcode_helper'
|
|
10
|
+
require 'pindo/module/cert/xcode_cert_helper'
|
|
7
11
|
require 'pindo/module/pgyer/pgyerhelper'
|
|
12
|
+
require 'pindo/config/ios_config_parser'
|
|
8
13
|
|
|
9
14
|
module Pindo
|
|
10
15
|
module TaskSystem
|
|
11
16
|
# iOS AdHoc 模式构建任务
|
|
12
17
|
# 使用 AdHoc 证书编译 iOS 工程
|
|
18
|
+
# 包含 AdHoc 特有的准备工作(版本号增加、Tag 创建、Quark/Swark 处理等)
|
|
13
19
|
class IosBuildAdhocTask < IosBuildTask
|
|
14
20
|
def initialize(options = {})
|
|
15
21
|
@bundle_id = options[:bundle_id]
|
|
16
|
-
|
|
17
22
|
@proj_name = options[:proj_name]
|
|
18
|
-
|
|
19
23
|
@upload_flag = options[:upload] || false
|
|
20
24
|
@send_flag = options[:send] || false
|
|
21
25
|
@macos_flag = false
|
|
22
26
|
|
|
23
|
-
# 接收外部传入的 JPS 配置
|
|
24
|
-
@app_info_obj = options[:app_info_obj]
|
|
25
|
-
@workflow_info = options[:workflow_info]
|
|
26
|
-
|
|
27
27
|
# 保存 Unity 根目录路径(用于查找 config.json)
|
|
28
28
|
@unity_root_path = options[:unity_root_path]
|
|
29
29
|
|
|
@@ -36,19 +36,37 @@ module Pindo
|
|
|
36
36
|
"构建 IPA (AdHoc)"
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
+
#准备构建
|
|
39
40
|
def prepare_build
|
|
40
|
-
|
|
41
41
|
Dir.chdir(@project_path)
|
|
42
|
+
|
|
43
|
+
# 0. 清理 Firebase Shell Script
|
|
42
44
|
cleanup_firebase_shell
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
|
|
46
|
+
# 1. 加载配置到 IosConfigParser 单例
|
|
47
|
+
load_ios_config
|
|
48
|
+
|
|
49
|
+
# 2. 自动增加版本号
|
|
50
|
+
auto_increase_buildnumber
|
|
51
|
+
|
|
52
|
+
# 3. 检查代码版本
|
|
53
|
+
check_code_version
|
|
54
|
+
|
|
55
|
+
# 4. 配置 Xcode 项目
|
|
56
|
+
configure_xcode_project
|
|
57
|
+
|
|
58
|
+
# 5. Quark/Swark 处理
|
|
59
|
+
handle_quswark_processing
|
|
60
|
+
|
|
61
|
+
# 6. 使用 adhoc cert 命令
|
|
62
|
+
configure_adhoc_certificate
|
|
63
|
+
|
|
64
|
+
# 7. Applovin 处理
|
|
65
|
+
handle_applovin_processing
|
|
47
66
|
end
|
|
48
67
|
|
|
49
68
|
def execute_build
|
|
50
|
-
|
|
51
|
-
update_url_schemes_final
|
|
69
|
+
handle_cocoapods
|
|
52
70
|
build_ios_project
|
|
53
71
|
end
|
|
54
72
|
|
|
@@ -68,88 +86,224 @@ module Pindo
|
|
|
68
86
|
|
|
69
87
|
private
|
|
70
88
|
|
|
89
|
+
# 加载 iOS 配置
|
|
90
|
+
def load_ios_config
|
|
91
|
+
# 直接使用 IosConfigParser 单例中已加载的配置
|
|
92
|
+
config_parser = Pindo::IosConfigParser.instance
|
|
93
|
+
if config_parser.config_json.nil?
|
|
94
|
+
# 如果单例中没有配置,说明命令层未正确初始化
|
|
95
|
+
raise Informative, "配置未加载,请确保在命令层(如 pindo adhoc autobuild)已正确加载 config.json"
|
|
96
|
+
else
|
|
97
|
+
puts " 使用已加载的配置..."
|
|
98
|
+
end
|
|
99
|
+
end
|
|
71
100
|
|
|
101
|
+
# 自动增加版本号
|
|
102
|
+
def auto_increase_buildnumber
|
|
103
|
+
config_parser = Pindo::IosConfigParser.instance
|
|
104
|
+
config_json = config_parser.config_json
|
|
105
|
+
return unless config_json
|
|
72
106
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
107
|
+
# 从全局配置获取 deploy_identifier
|
|
108
|
+
deploy_identifier = config_json.dig('project_info', 'deploy_identifier')
|
|
109
|
+
return unless deploy_identifier
|
|
110
|
+
|
|
111
|
+
puts " 自动增加版本号..."
|
|
112
|
+
|
|
113
|
+
# 从全局配置获取 pindo_dir
|
|
114
|
+
pindo_dir = File.expand_path(config_parser.pindo_dir)
|
|
115
|
+
app_config_repo_dir = File.join(pindo_dir, deploy_identifier)
|
|
116
|
+
|
|
117
|
+
# 增加项目目录的版本号
|
|
118
|
+
project_config_file = File.join(@project_path, "config.json")
|
|
119
|
+
if File.exist?(project_config_file)
|
|
120
|
+
increase_buildnumber_in_file(project_config_file)
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# 增加配置仓库的版本号
|
|
124
|
+
app_config_file = File.join(app_config_repo_dir, "config.json")
|
|
125
|
+
if File.exist?(app_config_file)
|
|
126
|
+
increase_buildnumber_in_file(app_config_file)
|
|
127
|
+
|
|
128
|
+
# 提交到配置仓库
|
|
129
|
+
require 'pindo/module/build/git_repo_helper'
|
|
130
|
+
git_helper = Pindo::GitRepoHelper.share_instance
|
|
131
|
+
git_helper.git_addpush_repo(
|
|
132
|
+
path: app_config_repo_dir,
|
|
133
|
+
message: "increate build number",
|
|
134
|
+
commit_file_params: ["config.json"]
|
|
135
|
+
)
|
|
78
136
|
end
|
|
79
137
|
end
|
|
80
138
|
|
|
81
|
-
#
|
|
82
|
-
def
|
|
139
|
+
# 增加配置文件中的版本号
|
|
140
|
+
def increase_buildnumber_in_file(config_file)
|
|
141
|
+
config_json = JSON.parse(File.read(config_file))
|
|
83
142
|
|
|
143
|
+
if config_json["app_info"] && config_json["app_info"]["app_version"]
|
|
144
|
+
version_parts = config_json["app_info"]["app_version"].split(".")
|
|
145
|
+
if version_parts.length >= 3
|
|
146
|
+
build_number = version_parts[2].to_i + 1
|
|
147
|
+
version_parts[2] = build_number.to_s
|
|
148
|
+
config_json["app_info"]["app_version"] = version_parts.join(".")
|
|
84
149
|
|
|
150
|
+
File.write(config_file, JSON.pretty_generate(config_json))
|
|
151
|
+
puts " ✓ 版本号: #{config_json["app_info"]["app_version"]}"
|
|
152
|
+
end
|
|
153
|
+
end
|
|
85
154
|
end
|
|
86
155
|
|
|
87
|
-
#
|
|
88
|
-
def
|
|
89
|
-
|
|
90
|
-
|
|
156
|
+
# 检查代码版本
|
|
157
|
+
def check_code_version
|
|
158
|
+
config_parser = Pindo::IosConfigParser.instance
|
|
159
|
+
config_json = config_parser.config_json
|
|
160
|
+
return unless config_json
|
|
91
161
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
return unless @bundle_id
|
|
162
|
+
deploy_identifier = config_json.dig('project_info', 'deploy_identifier')
|
|
163
|
+
return unless deploy_identifier
|
|
95
164
|
|
|
96
|
-
|
|
97
|
-
build_helper.pull_appconfig_with_reponame(
|
|
98
|
-
repo_name: @bundle_id,
|
|
99
|
-
target_dir: @project_path
|
|
100
|
-
)
|
|
165
|
+
puts " 检查代码版本..."
|
|
101
166
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
167
|
+
pindo_dir = File.expand_path(config_parser.pindo_dir)
|
|
168
|
+
app_config_dir = File.join(pindo_dir, deploy_identifier)
|
|
169
|
+
build_verify_file = File.join(app_config_dir, "build_verify.json")
|
|
170
|
+
|
|
171
|
+
build_verify_json = nil
|
|
172
|
+
begin
|
|
173
|
+
build_verify_json = JSON.parse(File.read(build_verify_file)) if File.exist?(build_verify_file)
|
|
174
|
+
rescue => error
|
|
175
|
+
build_verify_json = nil
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
require 'pindo/module/build/git_repo_helper'
|
|
179
|
+
git_helper = Pindo::GitRepoHelper.share_instance
|
|
180
|
+
release_code_commit = git_helper.git_latest_commit_id(local_repo_dir: @project_path)
|
|
181
|
+
|
|
182
|
+
if !release_code_commit.nil? && !build_verify_json.nil? && !build_verify_json["output_code_commit"].nil?
|
|
183
|
+
output_code_commit = build_verify_json["output_code_commit"]
|
|
184
|
+
if !release_code_commit.eql?(output_code_commit)
|
|
185
|
+
puts
|
|
186
|
+
puts " ⚠ 不是最新代码,请更新代码!"
|
|
187
|
+
puts " 当前 commit: #{release_code_commit}"
|
|
188
|
+
puts " 期望 commit: #{output_code_commit}"
|
|
189
|
+
puts
|
|
190
|
+
|
|
191
|
+
require 'highline/import'
|
|
192
|
+
answer = agree(" 请确认要用当前代码编译: (Y/n)")
|
|
193
|
+
unless answer
|
|
194
|
+
raise Informative, "请更新代码重新打包!"
|
|
195
|
+
end
|
|
196
|
+
end
|
|
108
197
|
end
|
|
109
198
|
end
|
|
110
199
|
|
|
200
|
+
# 配置 Xcode 项目
|
|
201
|
+
def configure_xcode_project
|
|
202
|
+
puts " 配置 Xcode 项目..."
|
|
203
|
+
Pindo::XcodeBuildConfig.configure_xcode_project(project_dir: @project_path)
|
|
204
|
+
end
|
|
111
205
|
|
|
112
|
-
# 处理
|
|
113
|
-
def
|
|
114
|
-
|
|
206
|
+
# 处理 Quark/Swark
|
|
207
|
+
def handle_quswark_processing
|
|
208
|
+
config_parser = Pindo::IosConfigParser.instance
|
|
209
|
+
config_json = config_parser.config_json
|
|
210
|
+
return unless config_json
|
|
115
211
|
|
|
116
|
-
|
|
117
|
-
|
|
212
|
+
# 从 config_json 中判断是否需要处理 Quark/Swark
|
|
213
|
+
xcode_build_type = config_json.dig('project_info', 'xcode_build_type')
|
|
214
|
+
return unless xcode_build_type
|
|
118
215
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
FileUtils.rm_rf(File.join(@project_path, "Podfile.lock")) if File.exist?(File.join(@project_path, "Podfile.lock"))
|
|
122
|
-
FileUtils.rm_rf(File.join(@project_path, "Pods")) if File.exist?(File.join(@project_path, "Pods"))
|
|
216
|
+
build_type_array = xcode_build_type.split("_") || []
|
|
217
|
+
return unless build_type_array.include?("quark") || build_type_array.include?("swark")
|
|
123
218
|
|
|
124
|
-
|
|
125
|
-
system 'pod deintegrate'
|
|
219
|
+
puts " 处理 Quark/Swark..."
|
|
126
220
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
rescue => error
|
|
130
|
-
puts(error.to_s)
|
|
131
|
-
raise Informative, "pod install 失败!!先 pod install 完成后再编译!"
|
|
132
|
-
end
|
|
221
|
+
require 'pindo/module/xcode/xcode_swark_helper'
|
|
222
|
+
Dir.chdir(@project_path)
|
|
133
223
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
224
|
+
if xcode_build_type.include?("quark")
|
|
225
|
+
Pindo::XcodeSwarkHelper.quark_run(
|
|
226
|
+
project_dir: @project_path,
|
|
227
|
+
config_json: config_json,
|
|
228
|
+
build_type: 'adhoc'
|
|
229
|
+
)
|
|
230
|
+
else
|
|
231
|
+
Pindo::XcodeSwarkHelper.swark_run(
|
|
232
|
+
project_dir: @project_path,
|
|
233
|
+
config_json: config_json,
|
|
234
|
+
build_type: 'adhoc'
|
|
235
|
+
)
|
|
138
236
|
end
|
|
139
237
|
end
|
|
140
238
|
|
|
141
|
-
#
|
|
142
|
-
def
|
|
239
|
+
# 配置 AdHoc 证书
|
|
240
|
+
def configure_adhoc_certificate
|
|
241
|
+
puts " 配置 AdHoc 证书..."
|
|
242
|
+
|
|
243
|
+
# 检测平台类型
|
|
143
244
|
detect_macos_platform
|
|
245
|
+
platform_type = @macos_flag ? 'macos' : 'ios'
|
|
144
246
|
|
|
145
|
-
#
|
|
146
|
-
# config.json 已经通过 pull_config 方法拉取到 @project_path 目录
|
|
147
|
-
require 'pindo/module/cert/xcode_cert_helper'
|
|
247
|
+
# 使用 XcodeCertHelper 安装和配置证书
|
|
148
248
|
Pindo::XcodeCertHelper.install_and_config_certs(
|
|
149
249
|
build_type: 'adhoc',
|
|
150
|
-
platform_type:
|
|
250
|
+
platform_type: platform_type,
|
|
251
|
+
project_dir: @project_path
|
|
252
|
+
)
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
# # 创建发布 tag
|
|
256
|
+
# def create_release_tag_for_adhoc
|
|
257
|
+
# puts " 创建发布 Tag..."
|
|
258
|
+
#
|
|
259
|
+
# config_parser = Pindo::IosConfigParser.instance
|
|
260
|
+
# config_json = config_parser.config_json
|
|
261
|
+
# bundle_id = config_parser.bundle_id
|
|
262
|
+
#
|
|
263
|
+
# tag_helper = Object.new
|
|
264
|
+
# tag_helper.extend(Pindo::XcodeAppConfig)
|
|
265
|
+
# tag_helper.create_release_tag(
|
|
266
|
+
# project_dir: @project_path,
|
|
267
|
+
# config_json: config_json,
|
|
268
|
+
# bundle_id: bundle_id
|
|
269
|
+
# )
|
|
270
|
+
# end
|
|
271
|
+
|
|
272
|
+
# 处理 Applovin
|
|
273
|
+
def handle_applovin_processing
|
|
274
|
+
return unless File.exist?(File.join(@project_path, "Podfile.lock"))
|
|
275
|
+
|
|
276
|
+
begin
|
|
277
|
+
# 检查是否使用了 FancyAD 或 AppLovinSDK
|
|
278
|
+
if Pindo::CocoaPodsHelper.using_pods?(@project_path, ["FancyAD", "AppLovinSDK"])
|
|
279
|
+
puts
|
|
280
|
+
puts " 运行 Applovin Script..."
|
|
281
|
+
|
|
282
|
+
Pindo::ApplovinXcodeHelper.update_applovin_config(
|
|
283
|
+
project_dir: @project_path,
|
|
284
|
+
appstore_mode: false,
|
|
285
|
+
install_script: true,
|
|
286
|
+
upload_config: false
|
|
287
|
+
)
|
|
288
|
+
end
|
|
289
|
+
rescue => e
|
|
290
|
+
puts " ⚠ Applovin 处理失败: #{e.message}"
|
|
291
|
+
end
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
# 处理 CocoaPods
|
|
296
|
+
def handle_cocoapods
|
|
297
|
+
return unless File.exist?(File.join(@project_path, "Podfile"))
|
|
298
|
+
|
|
299
|
+
# 1. 更新私有索引库
|
|
300
|
+
Pindo::CocoaPodsHelper.update_pod_repo(
|
|
301
|
+
install: false,
|
|
151
302
|
project_dir: @project_path
|
|
152
303
|
)
|
|
304
|
+
|
|
305
|
+
# 2. 清理并重新安装
|
|
306
|
+
Pindo::CocoaPodsHelper.deintegrate_and_install(@project_path)
|
|
153
307
|
end
|
|
154
308
|
|
|
155
309
|
# 检测是否为 macOS 平台
|
|
@@ -166,15 +320,6 @@ module Pindo
|
|
|
166
320
|
end
|
|
167
321
|
end
|
|
168
322
|
|
|
169
|
-
# 更新 URL Schemes(基于最终 Bundle ID)
|
|
170
|
-
def update_url_schemes_final
|
|
171
|
-
workflow_packname = @workflow_info[:package_name]
|
|
172
|
-
Pindo::XcodeBuildConfig.update_url_schemes_with_bundleid(
|
|
173
|
-
project_dir: @project_path,
|
|
174
|
-
package_name: workflow_packname
|
|
175
|
-
)
|
|
176
|
-
end
|
|
177
|
-
|
|
178
323
|
# 编译 iOS 工程
|
|
179
324
|
def build_ios_project
|
|
180
325
|
Dir.chdir(@project_path)
|
|
@@ -5,6 +5,9 @@ require 'pindo/module/build/git_repo_helper'
|
|
|
5
5
|
require 'pindo/module/xcode/xcode_build_config'
|
|
6
6
|
require 'pindo/module/xcode/xcode_build_helper'
|
|
7
7
|
require 'pindo/module/xcode/xcode_app_config'
|
|
8
|
+
require 'pindo/module/xcode/cocoapods_helper'
|
|
9
|
+
require 'pindo/module/xcode/applovin_xcode_helper'
|
|
10
|
+
require 'pindo/module/cert/xcode_cert_helper'
|
|
8
11
|
require 'pindo/module/pgyer/pgyerhelper'
|
|
9
12
|
require 'pindo/config/ios_config_parser'
|
|
10
13
|
|
|
@@ -21,16 +24,9 @@ module Pindo
|
|
|
21
24
|
@send_flag = options[:send] || false
|
|
22
25
|
@macos_flag = false
|
|
23
26
|
|
|
24
|
-
# 接收外部传入的 JPS 配置
|
|
25
|
-
@app_info_obj = options[:app_info_obj]
|
|
26
|
-
@workflow_info = options[:workflow_info]
|
|
27
|
-
|
|
28
27
|
# 保存 Unity 根目录路径(用于查找 config.json)
|
|
29
28
|
@unity_root_path = options[:unity_root_path]
|
|
30
29
|
|
|
31
|
-
# AppStore 特有参数(可选)
|
|
32
|
-
@enable_appstore_prepare = options[:enable_appstore_prepare] || false
|
|
33
|
-
|
|
34
30
|
super(:ios, :release, options)
|
|
35
31
|
end
|
|
36
32
|
|
|
@@ -42,37 +38,11 @@ module Pindo
|
|
|
42
38
|
|
|
43
39
|
#准备构建
|
|
44
40
|
def prepare_build
|
|
45
|
-
# 如果启用 AppStore 准备,执行 AppStore 特有的准备工作
|
|
46
|
-
if @enable_appstore_prepare
|
|
47
|
-
prepare_appstore_specific
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
def execute_build
|
|
52
|
-
configure_certificate
|
|
53
|
-
build_ios_project
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
def find_output
|
|
57
|
-
build_path = File.join(@project_path, "build", "*.{ipa,app}")
|
|
58
|
-
ipa_files = Dir.glob(build_path)
|
|
59
|
-
|
|
60
|
-
if ipa_files.any?
|
|
61
|
-
latest_ipa = ipa_files.max_by { |f| File.mtime(f) }
|
|
62
|
-
puts " 找到 IPA 文件: #{latest_ipa}"
|
|
63
|
-
latest_ipa
|
|
64
|
-
else
|
|
65
|
-
puts " 警告: 未找到 IPA 文件"
|
|
66
|
-
nil
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
private
|
|
71
|
-
|
|
72
|
-
# AppStore 特有的准备工作
|
|
73
|
-
def prepare_appstore_specific
|
|
74
41
|
Dir.chdir(@project_path)
|
|
75
42
|
|
|
43
|
+
# 0. 清理 Firebase Shell Script
|
|
44
|
+
cleanup_firebase_shell
|
|
45
|
+
|
|
76
46
|
# 1. 加载配置到 IosConfigParser 单例
|
|
77
47
|
load_ios_config
|
|
78
48
|
|
|
@@ -91,26 +61,38 @@ module Pindo
|
|
|
91
61
|
# 6. 使用 appstore cert 命令
|
|
92
62
|
configure_appstore_certificate
|
|
93
63
|
|
|
94
|
-
# 7.
|
|
95
|
-
create_release_tag_for_appstore
|
|
96
|
-
|
|
97
|
-
# 8. Applovin 处理
|
|
64
|
+
# 7. Applovin 处理
|
|
98
65
|
handle_applovin_processing
|
|
99
66
|
end
|
|
100
67
|
|
|
68
|
+
def execute_build
|
|
69
|
+
handle_cocoapods
|
|
70
|
+
build_ios_project
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def find_output
|
|
74
|
+
build_path = File.join(@project_path, "build", "*.{ipa,app}")
|
|
75
|
+
ipa_files = Dir.glob(build_path)
|
|
76
|
+
|
|
77
|
+
if ipa_files.any?
|
|
78
|
+
latest_ipa = ipa_files.max_by { |f| File.mtime(f) }
|
|
79
|
+
puts " 找到 IPA 文件: #{latest_ipa}"
|
|
80
|
+
latest_ipa
|
|
81
|
+
else
|
|
82
|
+
puts " 警告: 未找到 IPA 文件"
|
|
83
|
+
nil
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
private
|
|
88
|
+
|
|
101
89
|
# 加载 iOS 配置
|
|
102
90
|
def load_ios_config
|
|
103
|
-
#
|
|
91
|
+
# 直接使用 IosConfigParser 单例中已加载的配置
|
|
104
92
|
config_parser = Pindo::IosConfigParser.instance
|
|
105
93
|
if config_parser.config_json.nil?
|
|
106
|
-
#
|
|
107
|
-
|
|
108
|
-
if File.exist?(config_file)
|
|
109
|
-
puts " 加载 iOS 配置..."
|
|
110
|
-
config_parser.load_config(config_file: config_file)
|
|
111
|
-
else
|
|
112
|
-
raise Informative, "配置文件不存在: #{config_file}"
|
|
113
|
-
end
|
|
94
|
+
# 如果单例中没有配置,说明命令层未正确初始化
|
|
95
|
+
raise Informative, "配置未加载,请确保在命令层(如 pindo appstore autobuild)已正确加载 config.json"
|
|
114
96
|
else
|
|
115
97
|
puts " 使用已加载的配置..."
|
|
116
98
|
end
|
|
@@ -257,60 +239,72 @@ module Pindo
|
|
|
257
239
|
# 配置 AppStore 证书
|
|
258
240
|
def configure_appstore_certificate
|
|
259
241
|
puts " 配置 AppStore 证书..."
|
|
260
|
-
Dir.chdir(@project_path)
|
|
261
242
|
|
|
262
|
-
#
|
|
263
|
-
|
|
243
|
+
# 检测平台类型
|
|
244
|
+
detect_macos_platform
|
|
245
|
+
platform_type = @macos_flag ? 'macos' : 'ios'
|
|
246
|
+
|
|
247
|
+
# 使用 XcodeCertHelper 安装和配置证书
|
|
248
|
+
Pindo::XcodeCertHelper.install_and_config_certs(
|
|
249
|
+
build_type: 'appstore',
|
|
250
|
+
platform_type: platform_type,
|
|
251
|
+
project_dir: @project_path
|
|
252
|
+
)
|
|
264
253
|
end
|
|
265
254
|
|
|
266
|
-
# 创建发布 tag
|
|
267
|
-
def create_release_tag_for_appstore
|
|
268
|
-
|
|
255
|
+
# # 创建发布 tag
|
|
256
|
+
# def create_release_tag_for_appstore
|
|
257
|
+
# puts " 创建发布 Tag..."
|
|
269
258
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
259
|
+
# config_parser = Pindo::IosConfigParser.instance
|
|
260
|
+
# config_json = config_parser.config_json
|
|
261
|
+
# bundle_id = config_parser.bundle_id
|
|
273
262
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
end
|
|
263
|
+
# tag_helper = Object.new
|
|
264
|
+
# tag_helper.extend(Pindo::XcodeAppConfig)
|
|
265
|
+
# tag_helper.create_release_tag(
|
|
266
|
+
# project_dir: @project_path,
|
|
267
|
+
# config_json: config_json,
|
|
268
|
+
# bundle_id: bundle_id
|
|
269
|
+
# )
|
|
270
|
+
# end
|
|
282
271
|
|
|
283
272
|
# 处理 Applovin
|
|
284
273
|
def handle_applovin_processing
|
|
285
|
-
|
|
286
|
-
return unless File.exist?(pod_lock_file)
|
|
274
|
+
return unless File.exist?(File.join(@project_path, "Podfile.lock"))
|
|
287
275
|
|
|
288
276
|
begin
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
pods_array = []
|
|
292
|
-
|
|
293
|
-
if !pod_lock_json["SPEC REPOS"].nil?
|
|
294
|
-
pod_lock_json["SPEC REPOS"].each do |source, pod_items|
|
|
295
|
-
pods_array += pod_items
|
|
296
|
-
end
|
|
297
|
-
end
|
|
298
|
-
|
|
299
|
-
if pods_array.include?("FancyAD") || pods_array.include?("AppLovinSDK")
|
|
277
|
+
# 检查是否使用了 FancyAD 或 AppLovinSDK
|
|
278
|
+
if Pindo::CocoaPodsHelper.using_pods?(@project_path, ["FancyAD", "AppLovinSDK"])
|
|
300
279
|
puts
|
|
301
280
|
puts " 运行 Applovin Script..."
|
|
302
|
-
Dir.chdir(@project_path)
|
|
303
281
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
282
|
+
Pindo::ApplovinXcodeHelper.update_applovin_config(
|
|
283
|
+
project_dir: @project_path,
|
|
284
|
+
appstore_mode: true,
|
|
285
|
+
install_script: true,
|
|
286
|
+
upload_config: false
|
|
287
|
+
)
|
|
308
288
|
end
|
|
309
289
|
rescue => e
|
|
310
290
|
puts " ⚠ Applovin 处理失败: #{e.message}"
|
|
311
291
|
end
|
|
312
292
|
end
|
|
313
293
|
|
|
294
|
+
# 处理 CocoaPods
|
|
295
|
+
def handle_cocoapods
|
|
296
|
+
return unless File.exist?(File.join(@project_path, "Podfile"))
|
|
297
|
+
|
|
298
|
+
# 1. 更新私有索引库
|
|
299
|
+
Pindo::CocoaPodsHelper.update_pod_repo(
|
|
300
|
+
install: false,
|
|
301
|
+
project_dir: @project_path
|
|
302
|
+
)
|
|
303
|
+
|
|
304
|
+
# 2. 清理并重新安装
|
|
305
|
+
Pindo::CocoaPodsHelper.deintegrate_and_install(@project_path)
|
|
306
|
+
end
|
|
307
|
+
|
|
314
308
|
# 检测是否为 macOS 平台
|
|
315
309
|
def detect_macos_platform
|
|
316
310
|
project_fullname = Dir.glob(File.join(@project_path, "/*.xcodeproj")).max_by { |f| File.mtime(f) }
|
|
@@ -325,26 +319,6 @@ module Pindo
|
|
|
325
319
|
end
|
|
326
320
|
end
|
|
327
321
|
|
|
328
|
-
# 配置证书
|
|
329
|
-
def configure_certificate
|
|
330
|
-
detect_macos_platform
|
|
331
|
-
|
|
332
|
-
# 如果启用了 AppStore 准备,证书配置在 configure_appstore_certificate 中完成
|
|
333
|
-
if @enable_appstore_prepare
|
|
334
|
-
# 证书已在 configure_appstore_certificate 中配置
|
|
335
|
-
return
|
|
336
|
-
end
|
|
337
|
-
|
|
338
|
-
# 使用新的证书安装方法
|
|
339
|
-
# config.json 已经通过 pull_config 方法拉取到 @project_path 目录
|
|
340
|
-
require 'pindo/module/cert/xcode_cert_helper'
|
|
341
|
-
Pindo::XcodeCertHelper.install_and_config_certs(
|
|
342
|
-
build_type: 'release',
|
|
343
|
-
platform_type: @macos_flag ? 'macos' : 'ios',
|
|
344
|
-
project_dir: @project_path
|
|
345
|
-
)
|
|
346
|
-
end
|
|
347
|
-
|
|
348
322
|
# 编译 iOS 工程
|
|
349
323
|
def build_ios_project
|
|
350
324
|
Dir.chdir(@project_path)
|