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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pindo/base/aeshelper.rb +23 -2
  3. data/lib/pindo/base/pindocontext.rb +259 -0
  4. data/lib/pindo/client/pgyer_feishu_oauth_cli.rb +343 -80
  5. data/lib/pindo/client/pgyerclient.rb +30 -20
  6. data/lib/pindo/command/android/autobuild.rb +52 -22
  7. data/lib/pindo/command/android/build.rb +27 -16
  8. data/lib/pindo/command/android/debug.rb +25 -15
  9. data/lib/pindo/command/dev/debug.rb +2 -51
  10. data/lib/pindo/command/dev/feishu.rb +19 -2
  11. data/lib/pindo/command/ios/adhoc.rb +2 -1
  12. data/lib/pindo/command/ios/autobuild.rb +35 -8
  13. data/lib/pindo/command/ios/debug.rb +2 -132
  14. data/lib/pindo/command/lib/lint.rb +24 -1
  15. data/lib/pindo/command/setup.rb +24 -4
  16. data/lib/pindo/command/unity/apk.rb +15 -0
  17. data/lib/pindo/command/unity/ipa.rb +16 -0
  18. data/lib/pindo/command.rb +13 -2
  19. data/lib/pindo/module/android/android_build_config_helper.rb +425 -0
  20. data/lib/pindo/module/android/apk_helper.rb +23 -25
  21. data/lib/pindo/module/android/base_helper.rb +572 -0
  22. data/lib/pindo/module/android/build_helper.rb +8 -318
  23. data/lib/pindo/module/android/gp_compliance_helper.rb +668 -0
  24. data/lib/pindo/module/android/gradle_helper.rb +746 -3
  25. data/lib/pindo/module/appselect.rb +18 -5
  26. data/lib/pindo/module/build/buildhelper.rb +120 -29
  27. data/lib/pindo/module/build/unityhelper.rb +675 -18
  28. data/lib/pindo/module/build/versionhelper.rb +146 -0
  29. data/lib/pindo/module/cert/certhelper.rb +33 -2
  30. data/lib/pindo/module/cert/xcodecerthelper.rb +3 -1
  31. data/lib/pindo/module/pgyer/pgyerhelper.rb +114 -31
  32. data/lib/pindo/module/xcode/xcodebuildconfig.rb +232 -0
  33. data/lib/pindo/module/xcode/xcodebuildhelper.rb +0 -1
  34. data/lib/pindo/version.rb +356 -86
  35. data/lib/pindo.rb +72 -3
  36. metadata +5 -1
@@ -2,13 +2,16 @@ require 'highline/import'
2
2
  require 'fileutils'
3
3
  require 'pindo/base/executable'
4
4
  require 'pindo/module/build/buildhelper'
5
+ require 'pindo/module/build/versionhelper'
5
6
  require 'pindo/module/android/build_helper'
7
+ require 'pindo/module/android/android_build_config_helper'
6
8
 
7
9
  module Pindo
8
10
  class Command
9
11
  class Android < Command
10
12
  class Autobuild < Android
11
13
  include Appselect
14
+ include Pindo::Githelper
12
15
 
13
16
  self.summary = '打包Android工程并发布到蒲公英'
14
17
  self.description = <<-DESC
@@ -100,42 +103,69 @@ module Pindo
100
103
  end
101
104
  if scheme_name.nil? || scheme_name.empty? && is_git_directory?(local_repo_dir:pindo_project_dir)
102
105
  current_git_root_path = git_root_directory(local_repo_dir: pindo_project_dir)
103
- git_repo_name = File.basename(current_git_root_path)
104
- if !git_repo_name.nil? && !git_repo_name.empty?
105
- scheme_name = git_repo_name
106
+ if current_git_root_path && !current_git_root_path.empty?
107
+ git_repo_name = File.basename(current_git_root_path)
108
+ if !git_repo_name.nil? && !git_repo_name.empty?
109
+ scheme_name = git_repo_name
110
+ end
106
111
  end
107
112
  end
108
113
 
109
114
  android_build_helper = Pindo::AndroidBuildHelper.share_instance
