pindo 5.10.6 → 5.10.9

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 (79) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pindo/base/funlog.rb +12 -1
  3. data/lib/pindo/base/pindocontext.rb +3 -0
  4. data/lib/pindo/command/android/autobuild.rb +62 -9
  5. data/lib/pindo/command/android/build.rb +6 -6
  6. data/lib/pindo/command/android/debug.rb +9 -9
  7. data/lib/pindo/command/android.rb +1 -1
  8. data/lib/pindo/command/appstore.rb +1 -1
  9. data/lib/pindo/command/deploy/build.rb +2 -4
  10. data/lib/pindo/command/deploy/cert.rb +4 -5
  11. data/lib/pindo/command/deploy/configproj.rb +3 -3
  12. data/lib/pindo/command/deploy/confusecode.rb +1 -1
  13. data/lib/pindo/command/deploy/confuseproj.rb +1 -1
  14. data/lib/pindo/command/deploy/pem.rb +3 -4
  15. data/lib/pindo/command/dev/autobuild.rb +1 -1
  16. data/lib/pindo/command/dev/build.rb +1 -1
  17. data/lib/pindo/command/dev/feishu.rb +1 -1
  18. data/lib/pindo/command/gplay/pullconfig.rb +48 -0
  19. data/lib/pindo/command/gplay.rb +7 -6
  20. data/lib/pindo/command/ios/adhoc.rb +6 -5
  21. data/lib/pindo/command/ios/autobuild.rb +24 -24
  22. data/lib/pindo/command/ios/build.rb +7 -6
  23. data/lib/pindo/command/ios/debug.rb +1 -0
  24. data/lib/pindo/command/ios.rb +1 -1
  25. data/lib/pindo/command/ipa/import.rb +2 -3
  26. data/lib/pindo/command/ipa/output.rb +2 -3
  27. data/lib/pindo/command/jps/upload.rb +6 -5
  28. data/lib/pindo/command/unity/apk.rb +19 -2
  29. data/lib/pindo/command/unity/autobuild.rb +58 -63
  30. data/lib/pindo/command/unity/initpack.rb +1 -1
  31. data/lib/pindo/command/unity/ipa.rb +17 -14
  32. data/lib/pindo/command/unity/pack.rb +1 -1
  33. data/lib/pindo/command/unity/upload.rb +1 -1
  34. data/lib/pindo/command/unity/web.rb +2 -2
  35. data/lib/pindo/command/utils/icon.rb +1 -1
  36. data/lib/pindo/command/utils/renewcert.rb +1 -2
  37. data/lib/pindo/command/utils/renewproj.rb +9 -10
  38. data/lib/pindo/command/web/autobuild.rb +2 -2
  39. data/lib/pindo/command/web/run.rb +1 -1
  40. data/lib/pindo/command.rb +2 -1
  41. data/lib/pindo/module/android/android_build_config_helper.rb +267 -35
  42. data/lib/pindo/module/android/android_build_helper.rb +300 -0
  43. data/lib/pindo/module/android/android_project_helper.rb +279 -0
  44. data/lib/pindo/module/android/gp_compliance_helper.rb +33 -87
  45. data/lib/pindo/module/android/gradle_helper.rb +524 -255
  46. data/lib/pindo/module/android/java_env_helper.rb +633 -0
  47. data/lib/pindo/module/android/keystore_helper.rb +1118 -0
  48. data/lib/pindo/module/appselect.rb +109 -0
  49. data/lib/pindo/module/appstore/appstore_in_app_purchase.rb +1 -1
  50. data/lib/pindo/module/build/{buildhelper.rb → build_helper.rb} +1 -2
  51. data/lib/pindo/module/build/{commonconfuseproj.rb → confuse_xcodeproj.rb} +2 -2
  52. data/lib/pindo/module/cert/cert_helper.rb +245 -0
  53. data/lib/pindo/module/cert/keychain_helper.rb +152 -0
  54. data/lib/pindo/module/cert/pem_helper.rb +67 -0
  55. data/lib/pindo/module/cert/xcodecerthelper.rb +2 -2
  56. data/lib/pindo/module/pgyer/pgyerhelper.rb +21 -1
  57. data/lib/pindo/module/{build/unityhelper.rb → unity/unity_helper.rb} +0 -17
  58. data/lib/pindo/module/xcode/{xcodereshandler.rb → res/xcode_res_handler.rb} +1 -1
  59. data/lib/pindo/module/xcode/{xcodebuildconfig.rb → xcode_build_config.rb} +7 -6
  60. data/lib/pindo/module/xcode/{xcodebuildhelper.rb → xcode_build_helper.rb} +4 -3
  61. data/lib/pindo/module/xcode/{xcodehelper.rb → xcode_project_helper.rb} +4 -2
  62. data/lib/pindo/module/xcode/{xcodereshelper.rb → xcode_res_helper.rb} +12 -9
  63. data/lib/pindo/version.rb +185 -7
  64. data/lib/pindo.rb +14 -9
  65. metadata +24 -23
  66. data/lib/pindo/module/android/apk_helper.rb +0 -138
  67. data/lib/pindo/module/android/base_helper.rb +0 -964
  68. data/lib/pindo/module/android/build_helper.rb +0 -128
  69. data/lib/pindo/module/android/so_helper.rb +0 -18
  70. data/lib/pindo/module/cert/certhelper.rb +0 -246
  71. data/lib/pindo/module/cert/keychainhelper.rb +0 -150
  72. data/lib/pindo/module/cert/pemhelper.rb +0 -65
  73. /data/lib/pindo/module/android/{androidreshelper.rb → android_res_helper.rb} +0 -0
  74. /data/lib/pindo/module/appstore/{iap_tier.json → appstore_iap_tier.json} +0 -0
  75. /data/lib/pindo/module/build/{swarkhelper.rb → swark_helper.rb} +0 -0
  76. /data/lib/pindo/module/build/{versionhelper.rb → version_helper.rb} +0 -0
  77. /data/lib/pindo/module/cert/{provisioninghelper.rb → provisioning_helper.rb} +0 -0
  78. /data/lib/pindo/module/unity/{nugethelper.rb → nuget_helper.rb} +0 -0
  79. /data/lib/pindo/module/xcode/{xcoderesconstant.rb → res/xcode_res_constant.rb} +0 -0
