pindo 4.8.8 → 4.8.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.
- checksums.yaml +4 -4
- data/lib/pindo/base/githelper.rb +21 -0
- data/lib/pindo/client/unityhelper.rb +179 -0
- data/lib/pindo/command/deploy/build.rb +2 -3
- data/lib/pindo/command/ios/debug.rb +10 -4
- data/lib/pindo/command/unity/apk.rb +2 -0
- data/lib/pindo/command/unity/ipa.rb +77 -1
- data/lib/pindo/module/pgyer/pgyerhelper.rb +29 -6
- data/lib/pindo/version.rb +1 -1
- data/lib/pindo.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d618bb3feb5391c7e4c64105f4f34e72fd542421da102a97e7436ed5d02261c
|
4
|
+
data.tar.gz: 829babd10a742d61b622e248aa79429c6930f084dfcf90206540fe0fd9b64cf5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f443d03a4934fc8ac2d31ec39bb3ad861a62c28bdd6542a434511cfe1d92f0cb8a6e35736809414e5b564fcec86b0d6393e65d70cec686cd64e518a334ac0277
|
7
|
+
data.tar.gz: dd3b27fbcbc5b0392371d6e84feb14a9ece7241b940d7bfc162651d3eee3dd0a74998a5631bb5bb6d9c3115c222d4efff7de3f7df9cb24e85835ba101676ee46
|
data/lib/pindo/base/githelper.rb
CHANGED
@@ -19,6 +19,27 @@ module Pindo
|
|
19
19
|
|
20
20
|
end
|
21
21
|
|
22
|
+
def is_git_directory?(local_repo_dir: nil)
|
23
|
+
args = local_repo_dir ? %W(-C #{local_repo_dir} rev-parse --is-inside-work-tree) : %w(rev-parse --is-inside-work-tree)
|
24
|
+
begin
|
25
|
+
git!(args)
|
26
|
+
true
|
27
|
+
rescue StandardError => e
|
28
|
+
false
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def git_root_directory(local_repo_dir: nil)
|
33
|
+
return nil unless is_git_directory?(local_repo_dir: local_repo_dir)
|
34
|
+
|
35
|
+
args = local_repo_dir ? %W(-C #{local_repo_dir} rev-parse --show-toplevel) : %w(rev-parse --show-toplevel)
|
36
|
+
begin
|
37
|
+
git!(args).strip
|
38
|
+
rescue StandardError => e
|
39
|
+
nil
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
22
43
|
def add_branch(local_repo_dir: nil, branch: nil)
|
23
44
|
|
24
45
|
current=Dir.pwd
|
@@ -0,0 +1,179 @@
|
|
1
|
+
require 'open3'
|
2
|
+
require 'json'
|
3
|
+
require 'singleton'
|
4
|
+
|
5
|
+
module Pindo
|
6
|
+
module Client
|
7
|
+
class UnityHelper
|
8
|
+
include Singleton
|
9
|
+
|
10
|
+
UNITY_MAC_PATHS = [
|
11
|
+
"/Applications/Unity/Unity.app/Contents/MacOS/Unity",
|
12
|
+
"/Applications/Unity/Hub/Editor/*/Unity.app/Contents/MacOS/Unity"
|
13
|
+
]
|
14
|
+
|
15
|
+
UNITY_WINDOWS_PATHS = [
|
16
|
+
"C:/Program Files/Unity/Editor/Unity.exe",
|
17
|
+
"C:/Program Files/Unity/Hub/Editor/*/Unity.exe"
|
18
|
+
]
|
19
|
+
|
20
|
+
TARGET_UNITY_VERSION = "2021.3"
|
21
|
+
|
22
|
+
class << self
|
23
|
+
def share_instance
|
24
|
+
instance
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def find_unity_path
|
29
|
+
paths = case RUBY_PLATFORM
|
30
|
+
when /darwin/
|
31
|
+
UNITY_MAC_PATHS
|
32
|
+
when /mswin|mingw|windows/
|
33
|
+
UNITY_WINDOWS_PATHS
|
34
|
+
else
|
35
|
+
raise "Unsupported platform: #{RUBY_PLATFORM}"
|
36
|
+
end
|
37
|
+
|
38
|
+
unity_versions = []
|
39
|
+
|
40
|
+
paths.each do |path|
|
41
|
+
if path.include?("*")
|
42
|
+
Dir.glob(path).each do |expanded_path|
|
43
|
+
# 从路径中提取版本号
|
44
|
+
version = extract_version_from_path(expanded_path)
|
45
|
+
if version && version.start_with?(TARGET_UNITY_VERSION)
|
46
|
+
unity_versions << {
|
47
|
+
path: expanded_path,
|
48
|
+
version: version
|
49
|
+
}
|
50
|
+
end
|
51
|
+
end
|
52
|
+
elsif File.exist?(path)
|
53
|
+
version = extract_version_from_path(path)
|
54
|
+
if version && version.start_with?(TARGET_UNITY_VERSION)
|
55
|
+
unity_versions << {
|
56
|
+
path: path,
|
57
|
+
version: version
|
58
|
+
}
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
if unity_versions.empty?
|
64
|
+
raise "No Unity #{TARGET_UNITY_VERSION} found in standard locations"
|
65
|
+
end
|
66
|
+
|
67
|
+
# 按版本号排序,取最新的2021.3.x版本
|
68
|
+
selected_unity = unity_versions.sort_by { |v| Gem::Version.new(v[:version]) }.last
|
69
|
+
puts "Selected Unity version: #{selected_unity[:version]}"
|
70
|
+
selected_unity[:path]
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
def extract_version_from_path(path)
|
76
|
+
# macOS路径格式: /Applications/Unity/Hub/Editor/2021.3.45f1/Unity.app/Contents/MacOS/Unity
|
77
|
+
# Windows路径格式: C:/Program Files/Unity/Hub/Editor/2021.3.45f1/Editor/Unity.exe
|
78
|
+
if match = path.match(/Editor\/([\d.]+[a-zA-Z]\d+)\//)
|
79
|
+
match[1]
|
80
|
+
else
|
81
|
+
nil
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
public
|
86
|
+
|
87
|
+
def execute_unity_command(project_path, method_name, additional_args = {})
|
88
|
+
unity_path = find_unity_path
|
89
|
+
|
90
|
+
cmd_args = [
|
91
|
+
unity_path,
|
92
|
+
"-batchmode",
|
93
|
+
"-quit",
|
94
|
+
"-projectPath",
|
95
|
+
project_path.to_s,
|
96
|
+
"-executeMethod",
|
97
|
+
method_name
|
98
|
+
]
|
99
|
+
|
100
|
+
# Add any additional arguments
|
101
|
+
additional_args.each do |key, value|
|
102
|
+
cmd_args << "-#{key}"
|
103
|
+
cmd_args << value.to_s if value
|
104
|
+
end
|
105
|
+
|
106
|
+
puts "Executing Unity command: #{cmd_args.join(' ')}"
|
107
|
+
stdout, stderr, status = Open3.capture3(*cmd_args)
|
108
|
+
|
109
|
+
{
|
110
|
+
success: status.success?,
|
111
|
+
stdout: stdout,
|
112
|
+
stderr: stderr,
|
113
|
+
exit_status: status.exitstatus,
|
114
|
+
unity_version: extract_version_from_path(unity_path)
|
115
|
+
}
|
116
|
+
end
|
117
|
+
|
118
|
+
def build_project(project_path, build_method, platform: nil, output_path: nil)
|
119
|
+
additional_args = {}
|
120
|
+
additional_args[:buildTarget] = platform if platform
|
121
|
+
additional_args[:outputPath] = output_path if output_path
|
122
|
+
|
123
|
+
result = execute_unity_command(project_path, build_method, additional_args)
|
124
|
+
|
125
|
+
if result[:success]
|
126
|
+
puts "Unity build completed successfully"
|
127
|
+
puts "Using Unity version: #{result[:unity_version]}"
|
128
|
+
puts result[:stdout]
|
129
|
+
else
|
130
|
+
puts "Unity build failed"
|
131
|
+
puts "Unity version: #{result[:unity_version]}"
|
132
|
+
puts result[:stderr]
|
133
|
+
raise "Unity build failed with status: #{result[:exit_status]}"
|
134
|
+
end
|
135
|
+
|
136
|
+
result
|
137
|
+
end
|
138
|
+
|
139
|
+
def get_project_settings(project_path)
|
140
|
+
settings_path = File.join(project_path, "ProjectSettings", "ProjectSettings.asset")
|
141
|
+
if File.exist?(settings_path)
|
142
|
+
File.read(settings_path)
|
143
|
+
else
|
144
|
+
raise "Project settings file not found at #{settings_path}"
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
def get_unity_version(project_path)
|
149
|
+
version_path = File.join(project_path, "ProjectSettings", "ProjectVersion.txt")
|
150
|
+
if File.exist?(version_path)
|
151
|
+
content = File.read(version_path)
|
152
|
+
if content =~ /m_EditorVersion: (.*)/
|
153
|
+
version = $1.strip
|
154
|
+
unless version.start_with?(TARGET_UNITY_VERSION)
|
155
|
+
raise "Project Unity version (#{version}) does not match required version (#{TARGET_UNITY_VERSION}.x)"
|
156
|
+
end
|
157
|
+
version
|
158
|
+
else
|
159
|
+
raise "Could not parse Unity version from #{version_path}"
|
160
|
+
end
|
161
|
+
else
|
162
|
+
raise "Project version file not found at #{version_path}"
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
def verify_unity_version(project_path)
|
167
|
+
project_version = get_unity_version(project_path)
|
168
|
+
unity_path = find_unity_path
|
169
|
+
editor_version = extract_version_from_path(unity_path)
|
170
|
+
|
171
|
+
if project_version != editor_version
|
172
|
+
raise "Project Unity version (#{project_version}) does not match Editor version (#{editor_version})"
|
173
|
+
end
|
174
|
+
|
175
|
+
true
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
@@ -77,13 +77,12 @@ module Pindo
|
|
77
77
|
config = FastlaneCore::Configuration.create(Gym::Options.available_options, gym_options)
|
78
78
|
Gym::Manager.new.work(config)
|
79
79
|
|
80
|
-
|
81
|
-
|
82
80
|
pindo_new_project_dir = Dir.pwd
|
83
81
|
build_path = File.join(pindo_new_project_dir, "build", "*.ipa")
|
84
82
|
ipa_file_upload = Dir.glob(build_path).max_by {|f| File.mtime(f)}
|
85
|
-
|
83
|
+
|
86
84
|
if !ipa_file_upload.nil? && !app_info_obj.nil?
|
85
|
+
|
87
86
|
description = nil
|
88
87
|
result_data = PgyerHelper.share_instace.start_upload(app_info_obj:app_info_obj, ipa_file_upload:ipa_file_upload, description:description)
|
89
88
|
if !result_data.nil? && !result_data["data"].nil? && !result_data["data"]["id"].nil?
|
@@ -44,6 +44,7 @@ module Pindo
|
|
44
44
|
# 命令的选项列表
|
45
45
|
def self.options
|
46
46
|
[
|
47
|
+
['--bundleid', '指定打包的bundleID'],
|
47
48
|
# 指定上传到蒲公英的项目
|
48
49
|
['--proj', '指定上传到测试平台的项目名称'],
|
49
50
|
# 上传编译包
|
@@ -59,7 +60,8 @@ module Pindo
|
|
59
60
|
@args_adhoc_flag = argv.flag?('adhoc', false)
|
60
61
|
@args_upload_flag = argv.flag?('upload', false)
|
61
62
|
@args_send_flag = argv.flag?('send', false)
|
62
|
-
@args_proj_name = argv.option('proj')
|
63
|
+
@args_proj_name = argv.option('proj')
|
64
|
+
@args_bundle_id = argv.option('bundleid')
|
63
65
|
|
64
66
|
if @args_send_flag
|
65
67
|
@args_upload_flag = true
|
@@ -77,10 +79,14 @@ module Pindo
|
|
77
79
|
def run
|
78
80
|
|
79
81
|
mainapp_bundleid= nil
|
80
|
-
if @
|
81
|
-
mainapp_bundleid =
|
82
|
+
if @args_bundle_id
|
83
|
+
mainapp_bundleid = @args_bundle_id
|
82
84
|
else
|
83
|
-
|
85
|
+
if @args_deploy_flag
|
86
|
+
mainapp_bundleid = get_selected_deploy_bundleid()
|
87
|
+
else
|
88
|
+
mainapp_bundleid = get_selected_dev_bundleid()
|
89
|
+
end
|
84
90
|
end
|
85
91
|
|
86
92
|
app_info_obj = nil
|
@@ -3,11 +3,15 @@ require 'xcodeproj'
|
|
3
3
|
require 'find'
|
4
4
|
require 'fileutils'
|
5
5
|
require 'pindo/base/executable'
|
6
|
+
require 'pindo/client/unityhelper'
|
6
7
|
|
7
8
|
module Pindo
|
8
9
|
class Command
|
9
10
|
class Unity < Command
|
10
11
|
class Ipa < Unity
|
12
|
+
|
13
|
+
include Appselect
|
14
|
+
|
11
15
|
# Unity IPA包编译和上传命令
|
12
16
|
self.summary = '编译Unity工程生成iOS IPA并支持上传到测试平台'
|
13
17
|
|
@@ -54,6 +58,7 @@ module Pindo
|
|
54
58
|
@args_proj_name = argv.option('proj')
|
55
59
|
@args_upload_flag = argv.flag?('upload', false)
|
56
60
|
@args_send_flag = argv.flag?('send', false)
|
61
|
+
@args_deploy_flag = argv.flag?('deploy', false)
|
57
62
|
|
58
63
|
if @args_send_flag
|
59
64
|
@args_upload_flag = true
|
@@ -62,10 +67,81 @@ module Pindo
|
|
62
67
|
super
|
63
68
|
end
|
64
69
|
|
70
|
+
def export_ios_project(project_path)
|
71
|
+
begin
|
72
|
+
# 获取 UnityHelper 实例
|
73
|
+
unity_helper = Pindo::Client::UnityHelper.share_instance
|
74
|
+
|
75
|
+
# 准备额外的参数
|
76
|
+
additional_args = {
|
77
|
+
'platform' => 'iOS'
|
78
|
+
}
|
79
|
+
|
80
|
+
# 执行Unity命令
|
81
|
+
result = unity_helper.execute_unity_command(
|
82
|
+
project_path,
|
83
|
+
'GoodUnityBuild.BuildManager.BatchBuild',
|
84
|
+
additional_args
|
85
|
+
)
|
86
|
+
|
87
|
+
if result[:success]
|
88
|
+
puts "Unity iOS library build completed successfully"
|
89
|
+
puts "Unity version: #{result[:unity_version]}"
|
90
|
+
puts "Output:"
|
91
|
+
puts result[:stdout]
|
92
|
+
return true
|
93
|
+
else
|
94
|
+
puts "Unity iOS library build failed"
|
95
|
+
puts "Unity version: #{result[:unity_version]}"
|
96
|
+
puts "Error:"
|
97
|
+
puts result[:stderr]
|
98
|
+
raise "Build failed with status: #{result[:exit_status]}"
|
99
|
+
end
|
100
|
+
|
101
|
+
rescue => e
|
102
|
+
puts "Error during Unity build: #{e.message}"
|
103
|
+
puts e.backtrace
|
104
|
+
return false
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
65
108
|
|
66
109
|
def run
|
110
|
+
|
111
|
+
app_info_obj = nil
|
112
|
+
if @args_upload_flag
|
113
|
+
proj_name = @args_proj_name
|
114
|
+
app_info_obj = PgyerHelper.share_instace.prepare_upload(working_directory:Dir.pwd, proj_name:proj_name)
|
115
|
+
end
|
116
|
+
puts app_info_obj
|
117
|
+
|
118
|
+
mainapp_bundleid= nil
|
119
|
+
if @args_deploy_flag
|
120
|
+
mainapp_bundleid = get_selected_deploy_bundleid()
|
121
|
+
else
|
122
|
+
mainapp_bundleid = get_selected_dev_bundleid()
|
123
|
+
end
|
124
|
+
|
125
|
+
pindo_unity_project_dir = Dir.pwd
|
126
|
+
export_ios_project(pindo_unity_project_dir)
|
127
|
+
|
128
|
+
|
129
|
+
pindo_ios_project_dir = File.join(pindo_unity_project_dir, "Builds/iOS")
|
130
|
+
args_temp = []
|
131
|
+
|
132
|
+
args_temp << "--bundleid=#{mainapp_bundleid}"
|
133
|
+
|
134
|
+
if @args_upload_flag
|
135
|
+
args_temp << "--proj=#{app_info_obj["appName"]}"
|
136
|
+
args_temp << "--upload"
|
137
|
+
end
|
138
|
+
if @args_send_flag
|
139
|
+
args_temp << "--send"
|
140
|
+
end
|
141
|
+
Dir.chdir(pindo_ios_project_dir)
|
142
|
+
|
143
|
+
Pindo::Command::Ios::Debug::run(args_temp)
|
67
144
|
|
68
|
-
puts "ipa "
|
69
145
|
|
70
146
|
end
|
71
147
|
|
@@ -172,21 +172,44 @@ module Pindo
|
|
172
172
|
args_ipa_file_dir = File.expand_path(File::dirname(ipa_file_upload))
|
173
173
|
ipa_file_upload=File.join(args_ipa_file_dir, File.basename(ipa_file_upload))
|
174
174
|
current_project_dir = Dir.pwd
|
175
|
-
|
176
|
-
|
175
|
+
puts "+++++1 current_project_dir = #{current_project_dir}"
|
176
|
+
|
177
|
+
if description.nil? && is_git_directory?(local_repo_dir: current_project_dir)
|
178
|
+
puts "+++++2 current_project_dir = #{current_project_dir}"
|
179
|
+
|
180
|
+
current_git_root_path = git_root_directory(local_repo_dir: current_project_dir)
|
181
|
+
puts "+++++3 current_git_root_path = #{current_git_root_path}"
|
182
|
+
|
177
183
|
xcodeproj_file_name = Dir.glob(File.join(current_project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
|
178
184
|
if !xcodeproj_file_name.nil? && !xcodeproj_file_name.empty? && File.exist?(xcodeproj_file_name)
|
185
|
+
puts "+++++4 xcodeproj_file_name = #{xcodeproj_file_name}"
|
186
|
+
|
179
187
|
project_obj = Xcodeproj::Project.open(xcodeproj_file_name)
|
180
188
|
main_target = project_obj.targets.select { |target| target.product_type.include?(Xcodeproj::Constants::PRODUCT_TYPE_UTI[:application]) }.first
|
181
189
|
provisioning_profile_name = main_target.build_configurations.first.build_settings['PROVISIONING_PROFILE_SPECIFIER'].downcase.split(" ")
|
182
190
|
if provisioning_profile_name.include?("adhoc")
|
183
191
|
description = git!(%W(-C #{current_project_dir} show -s --format=commit::%H)).strip
|
184
192
|
elsif provisioning_profile_name.include?("development")
|
185
|
-
|
186
|
-
|
193
|
+
cliff_toml_path = File.join(current_git_root_path, "cliff.toml")
|
194
|
+
if File.exist?(cliff_toml_path)
|
195
|
+
begin
|
196
|
+
`git-cliff --version`
|
197
|
+
git_cliff_installed = $?.success?
|
198
|
+
if git_cliff_installed
|
199
|
+
temp_dir = Dir.pwd
|
200
|
+
Dir.chdir(current_git_root_path)
|
201
|
+
description = `git-cliff -c #{cliff_toml_path} --latest -o -`.strip
|
202
|
+
description = " " if description.empty?
|
203
|
+
Dir.chdir(temp_dir)
|
204
|
+
else
|
205
|
+
description = " "
|
206
|
+
end
|
207
|
+
rescue StandardError => e
|
208
|
+
description = " "
|
209
|
+
end
|
187
210
|
else
|
188
|
-
description =
|
189
|
-
end
|
211
|
+
description = " "
|
212
|
+
end
|
190
213
|
elsif provisioning_profile_name.include?("appstore")
|
191
214
|
description = "提交包重签名"
|
192
215
|
end
|
data/lib/pindo/version.rb
CHANGED
data/lib/pindo.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pindo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.8.
|
4
|
+
version: 4.8.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- wade
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-02-
|
10
|
+
date: 2025-02-19 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: claide
|
@@ -240,6 +240,7 @@ files:
|
|
240
240
|
- lib/pindo/client/pgyerclient.rb
|
241
241
|
- lib/pindo/client/pgyeruploadclient.rb
|
242
242
|
- lib/pindo/client/tgateclient.rb
|
243
|
+
- lib/pindo/client/unityhelper.rb
|
243
244
|
- lib/pindo/command.rb
|
244
245
|
- lib/pindo/command/android.rb
|
245
246
|
- lib/pindo/command/android/debug.rb
|