pindo 5.2.4 → 5.3.7
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/base/aeshelper.rb +23 -2
- data/lib/pindo/base/pindocontext.rb +259 -0
- data/lib/pindo/client/pgyer_feishu_oauth_cli.rb +343 -80
- data/lib/pindo/client/pgyerclient.rb +30 -20
- data/lib/pindo/command/android/autobuild.rb +52 -22
- data/lib/pindo/command/android/build.rb +27 -16
- data/lib/pindo/command/android/debug.rb +25 -15
- data/lib/pindo/command/dev/debug.rb +2 -51
- data/lib/pindo/command/dev/feishu.rb +19 -2
- data/lib/pindo/command/ios/adhoc.rb +2 -1
- data/lib/pindo/command/ios/autobuild.rb +35 -8
- data/lib/pindo/command/ios/debug.rb +2 -132
- data/lib/pindo/command/lib/lint.rb +24 -1
- data/lib/pindo/command/setup.rb +24 -4
- data/lib/pindo/command/unity/apk.rb +15 -0
- data/lib/pindo/command/unity/ipa.rb +16 -0
- data/lib/pindo/command.rb +13 -2
- data/lib/pindo/module/android/android_build_config_helper.rb +425 -0
- data/lib/pindo/module/android/apk_helper.rb +23 -25
- data/lib/pindo/module/android/base_helper.rb +572 -0
- data/lib/pindo/module/android/build_helper.rb +8 -318
- data/lib/pindo/module/android/gp_compliance_helper.rb +668 -0
- data/lib/pindo/module/android/gradle_helper.rb +746 -3
- data/lib/pindo/module/appselect.rb +18 -5
- data/lib/pindo/module/build/buildhelper.rb +120 -29
- data/lib/pindo/module/build/unityhelper.rb +675 -18
- data/lib/pindo/module/build/versionhelper.rb +146 -0
- data/lib/pindo/module/cert/certhelper.rb +33 -2
- data/lib/pindo/module/cert/xcodecerthelper.rb +3 -1
- data/lib/pindo/module/pgyer/pgyerhelper.rb +114 -31
- data/lib/pindo/module/xcode/xcodebuildconfig.rb +232 -0
- data/lib/pindo/module/xcode/xcodebuildhelper.rb +0 -1
- data/lib/pindo/version.rb +356 -86
- data/lib/pindo.rb +72 -3
- metadata +5 -1
@@ -107,14 +107,24 @@ module Pindo
|
|
107
107
|
end
|
108
108
|
|
109
109
|
def get_selected_dev_bundleid()
|
110
|
+
# 检查缓存
|
111
|
+
require_relative '../base/pindocontext'
|
112
|
+
context = Pindo::PindoContext.instance
|
113
|
+
cached_bundleid = context.get_selection(Pindo::PindoContext::SelectionKey::BUNDLE_ID)
|
114
|
+
|
115
|
+
if cached_bundleid
|
116
|
+
puts "\n使用之前选择的Bundle ID: #{cached_bundleid}"
|
117
|
+
puts
|
118
|
+
return cached_bundleid
|
119
|
+
end
|
110
120
|
|
111
121
|
all_bundleid = []
|
112
|
-
all_bundleid = all_bundleid | all_dev_bundleid()
|
122
|
+
all_bundleid = all_bundleid | all_dev_bundleid()
|
113
123
|
all_bundleid = all_bundleid | all_tool_bundleid()
|
114
|
-
|
124
|
+
|
115
125
|
cli = HighLine.new
|
116
126
|
menu_choice="None"
|
117
|
-
puts
|
127
|
+
puts
|
118
128
|
cli.choose do |menu| # you can also use constants like :blue
|
119
129
|
menu.header = "可用的Bundle Id如下:"
|
120
130
|
menu.prompt = "请选择使用的Bundle Id,请输入选项(1/2/3...):"
|
@@ -133,9 +143,12 @@ module Pindo
|
|
133
143
|
if menu_choice.eql?("com.heroneverdie101.*")
|
134
144
|
menu_choice = "com.heroneverdie101"
|
135
145
|
end
|
136
|
-
|
146
|
+
|
147
|
+
# 保存选择到缓存
|
148
|
+
context.set_selection(Pindo::PindoContext::SelectionKey::BUNDLE_ID, menu_choice)
|
149
|
+
|
137
150
|
return menu_choice;
|
138
|
-
|
151
|
+
|
139
152
|
end
|
140
153
|
|
141
154
|
def get_selected_deploy_bundleid()
|
@@ -2,6 +2,8 @@ require 'singleton'
|
|
2
2
|
require 'fileutils'
|
3
3
|
require 'xcodeproj' # 用于iOS项目检查
|
4
4
|
require_relative '../android/base_helper'
|
5
|
+
require_relative '../../base/githelper'
|
6
|
+
require_relative '../../base/pindocontext'
|
5
7
|
module Pindo
|
6
8
|
|
7
9
|
class BuildHelper
|
@@ -9,6 +11,9 @@ module Pindo
|
|
9
11
|
include BaseAndroidHelper
|
10
12
|
include Pindo::Githelper
|
11
13
|
|
14
|
+
# 临时缓存,只在内存中,不保存到文件
|
15
|
+
attr_accessor :temp_tag_decision
|
16
|
+
|
12
17
|
class << self
|
13
18
|
def share_instance
|
14
19
|
instance
|
@@ -139,36 +144,93 @@ module Pindo
|
|
139
144
|
tag_action_parms = []
|
140
145
|
is_need_add_tag = false
|
141
146
|
else
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
"终止退出编译" => -> {
|
147
|
+
# 检查是否已有用户选择
|
148
|
+
context = PindoContext.instance
|
149
|
+
build_helper = BuildHelper.share_instance
|
150
|
+
# 优先从持久化缓存读取,如果没有则从内存临时缓存读取
|
151
|
+
cached_decision = context.get_selection(PindoContext::SelectionKey::TAG_DECISION) ||
|
152
|
+
build_helper.temp_tag_decision
|
153
|
+
|
154
|
+
if cached_decision
|
155
|
+
# 使用之前的选择
|
156
|
+
puts "\n使用之前的选择:#{cached_decision[:description]}"
|
157
|
+
tag_action_parms = cached_decision[:tag_action_parms]
|
158
|
+
is_need_add_tag = cached_decision[:is_need_add_tag]
|
159
|
+
|
160
|
+
# 如果是退出选择,则抛出异常
|
161
|
+
if cached_decision[:action] == :exit
|
158
162
|
raise Informative, "终止退出编译!"
|
159
|
-
|
163
|
+
end
|
164
|
+
else
|
165
|
+
# 第一次询问
|
166
|
+
cli = HighLine.new
|
167
|
+
selected_action = nil
|
168
|
+
selected_description = nil
|
169
|
+
|
170
|
+
menu_options = {
|
171
|
+
"新增版本号,打新Tag" => -> {
|
172
|
+
tag_action_parms = []
|
173
|
+
selected_action = :new_tag
|
174
|
+
selected_description = "新增版本号,打新Tag"
|
175
|
+
:new_tag
|
176
|
+
},
|
177
|
+
"将上次的Tag删除重新打Tag" => -> {
|
178
|
+
tag_action_parms = []
|
179
|
+
tag_action_parms << "--retag"
|
180
|
+
selected_action = :recreate_tag
|
181
|
+
selected_description = "将上次的Tag删除重新打Tag"
|
182
|
+
:recreate_tag
|
183
|
+
},
|
184
|
+
"不需要Tag继续编译且上传,手动修改上传备注" => -> {
|
185
|
+
puts ""
|
186
|
+
selected_action = :continue_without_tag
|
187
|
+
selected_description = "不需要Tag继续编译且上传"
|
188
|
+
:continue_without_tag
|
189
|
+
},
|
190
|
+
"终止退出编译" => -> {
|
191
|
+
selected_action = :exit
|
192
|
+
selected_description = "终止退出编译"
|
193
|
+
raise Informative, "终止退出编译!"
|
194
|
+
:exit
|
195
|
+
}
|
160
196
|
}
|
161
|
-
}
|
162
197
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
198
|
+
result = cli.choose do |menu|
|
199
|
+
menu.header = "当前代码并没有打Tag,上传的Changelog需要Tag"
|
200
|
+
menu.prompt = "请选中打Tag的方式, 请输入选项(1/2/3...):"
|
201
|
+
menu_options.each do |option, action|
|
202
|
+
menu.choice(option) { action.call }
|
203
|
+
end
|
168
204
|
end
|
169
|
-
end
|
170
205
|
|
171
|
-
|
206
|
+
is_need_add_tag = !tag_action_parms.nil?
|
207
|
+
|
208
|
+
# 保存用户选择
|
209
|
+
build_helper = BuildHelper.share_instance
|
210
|
+
# 只有选择"新增版本号,打新Tag"时才保存到持久化缓存
|
211
|
+
# 其他选项只保存到临时缓存(内存中)
|
212
|
+
if selected_action == :new_tag
|
213
|
+
# 保存到持久化缓存(文件)
|
214
|
+
context.set_selection(PindoContext::SelectionKey::TAG_DECISION, {
|
215
|
+
action: selected_action,
|
216
|
+
description: selected_description,
|
217
|
+
tag_action_parms: tag_action_parms,
|
218
|
+
is_need_add_tag: is_need_add_tag
|
219
|
+
})
|
220
|
+
# 清除临时缓存
|
221
|
+
build_helper.temp_tag_decision = nil
|
222
|
+
else
|
223
|
+
# 清空持久化缓存
|
224
|
+
context.set_selection(PindoContext::SelectionKey::TAG_DECISION, nil)
|
225
|
+
# 保存到临时缓存(仅在内存中,不会写入文件)
|
226
|
+
build_helper.temp_tag_decision = {
|
227
|
+
action: selected_action,
|
228
|
+
description: selected_description,
|
229
|
+
tag_action_parms: tag_action_parms,
|
230
|
+
is_need_add_tag: is_need_add_tag
|
231
|
+
}
|
232
|
+
end
|
233
|
+
end
|
172
234
|
end
|
173
235
|
end
|
174
236
|
end
|
@@ -214,18 +276,40 @@ module Pindo
|
|
214
276
|
|
215
277
|
def android_project?(project_path)
|
216
278
|
# 检查Android工程的关键文件和目录
|
217
|
-
gradle_file = File.exist?(File.join(project_path, "build.gradle"))
|
218
|
-
settings_gradle = File.exist?(File.join(project_path, "settings.gradle"))
|
279
|
+
gradle_file = File.exist?(File.join(project_path, "build.gradle")) || File.exist?(File.join(project_path, "build.gradle.kts"))
|
280
|
+
settings_gradle = File.exist?(File.join(project_path, "settings.gradle")) || File.exist?(File.join(project_path, "settings.gradle.kts"))
|
219
281
|
|
220
|
-
|
282
|
+
# 尝试获取主模块
|
283
|
+
main_module = nil
|
284
|
+
begin
|
285
|
+
main_module = get_main_module(project_path)
|
286
|
+
rescue => e
|
287
|
+
puts "获取主模块失败: #{e.message}" if ENV['DEBUG']
|
288
|
+
end
|
221
289
|
|
222
290
|
# Android Studio项目结构
|
223
291
|
if gradle_file && settings_gradle && main_module
|
224
|
-
app_gradle = File.exist?(File.join(main_module, "build.gradle"))
|
292
|
+
app_gradle = File.exist?(File.join(main_module, "build.gradle")) || File.exist?(File.join(main_module, "build.gradle.kts"))
|
225
293
|
app_manifest = File.exist?(File.join(main_module, "src", "main", "AndroidManifest.xml"))
|
226
294
|
return true if app_gradle && app_manifest
|
227
295
|
end
|
228
296
|
|
297
|
+
# 如果无法通过标准方式检测,尝试更宽松的检测
|
298
|
+
# 检查是否有任何包含 build.gradle 的子目录
|
299
|
+
if gradle_file && settings_gradle
|
300
|
+
Dir.entries(project_path).each do |entry|
|
301
|
+
next if entry.start_with?('.')
|
302
|
+
entry_path = File.join(project_path, entry)
|
303
|
+
if File.directory?(entry_path)
|
304
|
+
app_gradle = File.exist?(File.join(entry_path, "build.gradle")) || File.exist?(File.join(entry_path, "build.gradle.kts"))
|
305
|
+
app_manifest = File.exist?(File.join(entry_path, "src", "main", "AndroidManifest.xml"))
|
306
|
+
if app_gradle && app_manifest
|
307
|
+
return true
|
308
|
+
end
|
309
|
+
end
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
229
313
|
false
|
230
314
|
end
|
231
315
|
|
@@ -261,6 +345,13 @@ module Pindo
|
|
261
345
|
File.basename(xcodeproj, ".xcodeproj") if xcodeproj
|
262
346
|
when :android
|
263
347
|
settings_gradle = File.join(project_path, "settings.gradle")
|
348
|
+
settings_gradle_kts = File.join(project_path, "settings.gradle.kts")
|
349
|
+
|
350
|
+
# 优先使用 settings.gradle.kts,如果不存在则使用 settings.gradle
|
351
|
+
if File.exist?(settings_gradle_kts)
|
352
|
+
settings_gradle = settings_gradle_kts
|
353
|
+
end
|
354
|
+
|
264
355
|
if File.exist?(settings_gradle)
|
265
356
|
content = File.read(settings_gradle)
|
266
357
|
if content =~ /rootProject\.name\s*=\s*['"](.+)['"]/
|