pindo 5.10.4 → 5.10.8

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/deploy/build.rb +5 -2
  8. data/lib/pindo/command/deploy/cert.rb +6 -7
  9. data/lib/pindo/command/deploy/configproj.rb +3 -3
  10. data/lib/pindo/command/deploy/confusecode.rb +1 -1
  11. data/lib/pindo/command/deploy/confuseproj.rb +1 -1
  12. data/lib/pindo/command/deploy/pem.rb +3 -4
  13. data/lib/pindo/command/dev/autobuild.rb +2 -2
  14. data/lib/pindo/command/dev/build.rb +2 -2
  15. data/lib/pindo/command/dev/feishu.rb +1 -1
  16. data/lib/pindo/command/gplay/pullconfig.rb +48 -0
  17. data/lib/pindo/command/gplay.rb +6 -5
  18. data/lib/pindo/command/ios/adhoc.rb +7 -6
  19. data/lib/pindo/command/ios/autobuild.rb +25 -25
  20. data/lib/pindo/command/ios/build.rb +7 -6
  21. data/lib/pindo/command/ios/debug.rb +2 -1
  22. data/lib/pindo/command/ipa/autoresign.rb +2 -2
  23. data/lib/pindo/command/ipa/import.rb +3 -4
  24. data/lib/pindo/command/ipa/output.rb +3 -4
  25. data/lib/pindo/command/jps/upload.rb +6 -5
  26. data/lib/pindo/command/repo/login.rb +1 -1
  27. data/lib/pindo/command/unity/apk.rb +19 -2
  28. data/lib/pindo/command/unity/autobuild.rb +58 -63
  29. data/lib/pindo/command/unity/initpack.rb +1 -1
  30. data/lib/pindo/command/unity/ipa.rb +17 -14
  31. data/lib/pindo/command/unity/pack.rb +1 -1
  32. data/lib/pindo/command/unity/upload.rb +1 -1
  33. data/lib/pindo/command/unity/web.rb +2 -2
  34. data/lib/pindo/command/utils/device.rb +4 -4
  35. data/lib/pindo/command/utils/icon.rb +1 -1
  36. data/lib/pindo/command/utils/renewcert.rb +2 -3
  37. data/lib/pindo/command/utils/renewproj.rb +9 -10
  38. data/lib/pindo/command/web/autobuild.rb +3 -3
  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 +6 -5
  56. data/lib/pindo/module/pgyer/pgyerhelper.rb +5 -5
  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} +84 -2
  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
@@ -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