110
-
115
+
116
+ # 更新版本号和Build号(仅在Git仓库中)
117
+ version_helper = Pindo::VersionHelper.share_instance
118
+ version_info = version_helper.get_version_info(project_dir: pindo_project_dir)
119
+
120
+ if version_info[:is_git_repo]
121
+ # 更新Android工程版本
122
+ Pindo::AndroidBuildConfigHelper.update_android_project_version(
123
+ project_dir: pindo_project_dir,
124
+ version_name: version_info[:version],
125
+ version_code: version_info[:build_number]
126
+ )
127
+ else
128
+ puts "非Git仓库,保持工程原有版本号"
129
+ end
130
+
111
131
  # 添加以项目名称为 scheme 的配置
112
- android_build_helper.add_test_scheme(project_dir:pindo_project_dir,scheme_name:scheme_name)
113
-
132
+ Pindo::AndroidBuildConfigHelper.add_test_scheme(project_dir: pindo_project_dir, scheme_name: scheme_name)
133
+
114
134
  # 获取 bundle ID 并添加以 bundle ID 为 scheme 的配置
115
135
  bundle_id = android_build_helper.get_application_id(pindo_project_dir)
116
136
  if !bundle_id.nil? && !bundle_id.empty?
117
137
  puts "获取到 Bundle ID: #{bundle_id}"
118
- android_build_helper.add_test_scheme(project_dir:pindo_project_dir,scheme_name:bundle_id)
138
+ Pindo::AndroidBuildConfigHelper.add_test_scheme(project_dir: pindo_project_dir, scheme_name: bundle_id)
119
139
  else
120
140
  puts "警告: 未能获取到 Bundle ID,跳过添加 Bundle ID scheme"
121
141
  end
122
142
 
123
- apk_path = android_build_helper.auto_build_apk(pindo_project_dir, !@args_release_flag)
124
- ipa_file_upload = Dir.glob(apk_path).max_by {|f| File.mtime(f)}
125
-
126
- if !ipa_file_upload.nil? && !app_info_obj.nil?
127
- description = nil
128
- result_data = PgyerHelper.share_instace.start_upload(app_info_obj:app_info_obj, ipa_file_upload:ipa_file_upload, description:description)
129
- if !result_data.nil? && !result_data["data"].nil? && !result_data["data"]["id"].nil?
130
- msg_data = PgyerHelper.share_instace.make_msg_data(app_info_obj:app_info_obj, app_version_info_obj:result_data["data"])
131
- PgyerHelper.share_instace.print_app_version_info(msg_data:msg_data)
132
- if @args_send_flag
133
- PgyerHelper.share_instace.send_apptest_wechat_msg(msg_data:msg_data)
134
- end
135
- end
136
- end
143
+ begin
144
+ apk_path = android_build_helper.auto_build_apk(pindo_project_dir, !@args_release_flag)
145
+ ipa_file_upload = Dir.glob(apk_path).max_by {|f| File.mtime(f)}
146
+
147
+ if !ipa_file_upload.nil? && !app_info_obj.nil?
148
+ description = nil
149
+ result_data = PgyerHelper.share_instace.start_upload(app_info_obj:app_info_obj, ipa_file_upload:ipa_file_upload, description:description)
150
+ if !result_data.nil? && !result_data["data"].nil? && !result_data["data"]["id"].nil?
151
+ msg_data = PgyerHelper.share_instace.make_msg_data(app_info_obj:app_info_obj, app_version_info_obj:result_data["data"])
152
+ PgyerHelper.share_instace.print_app_version_info(msg_data:msg_data)
153
+ if @args_send_flag
154
+ PgyerHelper.share_instace.send_apptest_wechat_msg(msg_data:msg_data)
155
+ end
156
+ end
157
+ end
137
158
 
138
- system "open #{pindo_project_dir}"
159
+ # 只在构建成功完成时弹出目标文件夹
160
+ puts "\e[32m构建完成!正在打开目标文件夹...\e[0m"
161
+ system "open #{pindo_project_dir}"
162
+
163
+ rescue => e
164
+ puts "\e[31m构建失败: #{e.message}\e[0m"
165
+ puts "\e[33m正在打开项目文件夹以便检查错误...\e[0m"
166
+ system "open #{pindo_project_dir}"
167
+ raise e
168
+ end
139
169
 
140
170
 
141
171
  end
@@ -87,24 +87,35 @@ module Pindo
87
87
 
88
88
 