@@ -192,11 +192,6 @@ module Pindo
192
192
 
193
193
  # 如果是 Android 平台,检查 Java 版本
194
194
  platform = additional_args[:platform]
195
- if platform == 'Android'
196
- unless ensure_java_version_for_android
197
- raise Informative, "Java 版本不符合要求,无法继续构建 Android 项目"
198
- end
199
- end
200
195
 
201
196
  cmd_args = [
202
197
  unity_exe_full_path,
@@ -887,18 +882,6 @@ module Pindo
887
882
  File.exist?(File.join(project_settings_path, "ProjectSettings.asset"))
888
883
  end
889
884
 
890
- # 确保 Android 构建所需的 Java 版本
891
- def ensure_java_version_for_android
892
- # 动态加载 BaseAndroidHelper 模块
893
- require_relative '../android/base_helper'
894
-
895
- # 创建一个临时对象来调用方法
896
- helper = Object.new
897
- helper.extend(Pindo::BaseAndroidHelper)
898
-
899
- # 调用 Java 版本检测方法
900
- helper.ensure_java_version_compliance
901
- end
902
885
  end
903
886
  end
904
887
  end
@@ -33,7 +33,7 @@ module Pindo
33
33
  if icon_path.nil? || icon_path.empty? || !File.exist?(icon_path)
34
34
  icon_path_array = Dir.glob(File.join(project_dir, "**", "AppIcon.appiconset"))
35
35
  if icon_path_array.size > 1
36
- icon_path = icon_path_array.select{ |filename| File.directory?(filename) && filename.include?("Assets.xcassets/AppIcon.appiconset")}
36
+ icon_path = icon_path_array.find{ |filename| File.directory?(filename) && filename.include?("Assets.xcassets/AppIcon.appiconset")}
37
37
  elsif icon_path_array.size == 1
38
38
  icon_path = icon_path_array.first
39
39
  end
@@ -1,6 +1,7 @@
1
1
  require 'fileutils'
2
2
  require 'xcodeproj'
3
3
  require 'json'
4
+ require 'pindo/module/xcode/xcode_res_helper'
4
5
  require 'open-uri'
5
6
  require_relative '../../base/funlog'
6
7
 
@@ -13,18 +14,18 @@ module Pindo
13
14
  # 注意:此函数只添加基于package_name的URL Scheme,基于实际Bundle ID的URL Scheme
14
15
  # 将在update_url_schemes_with_bundleid函数中统一添加(在证书配置之后)
15
16
  # @param project_dir [String] iOS项目目录路径
16
- # @param package_name [String] 工作流的package_name(如:"Test Demo")
17
+ # @param workflow_packname [String] 工作流的名称(如:"Test Demo")
17
18
  # @param project_id [String] JPS项目ID(可选,用于添加快捷操作)
18
19
  # @return [Boolean] 是否成功更新
19
- def self.update_project_with_packagename(project_dir: nil, package_name: nil, project_id: nil)
20
+ def self.update_project_with_workflow(project_dir: nil, workflow_packname: nil, project_id: nil)
20
21
  raise ArgumentError, "项目目录不能为空" if project_dir.nil?
21
- raise ArgumentError, "Package Name不能为空" if package_name.nil?
22
+ raise ArgumentError, "Workflow Package Name不能为空" if workflow_packname.nil?
22
23
 
23
24
  # 生成各种值
24
- display_name = package_name.gsub(/[^a-zA-Z0-9\s]/, '').gsub(/\s+/, '')
25
- bundle_id_suffix = package_name.gsub(/[^a-zA-Z0-9]/, '').downcase
25
+ display_name = workflow_packname.gsub(/[^a-zA-Z0-9\s]/, '').gsub(/\s+/, '')
26
+ bundle_id_suffix = workflow_packname.gsub(/[^a-zA-Z0-9]/, '').downcase
26
27
  final_bundle_id = "com.heroneverdie101.#{bundle_id_suffix}"
27
- package_scheme = package_name.gsub(/[^a-zA-Z0-9]/, '').downcase
28
+ package_scheme = workflow_packname.gsub(/[^a-zA-Z0-9]/, '').downcase
28
29
 
29
30
  project_fullname = Dir.glob(File.join(project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
30
31
  return false if project_fullname.nil?
@@ -5,9 +5,10 @@ require 'pindo/module/cert/xcodecerthelper'
5
5
 
6
6
  module Pindo
7
7
 
8
- module XcodeBuildHelper
8
+ class XcodeBuildHelper
9
+ class << self
9
10
 
10
- def pull_podfile_lock(project_dir:nil, app_config_dir:nil)
11
+ def pull_podfile_lock(project_dir:nil, app_config_dir:nil)
11
12
  begin
12
13
  src_pod_file = File.join(app_config_dir, "Podfile.lock")
13
14
  build_verify_file = File.join(app_config_dir, "build_verify.json")
@@ -399,7 +400,7 @@ module Pindo
399
400
  end
400
401
  end
401
402
 
402
-
403
+ end
403
404
  end
404
405
 
405
406
  end
@@ -3,9 +3,10 @@ require 'xcodeproj'
3
3
 
4
4
  module Pindo
5
5
 
6
- module XcodeHelper
6
+ class XcodeProjectHelper
7
+ class << self
7
8
 
8
- def get_target_by_name(proj_obj:nil, name:nil)
9
+ def get_target_by_name(proj_obj:nil, name:nil)
9
10
  new_target = nil
10
11
  proj_obj.targets.each do |target|
11
12
  if target.name.to_s.eql?(name)
@@ -516,6 +517,7 @@ module Pindo
516
517
 
517
518
  end
518
519
 
520
+ end
519
521
  end
520
522
 
521
523
  end
@@ -1,13 +1,15 @@
1
1
  require 'fileutils'
2
2
  require 'xcodeproj'
3
3
  require 'json'
4
- require 'pindo/module/xcode/xcodereshandler'
5
- require 'pindo/module/xcode/xcoderesconstant'
4
+ require 'pindo/module/xcode/res/xcode_res_handler'
5
+ require 'pindo/module/xcode/res/xcode_res_constant'
6
6
 
7
7
  module Pindo
8
8
 
9
- module XcodeResHelper
10
- def self.create_icon(icon_name:nil, new_icon_dir:nil, xcode_icon_json:nil)
9
+ class XcodeResHelper
10
+ class << self
11
+
12
+ def create_icon(icon_name:nil, new_icon_dir:nil, xcode_icon_json:nil)
11
13
  if !File.exist?(icon_name)
12
14
  raise Informative, "文件不存在:#{icon_name}"
13
15
  end
@@ -41,7 +43,7 @@ module Pindo
41
43
  end
42
44
 
43
45
 
44
- def self.create_imessage_icon(icon_name:nil, image_icon_name:nil, new_icon_dir:nil, xcode_icon_json:nil)
46
+ def create_imessage_icon(icon_name:nil, image_icon_name:nil, new_icon_dir:nil, xcode_icon_json:nil)
45
47
  if !File.exist?(icon_name) || !File.exist?(image_icon_name)
46
48
  raise Informative, "文件不存在:#{image_icon_name} or #{icon_name}"
47
49
  end
@@ -75,7 +77,7 @@ module Pindo
75
77
  end
76
78
  end
77
79
 
78
- def self.create_icons(icon_name:nil, new_icon_dir:nil)
80
+ def create_icons(icon_name:nil, new_icon_dir:nil)
79
81
  begin
80
82
  FileUtils.mkdir_p(new_icon_dir)
81
83
  rescue => e
@@ -95,8 +97,8 @@ module Pindo
95
97
  create_imessage_icon(icon_name: icon_name, image_icon_name:imessage_icon, new_icon_dir: new_imessage_icon_dir, xcode_icon_json: XcodoeResConst.xcode_ios_imessage_icon_json)
96
98
  end
97
99
  end
98
-
99
- def self.install_icon(proj_dir:nil, new_icon_dir:nil)
100
+
101
+ def install_icon(proj_dir:nil, new_icon_dir:nil)
100
102
  xcodeproj_file_name = Dir.glob(File.join(proj_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
101
103
  xcodereshandler = XcodeResHandler.new(proj_fullname: xcodeproj_file_name)
102
104
  xcodereshandler.install_icon_res(new_icon_dir: new_icon_dir)
@@ -109,12 +111,13 @@ module Pindo
109
111
  end
110
112
  end
111
113
 
112
- def self.install_launchimg(proj_dir:nil, launchimg_pub_path:nil)
114
+ def install_launchimg(proj_dir:nil, launchimg_pub_path:nil)
113
115
  xcodeproj_file_name = Dir.glob(File.join(proj_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
114
116
  xcodereshandler = XcodeResHandler.new(proj_fullname: xcodeproj_file_name)
115
117
  xcodereshandler.install_launchimg(launchimg_pub_path:launchimg_pub_path)
116
118
  end
117
119
 
120
+ end
118
121
  end
119
122
 
120
123
  end
data/lib/pindo/version.rb CHANGED
@@ -6,17 +6,50 @@ require 'time'
6
6
 
7
7
  module Pindo
8
8
 
9
- VERSION = "5.10.6"
9
+ VERSION = "5.10.9"
10
10
 
11
11
  class VersionCheck
12
12
  RUBYGEMS_API = 'https://rubygems.org/api/v1/gems/pindo.json'
13
13
  VERSION_INFO_FILE = File.expand_path('~/.pindo/version_info.yml')
14
14
  CHECK_INTERVAL = 5 * 60 * 60 # 5小时检查一次
15
+ CONFIG_MIN_VERSION = '1.0.0' # 硬编码的配置版本要求
15
16
 
16
17
  class << self
17
18
  # 主版本检查方法(保持向后兼容)
18
- def check_pindo_new_version
19
+
20
+ def check_pindo_config
21
+ return if ENV['PINDO_SKIP_CONFIG_CHECK']
22
+
23
+ puts " 📋 检查配置版本...".green if ENV['PINDO_DEBUG']
24
+
19
25
  begin
26
+ pindo_dir = File.expand_path(ENV['PINDO_DIR'] || '~/.pindo')
27
+ config_file = File.join(pindo_dir, "pindo_common_config", "pindo_config.json")
28
+
29
+ # 检查是否需要更新
30
+ need_update = config_needs_update?(config_file)
31
+
32
+ if need_update
33
+ puts "\n⚠️ 配置版本需要更新".yellow
34
+ puts "正在更新配置...".green
35
+ update_config_repos(pindo_dir)
36
+ puts "✅ 配置更新完成\n".green
37
+
38
+ # 触发配置重载
39
+ Pindoconfig.reload_instance
40
+ else
41
+ puts " ✅ 配置版本符合要求".green if ENV['PINDO_DEBUG']
42
+ end
43
+
44
+ rescue => e
45
+ puts "⚠️ 配置版本检查失败: #{e.message}".yellow
46
+ puts e.backtrace.join("\n") if ENV['PINDO_DEBUG']
47
+ # 不影响程序继续运行
48
+ end
49
+ end
50
+
51
+ def check_pindo_new_version
52
+ # begin
20
53
  return if ENV['PINDO_NO_UPDATE_CHECK'] # 允许用户禁用
21
54
 
22
55
  puts " 🔄 执行版本检查...".green if ENV['PINDO_DEBUG']
@@ -36,11 +69,11 @@ module Pindo
36
69
  check_from_config_file
37
70
  end
38
71
 
39
- rescue => e
40
- puts " ❌ 版本检查出错: #{e.message}".red if ENV['PINDO_DEBUG']
41
- puts e.backtrace.join("\n") if ENV['PINDO_DEBUG']
42
- # 静默失败,不影响主程序
43
- end
72
+ # rescue => e
73
+ # puts " ❌ 版本检查出错: #{e.message}".red if ENV['PINDO_DEBUG']
74
+ # puts e.backtrace.join("\n") if ENV['PINDO_DEBUG']
75
+ # # 静默失败,不影响主程序
76
+ # end
44
77
  end
45
78
 
46
79
  # 强制更新检查
@@ -376,6 +409,151 @@ module Pindo
376
409
  puts "\n"
377
410
  puts "程序将退出,请更新后重试。".red
378
411
  end
412
+
413
+
414
+ private
415
+
416
+ # 检查配置是否需要更新
417
+ def config_needs_update?(config_file)
418
+ # 文件不存在
419
+ unless File.exist?(config_file)
420
+ puts " ⚠️ 配置文件不存在: #{config_file}".yellow if ENV['PINDO_DEBUG']
421
+ return true
422
+ end
423
+
424
+ # 检查版本
425
+ begin
426
+ config = JSON.parse(File.read(config_file))
427
+ current_version = config['pindo_config_version']
428
+
429
+ puts " 📌 当前配置版本: #{current_version || 'nil'}".cyan if ENV['PINDO_DEBUG']
430
+ puts " 📌 要求最低版本: #{CONFIG_MIN_VERSION}".cyan if ENV['PINDO_DEBUG']
431
+
432
+ # 没有版本号
433
+ if current_version.nil?
434
+ puts " ⚠️ 配置文件缺少版本信息".yellow if ENV['PINDO_DEBUG']
435
+ return true
436
+ end
437
+
438
+ # 版本过低
439
+ if Gem::Version.new(current_version) < Gem::Version.new(CONFIG_MIN_VERSION)
440
+ puts " ⚠️ 配置版本过低 (#{current_version} < #{CONFIG_MIN_VERSION})".yellow if ENV['PINDO_DEBUG']
441
+ return true
442
+ end
443
+
444
+ false
445
+ rescue => e
446
+ # JSON 解析错误等情况
447
+ puts " ⚠️ 配置文件解析失败: #{e.message}".yellow if ENV['PINDO_DEBUG']
448
+ true
449
+ end
450
+ end
451
+
452
+ # 更新配置仓库
453
+ def update_config_repos(pindo_dir)
454
+ # 1. 更新 pindo_common_config
455
+ common_config_url = "https://gitee.com/goodbuildtest/pindo_common_config.git"
456
+ update_git_repo(
457
+ dir: File.join(pindo_dir, "pindo_common_config"),
458
+ url: common_config_url
459
+ )
460
+
461
+ # 2. 重新读取配置文件,获取环境仓库 URL
462
+ config_file = File.join(pindo_dir, "pindo_common_config", "pindo_config.json")
463
+ env_urls = {}
464
+ begin
465
+ if File.exist?(config_file)
466
+ config = JSON.parse(File.read(config_file))
467
+ if config['pindo_config_env']
468
+ env_urls = config['pindo_config_env']
469
+ end
470
+ end
471
+ rescue => e
472
+ puts " ⚠️ 读取环境配置 URL 失败: #{e.message}".yellow if ENV['PINDO_DEBUG']
473
+ end
474
+
475
+ # 3. 判断环境并更新对应配置
476
+ env_name = get_current_env(pindo_dir)
477
+ if env_name && env_urls[env_name]
478
+ # 根据环境名称确定目录名
479
+ env_dir_name = case env_name
480
+ when "dreamstudio_config"
481
+ "pindo_dreamstudio_config"
482
+ when "workhard_config"
483
+ "pindo_workhard_config"
484
+ else
485
+ "pindo_#{env_name.sub('_config', '')}_config"
486
+ end
487
+
488
+ update_git_repo(
489
+ dir: File.join(pindo_dir, env_dir_name),
490
+ url: env_urls[env_name]
491
+ )
492
+ elsif env_name
493
+ # 使用默认 URL 作为后备方案
494
+ default_urls = {
495
+ "dreamstudio_config" => "https://gitee.com/goodbuildtest/pindo_dreamstudio_config.git",
496
+ "workhard_config" => "https://gitee.com/goodbuildtest/pindo_workhard_config.git"
497
+ }
498
+
499
+ if default_urls[env_name]
500
+ env_dir_name = env_name == "dreamstudio_config" ? "pindo_dreamstudio_config" : "pindo_workhard_config"
501
+ update_git_repo(
502
+ dir: File.join(pindo_dir, env_dir_name),
503
+ url: default_urls[env_name]
504
+ )
505
+ end
506
+ end
507
+ end
508
+
509
+ # 获取当前环境
510
+ def get_current_env(pindo_dir)
511
+ env_file = File.join(pindo_dir, '.pindo_env')
512
+ return nil unless File.exist?(env_file)
513
+
514
+ begin
515
+ json = JSON.parse(File.read(env_file))
516
+ json['pindo_env']
517
+ rescue
518
+ nil
519
+ end
520
+ end
521
+
522
+ # 更新单个 Git 仓库
523
+ def update_git_repo(dir:, url:)
524
+ require 'fileutils'
525
+
526
+ # 从 URL 提取仓库名称
527
+ repo_name = url.split('/').last.gsub(/\.git$/, '')
528
+
529
+ if File.exist?(dir)
530
+ # 仓库已存在,执行强制更新
531
+ puts " 📦 更新: #{repo_name}".cyan if ENV['PINDO_DEBUG']
532
+ Dir.chdir(dir) do
533
+ # 获取当前分支
534
+ current_branch = `git rev-parse --abbrev-ref HEAD`.strip
535
+ current_branch = 'master' if current_branch.empty?
536
+
537
+ # 获取远程更新
538
+ system("git fetch origin --quiet")
539
+
540
+ # 强制重置到远程分支最新状态(覆盖本地修改)
541
+ system("git reset --hard origin/#{current_branch} --quiet")
542
+
543
+ # 设置上游分支
544
+ system("git branch --set-upstream-to=origin/#{current_branch} #{current_branch} --quiet 2>/dev/null")
545
+
546
+ # 拉取最新更新
547
+ system("git pull --quiet")
548
+ end
549
+ else
550
+ # 仓库不存在,执行 git clone
551
+ puts " 📦 克隆: #{repo_name}".cyan if ENV['PINDO_DEBUG']
552
+ parent_dir = File.dirname(dir)
553
+ FileUtils.mkdir_p(parent_dir) unless File.exist?(parent_dir)
554
+ system("git clone #{url} #{dir} --quiet")
555
+ end
556
+ end
379
557
  end
380
558
  end
381
559
  end
data/lib/pindo.rb CHANGED
@@ -17,21 +17,26 @@ module Pindo
17
17
  class PindoApp
18
18
 
19
19
  def run(argv)
20
- begin
20
+ # begin
21
21
  # 解析参数以确定是否是 help 或 version 命令
22
22
  coerced_argv = CLAide::ARGV.coerce(argv)
23
23
 
24
24
  # 显示欢迎界面(除了 help/version 命令和特定情况)
25
25
  show_welcome_banner(argv, coerced_argv)
26
26
 
27
- # 跳过 help/version 命令的版本检查
28
- unless coerced_argv.flag?('help') || coerced_argv.flag?('version')
27
+ # 跳过 help/version/setup 命令的版本检查
28
+ unless coerced_argv.flag?('help') ||
29
+ coerced_argv.flag?('version') ||
30
+ (coerced_argv.arguments.first == 'setup')
29
31
  # 执行版本检查
30
32
  begin
31
- # 1. 强制更新检查(可能会退出程序)
33
+ # 1. 配置版本检查(新增)- 必须在其他检查之前
34
+ Pindo::VersionCheck.check_pindo_config
35
+
36
+ # 2. 强制更新检查(可能会退出程序)
32
37
  Pindo::VersionCheck.check_force_update!
33
38
 
34
- # 2. 常规版本检查
39
+ # 3. 常规版本检查
35
40
  Pindo::VersionCheck.check_pindo_new_version
36
41
  rescue => e
37
42
  puts "⚠️ 版本检查出错: #{e.message}".yellow if ENV['PINDO_DEBUG']
@@ -39,10 +44,10 @@ module Pindo
39
44
  end
40
45
  end
41
46
 
42
- rescue => e
43
- # 参数解析失败,继续执行原有逻辑
44
- puts "⚠️ 参数解析失败: #{e.message}".yellow if ENV['PINDO_DEBUG']
45
- end
47
+ # rescue => e
48
+ # # 参数解析失败,继续执行原有逻辑
49
+ # puts "⚠️ 参数解析失败: #{e.message}".yellow if ENV['PINDO_DEBUG']
50
+ # end
46
51
 
47
52
  # 运行命令
48
53
  Pindo::Command.run(argv)
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.10.6
4
+ version: 5.10.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - wade
@@ -364,6 +364,7 @@ files:
364
364
  - lib/pindo/command/gplay/iap.rb
365
365
  - lib/pindo/command/gplay/itcapp.rb
366
366
  - lib/pindo/command/gplay/metadata.rb
367
+ - lib/pindo/command/gplay/pullconfig.rb
367
368
  - lib/pindo/command/gplay/screenshots.rb
368
369
  - lib/pindo/command/gplay/upload.rb
369
370
  - lib/pindo/command/ios.rb
@@ -420,30 +421,30 @@ files:
420
421
  - lib/pindo/config/pindoconfig.rb
421
422
  - lib/pindo/config/pindouserlocalconfig.rb
422
423
  - lib/pindo/module/android/android_build_config_helper.rb
423
- - lib/pindo/module/android/androidreshelper.rb
424
- - lib/pindo/module/android/apk_helper.rb
425
- - lib/pindo/module/android/base_helper.rb
426
- - lib/pindo/module/android/build_helper.rb
424
+ - lib/pindo/module/android/android_build_helper.rb
425
+ - lib/pindo/module/android/android_project_helper.rb
426
+ - lib/pindo/module/android/android_res_helper.rb
427
427
  - lib/pindo/module/android/gp_compliance_helper.rb
428
428
  - lib/pindo/module/android/gradle_helper.rb
429
- - lib/pindo/module/android/so_helper.rb
429
+ - lib/pindo/module/android/java_env_helper.rb
430
+ - lib/pindo/module/android/keystore_helper.rb
430
431
  - lib/pindo/module/appselect.rb
432
+ - lib/pindo/module/appstore/appstore_iap_tier.json
431
433
  - lib/pindo/module/appstore/appstore_in_app_purchase.rb
432
434
  - lib/pindo/module/appstore/appstore_metadata_connect_api_helper.rb
433
435
  - lib/pindo/module/appstore/appstore_metadata_fastlane_helper.rb
434
- - lib/pindo/module/appstore/iap_tier.json
435
- - lib/pindo/module/build/buildhelper.rb
436
- - lib/pindo/module/build/commonconfuseproj.rb
437
- - lib/pindo/module/build/swarkhelper.rb
438
- - lib/pindo/module/build/unityhelper.rb
439
- - lib/pindo/module/build/versionhelper.rb
440
- - lib/pindo/module/cert/certhelper.rb
441
- - lib/pindo/module/cert/keychainhelper.rb
442
- - lib/pindo/module/cert/pemhelper.rb
443
- - lib/pindo/module/cert/provisioninghelper.rb
436
+ - lib/pindo/module/build/build_helper.rb
437
+ - lib/pindo/module/build/confuse_xcodeproj.rb
438
+ - lib/pindo/module/build/swark_helper.rb
439
+ - lib/pindo/module/build/version_helper.rb
440
+ - lib/pindo/module/cert/cert_helper.rb
441
+ - lib/pindo/module/cert/keychain_helper.rb
442
+ - lib/pindo/module/cert/pem_helper.rb
443
+ - lib/pindo/module/cert/provisioning_helper.rb
444
444
  - lib/pindo/module/cert/xcodecerthelper.rb
445
445
  - lib/pindo/module/pgyer/pgyerhelper.rb
446
- - lib/pindo/module/unity/nugethelper.rb
446
+ - lib/pindo/module/unity/nuget_helper.rb
447
+ - lib/pindo/module/unity/unity_helper.rb
447
448
  - lib/pindo/module/webserver/brotli_file_handler.rb
448
449
  - lib/pindo/module/webserver/preview/preview.css
449
450
  - lib/pindo/module/webserver/preview/preview.html
@@ -451,13 +452,13 @@ files:
451
452
  - lib/pindo/module/webserver/responsive_preview_handler.rb
452
453
  - lib/pindo/module/webserver/webgl_page_handler.rb
453
454
  - lib/pindo/module/webserver/webgl_server_helper.rb
455
+ - lib/pindo/module/xcode/res/xcode_res_constant.rb
456
+ - lib/pindo/module/xcode/res/xcode_res_handler.rb
457
+ - lib/pindo/module/xcode/xcode_build_config.rb
458
+ - lib/pindo/module/xcode/xcode_build_helper.rb
459
+ - lib/pindo/module/xcode/xcode_project_helper.rb
460
+ - lib/pindo/module/xcode/xcode_res_helper.rb
454
461
  - lib/pindo/module/xcode/xcodeappconfig.rb
455
- - lib/pindo/module/xcode/xcodebuildconfig.rb
456
- - lib/pindo/module/xcode/xcodebuildhelper.rb
457
- - lib/pindo/module/xcode/xcodehelper.rb
458
- - lib/pindo/module/xcode/xcoderesconstant.rb
459
- - lib/pindo/module/xcode/xcodereshandler.rb
460
- - lib/pindo/module/xcode/xcodereshelper.rb
461
462
  - lib/pindo/options/appconfigoptions.rb
462
463
  - lib/pindo/options/deployoptions.rb
463
464
  - lib/pindo/version.rb
@@ -1,138 +0,0 @@
1
- require_relative 'base_helper'
2
- require_relative 'gp_compliance_helper'
3
-
4
- module Pindo
5
- module ApkHelper
6
- include BaseAndroidHelper
7
-
8
- def build_apk(project_path, debug)
9
- raise ArgumentError, "项目路径不能为空" if project_path.nil? || project_path.empty?
10
-
11
- # 构建 AAB 文件
12
- unless build_aab(project_path, debug)
13
- raise RuntimeError, "AAB 构建失败"
14
- end
15
-
16
- # 获取必要的配置信息
17
- main_module = get_main_module(project_path)
18
- raise ArgumentError, "无法找到主模块" unless main_module
19
-
20
- keystore_config = get_keystore_config(project_path, debug)
21
- raise ArgumentError, "无法从 build.gradle 中获取 keystore 信息" unless keystore_config
22
-
23
- bundle_tool = get_build_tools[:bundle_tool]
24
- raise ArgumentError, "找不到 bundletool" unless File.exist?(bundle_tool)
25
-
26
- # 准备输出路径
27
- build_type = debug ? 'debug' : 'release'
28
- main_module_name = File.basename(main_module)
29
- output_dir = File.join(project_path, "build/apks")
30
-
31
- # 清理已存在的文件
32
- FileUtils.rm_rf(output_dir)
33
- FileUtils.mkdir_p(output_dir)
34
-
35
- # 构建路径配置
36
- paths = {
37
- output_apks: File.join(output_dir, "app.apks"),
38
- bundle: File.join(main_module, "build/outputs/bundle/#{build_type}/#{main_module_name}-#{build_type}.aab"),
39
- universal_apk: File.join(output_dir, "universal.apk")
40
- }
41
-
42
- # 检查 bundle 文件是否存在
43
- unless File.exist?(paths[:bundle])
44
- raise RuntimeError, "找不到 AAB 文件: #{paths[:bundle]}"
45
- end
46
-
47
- # --- Google Play 合规检测 (包含包体积、Target SDK、ELF对齐检测) ---
48
- begin
49
- compliance_result = Pindo::GPComplianceHelper.check_aab_compliance(paths[:bundle])
50
-
51
- # 合规检测结果已在 gp_compliance_helper.rb 中输出,这里只做简单的状态提示
52
- if compliance_result.compliant?
53
- puts "\e[32m\e[1m✓ AAB 包符合 Google Play 最新合规要求,可以正常提交\e[0m"
54
- else
55
- puts "\e[31m\e[1m✗ AAB 包不符合 Google Play 提交标准,需要修复合规问题才能提交!!!\e[0m"
56
- end
57
-
58
- # 添加合规检测说明
59
- puts "\e[36m\e[1m📋 合规检测说明:\e[0m"
60
- puts "\e[33m • 仅供测试用的包可以忽略合规检测问题\e[0m"
61
- puts "\e[33m • 提交至 Google Play 的正式用包必须处理所有合规检测问题\e[0m"
62
- puts "\e[33m • 建议在正式发布前解决所有合规问题以确保顺利上架\e[0m"
63
-
64
- rescue => e
65
- puts "\e[31mGoogle Play 合规检测失败: #{e.message}\e[0m"
66
- puts "\e[33m建议手动检查包体积、Target SDK 版本和共享库对齐情况\e[0m"
67
- end
68
- # --- END ---
69
-
70
- # puts "解析 keystore 配置"
71
- ks = keystore_config[:store_file]
72
- # puts "读取 keystore path = #{ks}"
73
- ks_pass = keystore_config[:store_password]
74
- # puts "读取 keystore pass = #{ks_pass}"
75
- key_alias = keystore_config[:key_alias]
76
- # puts "读取 key alias = #{key_alias}"
77
- key_pass = keystore_config[:key_password]
78
- # puts "读取 key pass = #{key_pass}"
79
-
80
- # 构建 APK
81
- # 确保使用正确的 Java 版本 (Java 11+)
82
- java_cmd = find_java_command
83
-
84
- # 验证 Java 版本
85
- unless verify_java_version(java_cmd)
86
- raise RuntimeError, "Java 版本不符合要求,bundletool 需要 Java 11+,当前使用的 Java: #{java_cmd}"
87
- end
88
-
89
- # 使用数组形式构建命令,正确处理包含空格的路径
90
- bundletool_cmd = [
91
- java_cmd, "-jar", bundle_tool, "build-apks",
92
- "--bundle=#{paths[:bundle]}",
93
- "--output=#{paths[:output_apks]}",
94
- "--ks=#{ks}",
95
- "--ks-pass=pass:#{ks_pass}",
96
- "--ks-key-alias=#{key_alias}",
97
- "--key-pass=pass:#{key_pass}",
98
- "--mode=universal"
99
- ]
100
-
101
- # 验证关键文件是否存在
102
- unless File.exist?(paths[:bundle])
103
- raise RuntimeError, "AAB 文件不存在: #{paths[:bundle]}"
104
- end
105
-
106
- unless File.exist?(ks)
107
- raise RuntimeError, "Keystore 文件不存在"
108
- end
109
-
110
- unless system(*bundletool_cmd)
111
- # 检查是否是 Java 版本问题
112
- if java_cmd == 'java'
113
- raise RuntimeError, "APKS 构建失败。可能是 Java 版本不兼容,bundletool 需要 Java 11+,请检查 JAVA_HOME 环境变量或安装正确的 Java 版本"
114
- else
115
- raise RuntimeError, "APKS 构建失败。使用的 Java 命令: #{java_cmd}"
116
- end
117
- end
118
-
119
- # 解压 APKs 文件
120
- unless system("unzip", "-o", paths[:output_apks], "-d", output_dir)
121
- raise RuntimeError, "APKS 解压失败"
122
- end
123
-
124
- # 返回生成的 APK 路径
125
- unless File.exist?(paths[:universal_apk])
126
- raise RuntimeError, "未找到生成的 APK 文件"
127
- end
128
-
129
- paths[:universal_apk]
130
- end
131
-
132
- def build_aab(project_path, debug)
133
- Dir.chdir(project_path) do
134
- system("./gradlew bundle#{debug ? 'Debug' : 'Release'}")
135
- end
136
- end
137
- end
138
- end