89
89
  android_build_helper = Pindo::AndroidBuildHelper.share_instance
90
- apk_path = android_build_helper.auto_build_apk(pindo_project_dir, !@args_release_flag)
91
- ipa_file_upload = Dir.glob(apk_path).max_by {|f| File.mtime(f)}
92
-
93
- if !ipa_file_upload.nil? && !app_info_obj.nil?
94
-
95
- description = nil
96
- result_data = PgyerHelper.share_instace.start_upload(app_info_obj:app_info_obj, ipa_file_upload:ipa_file_upload, description:description)
97
- if !result_data.nil? && !result_data["data"].nil? && !result_data["data"]["id"].nil?
98
- msg_data = PgyerHelper.share_instace.make_msg_data(app_info_obj:app_info_obj, app_version_info_obj:result_data["data"])
90
+
91
+ begin
92
+ apk_path = android_build_helper.auto_build_apk(pindo_project_dir, !@args_release_flag)
93
+ ipa_file_upload = Dir.glob(apk_path).max_by {|f| File.mtime(f)}
94
+
95
+ if !ipa_file_upload.nil? && !app_info_obj.nil?
96
+
97
+ description = nil
98
+ result_data = PgyerHelper.share_instace.start_upload(app_info_obj:app_info_obj, ipa_file_upload:ipa_file_upload, description:description)
99
+ if !result_data.nil? && !result_data["data"].nil? && !result_data["data"]["id"].nil?
100
+ msg_data = PgyerHelper.share_instace.make_msg_data(app_info_obj:app_info_obj, app_version_info_obj:result_data["data"])
101
+
102
+ PgyerHelper.share_instace.print_app_version_info(msg_data:msg_data)
103
+ if @args_send_flag
104
+ PgyerHelper.share_instace.send_apptest_wechat_msg(msg_data:msg_data)
105
+ end
106
+ end
107
+ end
99
108
 
100
- PgyerHelper.share_instace.print_app_version_info(msg_data:msg_data)
101
- if @args_send_flag
102
- PgyerHelper.share_instace.send_apptest_wechat_msg(msg_data:msg_data)
103
- end
104
- end
109
+ # 只在构建成功完成时弹出目标文件夹
110
+ puts "\e[32m构建完成!正在打开目标文件夹...\e[0m"
111
+ system "open #{pindo_project_dir}"
112
+
113
+ rescue => e
114
+ puts "\e[31m构建失败: #{e.message}\e[0m"
115
+ puts "\e[33m正在打开项目文件夹以便检查错误...\e[0m"
116
+ system "open #{pindo_project_dir}"
117
+ raise e
105
118
  end
106
-
107
- system "open #{pindo_project_dir}"
108
119
  end
109
120
  end
110
121
  end
@@ -85,23 +85,33 @@ module Pindo
85
85
  app_info_obj = PgyerHelper.share_instace.prepare_upload(working_directory:Dir.pwd, proj_name:proj_name)
86
86
  end
87
87
 
88
- apk_path = Pindo::AndroidBuildHelper.share_instance.auto_build_apk(pindo_project_dir, !@args_release_flag, @args_direct_flag)
89
- ipa_file_upload = Dir.glob(apk_path).max_by {|f| File.mtime(f)}
90
-
91
- if !ipa_file_upload.nil? && !app_info_obj.nil?
92
- description = nil
93
- result_data = PgyerHelper.share_instace.start_upload(app_info_obj:app_info_obj, ipa_file_upload:ipa_file_upload, description:description)
94
- if !result_data.nil? && !result_data["data"].nil? && !result_data["data"]["id"].nil?
95
- msg_data = PgyerHelper.share_instace.make_msg_data(app_info_obj:app_info_obj, app_version_info_obj:result_data["data"])
96
- PgyerHelper.share_instace.print_app_version_info(msg_data:msg_data)
97
- if @args_send_flag
98
- PgyerHelper.share_instace.send_apptest_wechat_msg(msg_data:msg_data)
99
- end
100
- end
88
+ begin
89
+ apk_path = Pindo::AndroidBuildHelper.share_instance.auto_build_apk(pindo_project_dir, !@args_release_flag, @args_direct_flag)
90
+ ipa_file_upload = Dir.glob(apk_path).max_by {|f| File.mtime(f)}
91
+
92
+ if !ipa_file_upload.nil? && !app_info_obj.nil?
93
+ description = nil
94
+ result_data = PgyerHelper.share_instace.start_upload(app_info_obj:app_info_obj, ipa_file_upload:ipa_file_upload, description:description)
95
+ if !result_data.nil? && !result_data["data"].nil? && !result_data["data"]["id"].nil?
96
+ msg_data = PgyerHelper.share_instace.make_msg_data(app_info_obj:app_info_obj, app_version_info_obj:result_data["data"])
97
+ PgyerHelper.share_instace.print_app_version_info(msg_data:msg_data)
98
+ if @args_send_flag
99
+ PgyerHelper.share_instace.send_apptest_wechat_msg(msg_data:msg_data)
100
+ end
101
+ end
102
+ end
103
+
104
+ # 只在构建成功完成时弹出目标文件夹
105
+ puts "\e[32m构建完成!正在打开目标文件夹...\e[0m"
106
+ system "open #{pindo_project_dir}"
107
+
108
+ rescue => e
109
+ puts "\e[31m构建失败: #{e.message}\e[0m"
110
+ puts "\e[33m正在打开项目文件夹以便检查错误...\e[0m"
111
+ system "open #{pindo_project_dir}"
112
+ raise e
101
113
  end
102
114
 
103
- system "open #{pindo_project_dir}"
104
-
105
115
  end
106
116
 
107
117
  end
@@ -76,7 +76,8 @@ module Pindo
76
76
  project_dir = Dir.pwd
77
77
  Dir.chdir(project_dir)
78
78
  config_json_file = File.join(project_dir,"config.json")
79
- Debug::modify_cert_with_project(project_dir:project_dir, config_file:config_json_file)
79
+ # 处理entitlements配置
80
+ Pindo::XcodeBuildConfig.update_entitlements_config(project_dir: project_dir, config_file: config_json_file)
80
81
 
81
82
  args_temp = []
82
83
  if @args_adhoc_flag
@@ -104,56 +105,6 @@ module Pindo
104
105
 
105
106
  end
106
107
 
107
- def self.modify_cert_with_project(project_dir:nil, config_file:nil)
108
-
109
- project_fullname = Dir.glob(File.join(project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
110
- if !project_fullname.nil?
111
-
112
- entitlements_plist_path = nil
113
- project_obj = Xcodeproj::Project.open(project_fullname)
114
- project_obj.targets.each do |target|
115
- if target.product_type.to_s.eql?("com.apple.product-type.application") then
116
- temp_entitlements_file = target.build_configurations.first.build_settings['CODE_SIGN_ENTITLEMENTS']
117
- if !temp_entitlements_file.nil? && !temp_entitlements_file.empty?
118
- entitlements_plist_path = File.join(project_dir, temp_entitlements_file)
119
- end
120
- end
121
- end
122
-
123
- # puts entitlements_plist_path
124
- if !entitlements_plist_path.nil? && File.exist?(entitlements_plist_path)
125
- config_json = nil
126
- if File.exist?(config_file)
127
- config_json = JSON.parse(File.read(config_file))
128
- end
129
-
130
- entitlements_plist_dict = Xcodeproj::Plist.read_from_path(entitlements_plist_path)
131
-
132
- if entitlements_plist_dict["com.apple.developer.icloud-container-identifiers"].nil?
133
- if !config_json.nil? && !config_json["app_info"]['app_icloud_id'].nil?
134
- config_json["app_info"].delete('app_icloud_id')
135
- end
136
- end
137
-
138
- if entitlements_plist_dict["com.apple.security.application-groups"].nil?
139
- if !config_json.nil? && !config_json["app_info"]['app_group_id'].nil?
140
- config_json["app_info"].delete('app_group_id')
141
- end
142
- end
143
-
144
- # puts JSON.pretty_generate(config_json)
145
- if !config_json.nil?
146
- File.open(config_file, "w") do |f|
147
- f.write(JSON.pretty_generate(config_json))
148
- end
149
-
150
- end
151
-
152
- end
153
-
154
- end
155
-
156
- end
157
108
 
158
109
  end
159
110
  end
@@ -8,15 +8,32 @@ module Pindo
8
8
  class Command
9
9
  class Dev < Command
10
10
  class Feishu < Dev
11
+ # 命令的简要说明 - 发送飞书消息
11
12
  self.summary = '发送飞书消息'
12
13
 
13
14
  # 命令的详细说明,包含用法示例
14
15
  self.description = <<-DESC
15
16
  发送飞书消息到指定的飞书群。
16
17
 
18
+ 支持功能:
19
+
20
+ * 发送文本消息到飞书群
21
+
22
+ * 支持自定义Webhook URL
23
+
24
+ * 支持消息签名验证
25
+
26
+ * 支持富文本格式
27
+
17
28
  使用示例:
18
- $ pindo dev feishu "要发送的消息"
19
- $ pindo dev feishu -w WEBHOOK_URL -s SECRET "要发送的消息"
29
+
30
+ $ pindo dev feishu "要发送的消息" # 发送简单文本消息
31
+
32
+ $ pindo dev feishu --webhook=URL "消息内容" # 指定webhook发送
33
+
34
+ $ pindo dev feishu "构建完成通知" # 发送构建通知
35
+
36
+ $ pindo dev feishu "@所有人 版本已发布" # 发送@所有人消息
20
37
  DESC
21
38
 
22
39
  # 命令的参数列表
@@ -97,7 +97,8 @@ module Pindo
97
97
  project_dir = Dir.pwd
98
98
  Dir.chdir(project_dir)
99
99
  config_json_file = File.join(project_dir,"config.json")
100
- Cert::modify_cert_with_project(project_dir:project_dir, config_file:config_json_file)
100
+ # 处理entitlements配置
101
+ Pindo::XcodeBuildConfig.update_entitlements_config(project_dir: project_dir, config_file: config_json_file)
101
102
 
102
103
  if File.exist?(File.join(project_dir, "Podfile"))
103
104
 
@@ -1,9 +1,12 @@
1
1
  require 'highline/import'
2
2
  require 'xcodeproj'
3
- require 'find'
3
+ require 'find'
4
4
  require 'fileutils'
5
5
  require 'pindo/base/executable'
6
6
  require 'pindo/module/build/buildhelper'
7
+ require 'pindo/module/build/versionhelper'
8
+ require 'pindo/module/xcode/xcodebuildconfig'
9
+ require 'pindo/base/pindocontext'
7
10
 
8
11
  module Pindo
9
12
  class Command
@@ -81,6 +84,10 @@ module Pindo
81
84
  def run
82
85
  pindo_project_dir = Dir.pwd
83
86
 
87
+ # 设置 PindoContext 上下文
88
+ context = Pindo::PindoContext.instance
89
+ context.set_context('ios:autobuild', pindo_project_dir)
90
+
84
91
  build_helper = Pindo::BuildHelper.share_instance
85
92
  project_type = build_helper.project_type(pindo_project_dir)
86
93
 
@@ -151,14 +158,20 @@ module Pindo
151
158
  end
152
159
  if scheme_name.nil? || scheme_name.empty? && is_git_directory?(local_repo_dir:pindo_project_dir)
153
160
  current_git_root_path = git_root_directory(local_repo_dir: pindo_project_dir)
154
- git_repo_name = File.basename(current_git_root_path)
155
- if !git_repo_name.nil? && !git_repo_name.empty?
156
- scheme_name = git_repo_name
161
+ if current_git_root_path && !current_git_root_path.empty?
162
+ git_repo_name = File.basename(current_git_root_path)
163
+ if !git_repo_name.nil? && !git_repo_name.empty?
164
+ scheme_name = git_repo_name
165
+ end
157
166
  end
158
167
  end
159
168
 
160
- Pindo::Command::Ios::Debug::modify_cert_with_project(project_dir:pindo_project_dir, config_file:config_json_file, scheme_name:scheme_name, bundleid:mainapp_bundleid)
161
-
169
+ # 处理entitlements配置
170
+ Pindo::XcodeBuildConfig.update_entitlements_config(project_dir: pindo_project_dir, config_file: config_json_file)
171
+
172
+ # 添加URL Schemes
173
+ Pindo::XcodeBuildConfig.add_url_schemes(project_dir: pindo_project_dir, scheme_name: scheme_name)
174
+
162
175
  if File.exist?(File.join(pindo_project_dir, "Podfile"))
163
176
 
164
177
  args_temp = []
@@ -211,8 +224,22 @@ module Pindo
211
224
  end
212
225
 
213
226
  Pindo::Command::Deploy::Cert::run(args_temp)
214
- Pindo::Command::Ios::Debug::modify_plist_scheme(project_dir:pindo_project_dir, scheme_name:scheme_name)
215
-
227
+
228
+ # 更新版本号和Build号(仅在Git仓库中)
229
+ version_helper = Pindo::VersionHelper.share_instance
230
+ version_info = version_helper.get_version_info(project_dir: pindo_project_dir)
231
+
232
+ if version_info[:is_git_repo]
233
+ # 更新iOS工程版本
234
+ Pindo::XcodeBuildConfig.update_ios_project_version(
235
+ project_dir: pindo_project_dir,
236
+ version: version_info[:version],
237
+ build_number: version_info[:build_number]
238
+ )
239
+ else
240
+ puts "非Git仓库,保持工程原有版本号"
241
+ end
242
+
216
243
  Dir.chdir(pindo_project_dir)
217
244
  Pindo::Command::Deploy::Build::run(args_temp)
218
245
 
@@ -72,7 +72,8 @@ module Pindo
72
72
  project_dir = Dir.pwd
73
73
  Dir.chdir(project_dir)
74
74
  config_json_file = File.join(project_dir,"config.json")
75
- Pindo::Command::Ios::Debug::modify_cert_with_project(project_dir:project_dir, config_file:config_json_file, bundleid:mainapp_bundleid)
75
+ # 处理entitlements配置
76
+ Pindo::XcodeBuildConfig.update_entitlements_config(project_dir: project_dir, config_file: config_json_file)
76
77
 
77
78
  args_temp = []
78
79
  if @args_adhoc_flag
@@ -104,137 +105,6 @@ module Pindo
104
105
 
105
106
  end
106
107
 
107
- def self.modify_cert_with_project(project_dir:nil, config_file:nil, scheme_name:nil, bundleid:nil)
108
-
109
- project_fullname = Dir.glob(File.join(project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
110
- if !project_fullname.nil?
111
-
112
- entitlements_plist_path = nil
113
- info_plist_path = nil
114
- project_obj = Xcodeproj::Project.open(project_fullname)
115
- project_obj.targets.each do |target|
116
- if target.product_type.to_s.eql?("com.apple.product-type.application") then
117
- temp_entitlements_file = target.build_configurations.first.build_settings['CODE_SIGN_ENTITLEMENTS']
118
- if !temp_entitlements_file.nil? && !temp_entitlements_file.empty?
119
- entitlements_plist_path = File.join(project_dir, temp_entitlements_file)
120
- end
121
- temp_info_file = target.build_configurations.first.build_settings['INFOPLIST_FILE']
122
- if !temp_info_file.nil? && !temp_info_file.empty?
123
- info_plist_path = File.join(project_dir, temp_info_file)
124
- end
125
- end
126
- end
127
-
128
- if !info_plist_path.nil? && File.exist?(info_plist_path) && !scheme_name.nil? && !scheme_name.empty?
129
- # scheme_name = scheme_name.to_s.downcase.strip.gsub(/[\s\-_]/, '')
130
- scheme_name = scheme_name.to_s.gsub(/[^a-zA-Z0-9]/, '').downcase
131
- info_plist_dict = Xcodeproj::Plist.read_from_path(info_plist_path)
132
- info_plist_dict["CFBundleURLTypes"] = info_plist_dict["CFBundleURLTypes"] || []
133
- # info_plist_dict["CFBundleURLTypes"] 中不存在CFBundleURLName为scheme_name的item
134
- if !info_plist_dict["CFBundleURLTypes"].any? { |item| item["CFBundleURLName"] == scheme_name }
135
- item0 = {}
136
- item0["CFBundleTypeRole"] = "Editor"
137
- item0["CFBundleURLName"] = scheme_name
138
- item0["CFBundleURLSchemes"] = []
139
- item0["CFBundleURLSchemes"] << scheme_name
140
- info_plist_dict["CFBundleURLTypes"] << item0
141
- end
142
- Xcodeproj::Plist.write_to_path(info_plist_dict, info_plist_path)
143
- end
144
- # puts entitlements_plist_path
145
- if !entitlements_plist_path.nil? && File.exist?(entitlements_plist_path)
146
- config_json = nil
147
- if File.exist?(config_file)
148
- config_json = JSON.parse(File.read(config_file))
149
- end
150
-
151
- entitlements_plist_dict = Xcodeproj::Plist.read_from_path(entitlements_plist_path)
152
-
153
- if entitlements_plist_dict["com.apple.developer.icloud-container-identifiers"].nil?
154
- if !config_json.nil? && !config_json["app_info"]['app_icloud_id'].nil?
155
- config_json["app_info"].delete('app_icloud_id')
156
- end
157
- end
158
-
159
- if entitlements_plist_dict["com.apple.security.application-groups"].nil?
160
- if !config_json.nil? && !config_json["app_info"]['app_group_id'].nil?
161
- config_json["app_info"].delete('app_group_id')
162
- end
163
- end
164
-
165
- # puts JSON.pretty_generate(config_json)
166
- if !config_json.nil?
167
- File.open(config_file, "w") do |f|
168
- f.write(JSON.pretty_generate(config_json))
169
- end
170
-
171
- end
172
-
173
- end
174
-
175
- end
176
-
177
-
178
- end
179
-
180
- def self.modify_plist_scheme(project_dir:nil, scheme_name:nil)
181
-
182
- puts "modify_plist_scheme: #{project_dir} #{scheme_name}"
183
- project_fullname = Dir.glob(File.join(project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
184
- if !project_fullname.nil?
185
- info_plist_path = nil
186
- bundleid_scheme_name = nil
187
- project_obj = Xcodeproj::Project.open(project_fullname)
188
- project_obj.targets.each do |target|
189
- if target.product_type.to_s.eql?("com.apple.product-type.application") then
190
- temp_info_file = target.build_configurations.first.build_settings['INFOPLIST_FILE']
191
- if !temp_info_file.nil? && !temp_info_file.empty?
192
- info_plist_path = File.join(project_dir, temp_info_file)
193
- end
194
- bundleid_scheme_name = target.build_configurations.first.build_settings['PRODUCT_BUNDLE_IDENTIFIER']
195
- end
196
- end
197
-
198
- if !info_plist_path.nil? && File.exist?(info_plist_path) && !scheme_name.nil? && !scheme_name.empty?
199
-
200
- scheme_name = scheme_name.to_s.gsub(/[^a-zA-Z0-9]/, '').downcase
201
-
202
- info_plist_dict = Xcodeproj::Plist.read_from_path(info_plist_path)
203
- info_plist_dict["CFBundleURLTypes"] = info_plist_dict["CFBundleURLTypes"] || []
204
- # info_plist_dict["CFBundleURLTypes"] 中不存在CFBundleURLName为scheme_name的item
205
- if !info_plist_dict["CFBundleURLTypes"].any? { |item| item["CFBundleURLName"] == scheme_name }
206
- item0 = {}
207
- item0["CFBundleTypeRole"] = "Editor"
208
- item0["CFBundleURLName"] = scheme_name
209
- item0["CFBundleURLSchemes"] = []
210
- item0["CFBundleURLSchemes"] << scheme_name
211
- info_plist_dict["CFBundleURLTypes"] << item0
212
- end
213
- Xcodeproj::Plist.write_to_path(info_plist_dict, info_plist_path)
214
- end
215
-
216
- if !info_plist_path.nil? && File.exist?(info_plist_path) && !bundleid_scheme_name.nil? && !bundleid_scheme_name.empty?
217
- info_plist_dict = Xcodeproj::Plist.read_from_path(info_plist_path)
218
- info_plist_dict["CFBundleURLTypes"] = info_plist_dict["CFBundleURLTypes"] || []
219
- # info_plist_dict["CFBundleURLTypes"] 中不存在CFBundleURLName为bundleid的item
220
- #bundle id去除. 特殊字符串,保留全小写
221
- bundleid_scheme_valeu = bundleid_scheme_name.gsub(/[^a-zA-Z0-9]/, '').downcase
222
-
223
- if !bundleid_scheme_name.nil? && !bundleid_scheme_name.empty? && !info_plist_dict["CFBundleURLTypes"].any? { |item| item["CFBundleURLName"] == bundleid_scheme_valeu }
224
- item0 = {}
225
- item0["CFBundleTypeRole"] = "Editor"
226
- item0["CFBundleURLName"] = bundleid_scheme_valeu
227
- item0["CFBundleURLSchemes"] = []
228
- item0["CFBundleURLSchemes"] << bundleid_scheme_valeu
229
- info_plist_dict["CFBundleURLTypes"] << item0
230
- end
231
- Xcodeproj::Plist.write_to_path(info_plist_dict, info_plist_path)
232
- end
233
-
234
- end
235
-
236
-
237
- end
238
108
  end
239
109
  end
240
110
  end
@@ -7,12 +7,35 @@ module Pindo
7
7
  class Lib < Command
8
8
  class Lint < Lib
9
9
 
10
+ # 命令的简要说明 - 本地编译验证pod库
10
11
  self.summary = '本地编译私有pod库, 相当于pod lint功能'
11
12
 
13
+ # 命令的详细说明,包含用法示例
12
14
  self.description = <<-DESC
13
- pod lint私有库,本地编译私有库,在私有库目录下执行pindo lib liblint
15
+ 本地编译验证私有pod库。
16
+
17
+ 支持功能:
18
+
19
+ * 本地编译验证pod库
20
+
21
+ * 检查podspec文件
22
+
23
+ * 验证依赖关系
24
+
25
+ * 检查代码规范
26
+
27
+ 使用示例:
28
+
29
+ $ pindo lib lint # 在当前目录lint pod库
30
+
31
+ $ pindo lib lint MyPod.podspec # 指定podspec文件
32
+
33
+ $ pindo lib lint --p=~/MyPod # 指定pod库目录
34
+
35
+ $ pindo lib lint --verbose # 显示详细输出
14
36
  DESC
15
37
 
38
+ # 命令的参数列表
16
39
  self.arguments = [
17
40
  CLAide::Argument.new('podspec', true)
18
41
  ]
@@ -5,16 +5,36 @@ module Pindo
5
5
  class Command
6
6
  class Setup < Command
7
7
 
8
+ # 命令的简要说明 - 初始化pindo配置
8
9
  self.summary = '初始化pindo配置'
9
10
 
11
+ # 命令的详细说明,包含用法示例
10
12
  self.description = <<-DESC
11
- 用法:
12
- 使用 gem install pindo 安装,安装完之后使用pindo setup初始化pindo的配置,
13
- 默认dreamstudio环境。
13
+ 初始化pindo的基础配置环境。
14
+
15
+ 支持功能:
16
+
17
+ * 创建pindo配置目录
18
+
19
+ * 拉取公共配置文件
20
+
21
+ * 初始化环境配置
22
+
23
+ * 设置默认参数
24
+
25
+ 使用示例:
26
+
27
+ $ pindo setup # 初始化默认配置(dreamstudio环境)
28
+
29
+ $ pindo setup --env=workhard # 初始化workhard环境配置
30
+
31
+ $ pindo setup --force # 强制重新初始化配置
32
+
33
+ $ pindo setup --clean # 清理并重新初始化
14
34
  DESC
15
35
 
36
+ # 命令的参数列表
16
37
  self.arguments = [
17
-
18
38
  ]
19
39
 
20
40
  def self.options
@@ -108,6 +108,21 @@ module Pindo
108
108
  if isLibrary
109
109
  pindo_android_project_dir = android_export_lib_dir
110
110
  end
111
+
112
+ # 验证构建输出目录是否存在
113
+ unless File.directory?(pindo_android_project_dir)
114
+ puts "\e[31m错误: Unity 构建输出目录不存在: #{pindo_android_project_dir}\e[0m"
115
+ puts "\e[33m可能的原因:\e[0m"
116
+ puts "• Unity 构建失败但未正确报告错误"
117
+ puts "• GoodUnityBuild 配置的输出路径不正确"
118
+ puts "• Unity 项目配置问题"
119
+ puts "\e[33m建议检查:\e[0m"
120
+ puts "• Unity 控制台日志"
121
+ puts "• GoodUnityBuild 的 AndroidBuildConfiguration.cs 配置"
122
+ puts "• 项目路径和权限设置"
123
+ raise "Unity 构建输出目录不存在,构建可能失败"
124
+ end
125
+
111
126
  puts "开始构建Unity项目..."
112
127
 
113
128
  unity_helper.build_project(