pindo 5.1.2 → 5.1.4
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/command/android/autobuild.rb +19 -7
- data/lib/pindo/command/android/build.rb +5 -6
- data/lib/pindo/command/android/debug.rb +0 -9
- data/lib/pindo/command/feishu/send_message.rb +103 -0
- data/lib/pindo/command/feishu.rb +50 -0
- data/lib/pindo/command/ios/autobuild.rb +10 -10
- data/lib/pindo/command/ios/build.rb +4 -5
- data/lib/pindo/command/ios/debug.rb +64 -10
- data/lib/pindo/command/pgyer/upload.rb +0 -2
- data/lib/pindo/command/unity/apk.rb +6 -8
- data/lib/pindo/command/unity/autobuild.rb +205 -0
- data/lib/pindo/command/unity/ipa.rb +15 -10
- data/lib/pindo/command/unity/web.rb +152 -0
- data/lib/pindo/command/unity.rb +1 -1
- data/lib/pindo/command/web/run.rb +15 -168
- data/lib/pindo/module/android/build_helper.rb +325 -0
- data/lib/pindo/module/webserver/preview/preview.css +433 -0
- data/lib/pindo/module/webserver/preview/preview.html +73 -0
- data/lib/pindo/module/webserver/preview/preview.js +595 -0
- data/lib/pindo/module/webserver/responsive_preview_handler.rb +92 -816
- data/lib/pindo/module/webserver/webgl_server_helper.rb +175 -3
- data/lib/pindo/version.rb +1 -1
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5eda913afe12b6e589a0ac3981040fe27b575045a488afb373f1825e548fb53d
|
4
|
+
data.tar.gz: 660bfab7bec17ed41564c2d925d7fb7014754e421a2db9cc5cf77369a0b41db3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3712e5cc54bae69dd86d022f1ba73c6e8a1848beb4c09d420e4dd94ce5b9a9d5b96a88acc723525bfb4b3fa3b0bf1ecfa6b7c0567ea6f08fbfd4392c8e554fd
|
7
|
+
data.tar.gz: 4c8cc257d0ccc1fc5cc475421ab805d98f159a645c88feb81ca8559ebe519fe57ae83f63e152cb1ef46ea057ed325b0f0a671f1caa29e426e9a1f01c04872988
|
@@ -79,23 +79,35 @@ module Pindo
|
|
79
79
|
def android_autobuild
|
80
80
|
|
81
81
|
pindo_project_dir = Dir.pwd
|
82
|
-
|
82
|
+
|
83
|
+
app_info_obj = nil
|
84
|
+
if @args_upload_flag
|
85
|
+
proj_name = @args_proj_name
|
86
|
+
app_info_obj = PgyerHelper.share_instace.prepare_upload(working_directory:Dir.pwd, proj_name:proj_name)
|
87
|
+
end
|
83
88
|
|
89
|
+
build_helper = Pindo::BuildHelper.share_instance
|
84
90
|
if @args_upload_flag
|
85
|
-
build_helper.check_check_and_install_cliff(pindo_project_dir)
|
86
91
|
is_need_add_tag,tag_action_parms = build_helper.check_is_need_add_tag?(pindo_project_dir)
|
87
92
|
if is_need_add_tag
|
88
93
|
Pindo::Command::Dev::Tag::run(tag_action_parms)
|
89
94
|
end
|
90
95
|
end
|
91
|
-
|
92
|
-
|
93
|
-
if
|
94
|
-
|
95
|
-
|
96
|
+
|
97
|
+
scheme_name = @args_proj_name if @args_proj_name
|
98
|
+
if !app_info_obj.nil? && !app_info_obj["appName"].nil? && !app_info_obj["appName"].empty?
|
99
|
+
scheme_name = app_info_obj["appName"]
|
100
|
+
end
|
101
|
+
if scheme_name.nil? || scheme_name.empty? && is_git_directory?(local_repo_dir:pindo_project_dir)
|
102
|
+
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
|
+
end
|
96
107
|
end
|
97
108
|
|
98
109
|
android_build_helper = Pindo::AndroidBuildHelper.share_instance
|
110
|
+
android_build_helper.add_test_scheme(project_dir:pindo_project_dir,scheme_name:scheme_name)
|
99
111
|
apk_path = android_build_helper.auto_build_apk(pindo_project_dir, !@args_release_flag)
|
100
112
|
ipa_file_upload = Dir.glob(apk_path).max_by {|f| File.mtime(f)}
|
101
113
|
|
@@ -73,13 +73,12 @@ module Pindo
|
|
73
73
|
pindo_project_dir = Dir.pwd
|
74
74
|
build_helper = Pindo::BuildHelper.share_instance
|
75
75
|
if @args_upload_flag
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
end
|
76
|
+
is_need_add_tag,tag_action_parms = build_helper.check_is_need_add_tag?(pindo_project_dir)
|
77
|
+
if is_need_add_tag
|
78
|
+
Pindo::Command::Dev::Tag::run(tag_action_parms)
|
79
|
+
end
|
81
80
|
end
|
82
|
-
|
81
|
+
|
83
82
|
app_info_obj = nil
|
84
83
|
if @args_upload_flag
|
85
84
|
proj_name = @args_proj_name
|
@@ -78,15 +78,6 @@ module Pindo
|
|
78
78
|
return
|
79
79
|
end
|
80
80
|
|
81
|
-
build_helper = Pindo::BuildHelper.share_instance
|
82
|
-
|
83
|
-
if @args_upload_flag
|
84
|
-
build_helper.check_check_and_install_cliff(pindo_project_dir)
|
85
|
-
is_need_add_tag,tag_action_parms = build_helper.check_is_need_add_tag?(pindo_project_dir)
|
86
|
-
if is_need_add_tag
|
87
|
-
Pindo::Command::Dev::Tag::run(tag_action_parms)
|
88
|
-
end
|
89
|
-
end
|
90
81
|
|
91
82
|
app_info_obj = nil
|
92
83
|
if @args_upload_flag
|
@@ -0,0 +1,103 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
require 'net/http'
|
5
|
+
require 'uri'
|
6
|
+
require 'pindo/client/httpclient'
|
7
|
+
|
8
|
+
module Pindo
|
9
|
+
module Command
|
10
|
+
module Feishu
|
11
|
+
class SendMessage
|
12
|
+
def self.run(options)
|
13
|
+
new(options).run
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(options)
|
17
|
+
@options = options
|
18
|
+
@webhook_url = options[:webhook_url]
|
19
|
+
@message = options[:message]
|
20
|
+
@title = options[:title] || "通知"
|
21
|
+
@at_all = options[:at_all] || false
|
22
|
+
end
|
23
|
+
|
24
|
+
def run
|
25
|
+
unless @webhook_url
|
26
|
+
puts "错误:未提供飞书 webhook URL"
|
27
|
+
return false
|
28
|
+
end
|
29
|
+
|
30
|
+
unless @message
|
31
|
+
puts "错误:未提供消息内容"
|
32
|
+
return false
|
33
|
+
end
|
34
|
+
|
35
|
+
send_message
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def send_message
|
41
|
+
uri = URI(@webhook_url)
|
42
|
+
|
43
|
+
# 构建消息内容
|
44
|
+
content = {
|
45
|
+
"msg_type": "post",
|
46
|
+
"content": {
|
47
|
+
"post": {
|
48
|
+
"zh_cn": {
|
49
|
+
"title": @title,
|
50
|
+
"content": [
|
51
|
+
[
|
52
|
+
{
|
53
|
+
"tag": "text",
|
54
|
+
"text": @message
|
55
|
+
}
|
56
|
+
]
|
57
|
+
]
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
# 如果需要@所有人
|
64
|
+
if @at_all
|
65
|
+
content[:content][:post][:zh_cn][:content][0].unshift(
|
66
|
+
{
|
67
|
+
"tag": "at",
|
68
|
+
"user_id": "all"
|
69
|
+
}
|
70
|
+
)
|
71
|
+
end
|
72
|
+
|
73
|
+
# 发送请求
|
74
|
+
begin
|
75
|
+
con = HttpClient.create_instance_with_proxy
|
76
|
+
res = con.post do |req|
|
77
|
+
req.url uri
|
78
|
+
req.headers['Content-Type'] = 'application/json'
|
79
|
+
req.body = content.to_json
|
80
|
+
end
|
81
|
+
|
82
|
+
if res.status == 200
|
83
|
+
result = JSON.parse(res.body)
|
84
|
+
if result['code'] == 0
|
85
|
+
puts "消息发送成功!"
|
86
|
+
return true
|
87
|
+
else
|
88
|
+
puts "消息发送失败:#{result['msg']}"
|
89
|
+
return false
|
90
|
+
end
|
91
|
+
else
|
92
|
+
puts "消息发送失败:HTTP #{res.status}"
|
93
|
+
return false
|
94
|
+
end
|
95
|
+
rescue => e
|
96
|
+
puts "发送消息时出错:#{e.message}"
|
97
|
+
return false
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'claide'
|
4
|
+
require 'pindo/command/feishu/send_message'
|
5
|
+
|
6
|
+
module Pindo
|
7
|
+
module Command
|
8
|
+
class Feishu < CLAide::Command
|
9
|
+
self.description = '飞书相关命令'
|
10
|
+
self.command = 'feishu'
|
11
|
+
self.abstract_command = true
|
12
|
+
|
13
|
+
def self.options
|
14
|
+
[
|
15
|
+
['--webhook-url=URL', '飞书 webhook URL'],
|
16
|
+
['--message=MESSAGE', '要发送的消息内容'],
|
17
|
+
['--title=TITLE', '消息标题(可选)'],
|
18
|
+
['--at-all', '是否@所有人(可选)']
|
19
|
+
]
|
20
|
+
end
|
21
|
+
|
22
|
+
def initialize(argv)
|
23
|
+
super
|
24
|
+
@webhook_url = argv.option('webhook-url')
|
25
|
+
@message = argv.option('message')
|
26
|
+
@title = argv.option('title')
|
27
|
+
@at_all = argv.flag?('at-all')
|
28
|
+
end
|
29
|
+
|
30
|
+
def validate!
|
31
|
+
super
|
32
|
+
unless @webhook_url
|
33
|
+
help! '必须提供 webhook URL'
|
34
|
+
end
|
35
|
+
unless @message
|
36
|
+
help! '必须提供消息内容'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def run
|
41
|
+
Pindo::Command::Feishu::SendMessage.run(
|
42
|
+
webhook_url: @webhook_url,
|
43
|
+
message: @message,
|
44
|
+
title: @title,
|
45
|
+
at_all: @at_all
|
46
|
+
)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -88,6 +88,7 @@ module Pindo
|
|
88
88
|
args_temp << "--proj=#{@args_proj_name}" if @args_proj_name
|
89
89
|
args_temp << "--upload" if @args_upload_flag
|
90
90
|
args_temp << "--send" if @args_send_flag
|
91
|
+
args_temp << "--bundleid=#{@args_bundle_id}" if @args_bundle_id
|
91
92
|
case project_type
|
92
93
|
when :ios
|
93
94
|
ios_autobuild
|
@@ -106,15 +107,12 @@ module Pindo
|
|
106
107
|
|
107
108
|
pindo_project_dir = Dir.pwd
|
108
109
|
build_helper = Pindo::BuildHelper.share_instance
|
109
|
-
|
110
110
|
if @args_upload_flag
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
end
|
111
|
+
is_need_add_tag,tag_action_parms = build_helper.check_is_need_add_tag?(pindo_project_dir)
|
112
|
+
if is_need_add_tag
|
113
|
+
Pindo::Command::Dev::Tag::run(tag_action_parms)
|
114
|
+
end
|
116
115
|
end
|
117
|
-
|
118
116
|
new_project_fullname = Dir.glob(File.join(pindo_project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
|
119
117
|
if !new_project_fullname.nil? && File.exist?(new_project_fullname)
|
120
118
|
build_helper.delete_libtarget_firebase_shell(pindo_project_dir)
|
@@ -122,6 +120,7 @@ module Pindo
|
|
122
120
|
|
123
121
|
|
124
122
|
mainapp_bundleid= nil
|
123
|
+
puts "args_bundle_id: #{@args_bundle_id}"
|
125
124
|
if @args_bundle_id
|
126
125
|
mainapp_bundleid = @args_bundle_id
|
127
126
|
else
|
@@ -158,8 +157,8 @@ module Pindo
|
|
158
157
|
end
|
159
158
|
end
|
160
159
|
|
161
|
-
Pindo::Command::Ios::Debug::modify_cert_with_project(project_dir:pindo_project_dir, config_file:config_json_file, scheme_name:scheme_name)
|
162
|
-
|
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
|
+
|
163
162
|
if File.exist?(File.join(pindo_project_dir, "Podfile"))
|
164
163
|
|
165
164
|
args_temp = []
|
@@ -212,7 +211,8 @@ module Pindo
|
|
212
211
|
end
|
213
212
|
|
214
213
|
Pindo::Command::Deploy::Cert::run(args_temp)
|
215
|
-
|
214
|
+
Pindo::Command::Ios::Debug::modify_plist_scheme(project_dir:pindo_project_dir, scheme_name:scheme_name)
|
215
|
+
|
216
216
|
Dir.chdir(pindo_project_dir)
|
217
217
|
Pindo::Command::Deploy::Build::run(args_temp)
|
218
218
|
|
@@ -91,11 +91,10 @@ module Pindo
|
|
91
91
|
pindo_project_dir = Dir.pwd
|
92
92
|
build_helper = Pindo::BuildHelper.share_instance
|
93
93
|
if @args_upload_flag
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
end
|
94
|
+
is_need_add_tag,tag_action_parms = build_helper.check_is_need_add_tag?(pindo_project_dir)
|
95
|
+
if is_need_add_tag
|
96
|
+
Pindo::Command::Dev::Tag::run(tag_action_parms)
|
97
|
+
end
|
99
98
|
end
|
100
99
|
|
101
100
|
new_project_fullname = Dir.glob(File.join(pindo_project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
|
@@ -72,7 +72,7 @@ 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)
|
75
|
+
Pindo::Command::Ios::Debug::modify_cert_with_project(project_dir:project_dir, config_file:config_json_file, bundleid:mainapp_bundleid)
|
76
76
|
|
77
77
|
args_temp = []
|
78
78
|
if @args_adhoc_flag
|
@@ -104,7 +104,7 @@ module Pindo
|
|
104
104
|
|
105
105
|
end
|
106
106
|
|
107
|
-
def self.modify_cert_with_project(project_dir:nil, config_file:nil, scheme_name:nil)
|
107
|
+
def self.modify_cert_with_project(project_dir:nil, config_file:nil, scheme_name:nil, bundleid:nil)
|
108
108
|
|
109
109
|
project_fullname = Dir.glob(File.join(project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
|
110
110
|
if !project_fullname.nil?
|
@@ -128,16 +128,18 @@ module Pindo
|
|
128
128
|
if !info_plist_path.nil? && File.exist?(info_plist_path) && !scheme_name.nil? && !scheme_name.empty?
|
129
129
|
scheme_name = scheme_name.to_s.downcase.strip.gsub(/[\s\-_]/, '')
|
130
130
|
info_plist_dict = Xcodeproj::Plist.read_from_path(info_plist_path)
|
131
|
-
info_plist_dict["CFBundleURLTypes"] = []
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
131
|
+
info_plist_dict["CFBundleURLTypes"] = info_plist_dict["CFBundleURLTypes"] || []
|
132
|
+
# info_plist_dict["CFBundleURLTypes"] 中不存在CFBundleURLName为scheme_name的item
|
133
|
+
if !info_plist_dict["CFBundleURLTypes"].any? { |item| item["CFBundleURLName"] == scheme_name }
|
134
|
+
item0 = {}
|
135
|
+
item0["CFBundleTypeRole"] = "Editor"
|
136
|
+
item0["CFBundleURLName"] = scheme_name
|
137
|
+
item0["CFBundleURLSchemes"] = []
|
138
|
+
item0["CFBundleURLSchemes"] << scheme_name
|
139
|
+
info_plist_dict["CFBundleURLTypes"] << item0
|
140
|
+
end
|
138
141
|
Xcodeproj::Plist.write_to_path(info_plist_dict, info_plist_path)
|
139
142
|
end
|
140
|
-
|
141
143
|
# puts entitlements_plist_path
|
142
144
|
if !entitlements_plist_path.nil? && File.exist?(entitlements_plist_path)
|
143
145
|
config_json = nil
|
@@ -174,7 +176,59 @@ module Pindo
|
|
174
176
|
|
175
177
|
end
|
176
178
|
|
179
|
+
def self.modify_plist_scheme(project_dir:nil, scheme_name:nil)
|
180
|
+
|
181
|
+
puts "modify_plist_scheme: #{project_dir} #{scheme_name}"
|
182
|
+
project_fullname = Dir.glob(File.join(project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
|
183
|
+
if !project_fullname.nil?
|
184
|
+
info_plist_path = nil
|
185
|
+
bundleid_scheme_name = nil
|
186
|
+
project_obj = Xcodeproj::Project.open(project_fullname)
|
187
|
+
project_obj.targets.each do |target|
|
188
|
+
if target.product_type.to_s.eql?("com.apple.product-type.application") then
|
189
|
+
temp_info_file = target.build_configurations.first.build_settings['INFOPLIST_FILE']
|
190
|
+
if !temp_info_file.nil? && !temp_info_file.empty?
|
191
|
+
info_plist_path = File.join(project_dir, temp_info_file)
|
192
|
+
end
|
193
|
+
bundleid_scheme_name = target.build_configurations.first.build_settings['PRODUCT_BUNDLE_IDENTIFIER']
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
if !info_plist_path.nil? && File.exist?(info_plist_path) && !scheme_name.nil? && !scheme_name.empty?
|
198
|
+
scheme_name = scheme_name.to_s.downcase.strip.gsub(/[\s\-_]/, '')
|
199
|
+
info_plist_dict = Xcodeproj::Plist.read_from_path(info_plist_path)
|
200
|
+
info_plist_dict["CFBundleURLTypes"] = info_plist_dict["CFBundleURLTypes"] || []
|
201
|
+
# info_plist_dict["CFBundleURLTypes"] 中不存在CFBundleURLName为scheme_name的item
|
202
|
+
if !info_plist_dict["CFBundleURLTypes"].any? { |item| item["CFBundleURLName"] == scheme_name }
|
203
|
+
item0 = {}
|
204
|
+
item0["CFBundleTypeRole"] = "Editor"
|
205
|
+
item0["CFBundleURLName"] = scheme_name
|
206
|
+
item0["CFBundleURLSchemes"] = []
|
207
|
+
item0["CFBundleURLSchemes"] << scheme_name
|
208
|
+
info_plist_dict["CFBundleURLTypes"] << item0
|
209
|
+
end
|
210
|
+
Xcodeproj::Plist.write_to_path(info_plist_dict, info_plist_path)
|
211
|
+
end
|
212
|
+
|
213
|
+
if !info_plist_path.nil? && File.exist?(info_plist_path) && !bundleid_scheme_name.nil? && !bundleid_scheme_name.empty?
|
214
|
+
info_plist_dict = Xcodeproj::Plist.read_from_path(info_plist_path)
|
215
|
+
info_plist_dict["CFBundleURLTypes"] = info_plist_dict["CFBundleURLTypes"] || []
|
216
|
+
# info_plist_dict["CFBundleURLTypes"] 中不存在CFBundleURLName为bundleid的item
|
217
|
+
if !bundleid_scheme_name.nil? || bundleid_scheme_name.empty? || !info_plist_dict["CFBundleURLTypes"].any? { |item| item["CFBundleURLName"] == bundleid_scheme_name }
|
218
|
+
item0 = {}
|
219
|
+
item0["CFBundleTypeRole"] = "Editor"
|
220
|
+
item0["CFBundleURLName"] = bundleid_scheme_name
|
221
|
+
item0["CFBundleURLSchemes"] = []
|
222
|
+
item0["CFBundleURLSchemes"] << bundleid_scheme_name
|
223
|
+
info_plist_dict["CFBundleURLTypes"] << item0
|
224
|
+
end
|
225
|
+
Xcodeproj::Plist.write_to_path(info_plist_dict, info_plist_path)
|
226
|
+
end
|
177
227
|
|
228
|
+
end
|
229
|
+
|
230
|
+
|
231
|
+
end
|
178
232
|
end
|
179
233
|
end
|
180
234
|
end
|
@@ -106,8 +106,6 @@ module Pindo
|
|
106
106
|
|
107
107
|
current_project_dir = Dir.pwd
|
108
108
|
build_helper = Pindo::BuildHelper.share_instance
|
109
|
-
build_helper.check_check_and_install_cliff(current_project_dir)
|
110
|
-
is_need_add_tag,tag_action_parms = build_helper.check_is_need_add_tag?(current_project_dir)
|
111
109
|
|
112
110
|
Dir.chdir(current_project_dir)
|
113
111
|
if is_need_add_tag
|
@@ -76,16 +76,14 @@ module Pindo
|
|
76
76
|
unless unity_helper.unity_project?(pindo_project_dir)
|
77
77
|
raise Informative, "当前目录不是Unity工程,请在Unity工程根目录下执行此命令"
|
78
78
|
end
|
79
|
-
|
79
|
+
build_helper = Pindo::BuildHelper.share_instance
|
80
80
|
if @args_upload_flag
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
Pindo::Command::Dev::Tag::run(tag_action_parms)
|
86
|
-
end
|
81
|
+
is_need_add_tag,tag_action_parms = build_helper.check_is_need_add_tag?(pindo_project_dir)
|
82
|
+
if is_need_add_tag
|
83
|
+
Pindo::Command::Dev::Tag::run(tag_action_parms)
|
84
|
+
end
|
87
85
|
end
|
88
|
-
|
86
|
+
|
89
87
|
project_unity_version = unity_helper.get_unity_version(pindo_project_dir)
|
90
88
|
puts
|
91
89
|
puts "工程的Unity版本: #{project_unity_version}"
|
@@ -0,0 +1,205 @@
|
|
1
|
+
require 'highline/import'
|
2
|
+
require 'xcodeproj'
|
3
|
+
require 'find'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'pindo/base/executable'
|
6
|
+
require 'pindo/module/build/unityhelper'
|
7
|
+
require 'pindo/module/build/buildhelper'
|
8
|
+
|
9
|
+
module Pindo
|
10
|
+
class Command
|
11
|
+
class Unity < Command
|
12
|
+
class Autobuild < Unity
|
13
|
+
|
14
|
+
include Appselect
|
15
|
+
|
16
|
+
include Pindo::Githelper
|
17
|
+
# Unity IPA包编译和上传命令
|
18
|
+
self.summary = '编译Unity工程生成iOS IPA并支持上传到测试平台'
|
19
|
+
|
20
|
+
# 详细说明
|
21
|
+
self.description = <<-DESC
|
22
|
+
编译Unity工程生成iOS IPA并支持上传到测试平台。
|
23
|
+
|
24
|
+
支持功能:
|
25
|
+
|
26
|
+
* 编译生成IPA
|
27
|
+
|
28
|
+
* 上传到测试平台
|
29
|
+
|
30
|
+
* 发送测试通知
|
31
|
+
|
32
|
+
使用示例:
|
33
|
+
|
34
|
+
$ pindo unity autobuild # 编译
|
35
|
+
|
36
|
+
$ pindo unity autobuild --upload # 编译并上传
|
37
|
+
|
38
|
+
$ pindo unity autobuild --proj=myapp # 指定项目名称
|
39
|
+
DESC
|
40
|
+
|
41
|
+
# 命令参数
|
42
|
+
self.arguments = [
|
43
|
+
# 暂无参数
|
44
|
+
]
|
45
|
+
|
46
|
+
# 命令选项
|
47
|
+
def self.options
|
48
|
+
[
|
49
|
+
['--bundleid', '指定打包的bundleID'],
|
50
|
+
['--proj', '指定上传到测试平台的项目名称'],
|
51
|
+
['--upload', '上传编译后的IPA到测试平台'],
|
52
|
+
['--base', 'Unity工程编译lib模式'],
|
53
|
+
].concat(super)
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
def initialize(argv)
|
58
|
+
|
59
|
+
@args_proj_name = argv.option('proj')
|
60
|
+
@args_upload_flag = argv.flag?('upload', false)
|
61
|
+
@args_base_flag = argv.flag?('base', false)
|
62
|
+
@args_bundle_id = argv.option('bundleid')
|
63
|
+
|
64
|
+
|
65
|
+
super
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
def run
|
70
|
+
|
71
|
+
pindo_project_dir = Dir.pwd
|
72
|
+
|
73
|
+
# 检查是否是Unity工程
|
74
|
+
unity_helper = Pindo::Client::UnityHelper.share_instance
|
75
|
+
unless unity_helper.unity_project?(pindo_project_dir)
|
76
|
+
raise Informative, "当前目录不是Unity工程,请在Unity工程根目录下执行此命令"
|
77
|
+
end
|
78
|
+
|
79
|
+
if @args_upload_flag
|
80
|
+
build_helper = Pindo::BuildHelper.share_instance
|
81
|
+
is_need_add_tag,tag_action_parms = build_helper.check_is_need_add_tag?(pindo_project_dir)
|
82
|
+
if is_need_add_tag
|
83
|
+
Pindo::Command::Dev::Tag::run(tag_action_parms)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
project_unity_version = unity_helper.get_unity_version(pindo_project_dir)
|
88
|
+
unity_exe_path = unity_helper.find_unity_path(project_unity_version:project_unity_version, force_change_version: @force_select_unity)
|
89
|
+
puts
|
90
|
+
puts "工程的Unity版本: #{project_unity_version}"
|
91
|
+
puts "选择的Unity路径: #{unity_exe_path}"
|
92
|
+
puts
|
93
|
+
|
94
|
+
|
95
|
+
app_info_obj = nil
|
96
|
+
if @args_upload_flag
|
97
|
+
proj_name = @args_proj_name
|
98
|
+
app_info_obj = PgyerHelper.share_instace.prepare_upload(working_directory:Dir.pwd, proj_name:proj_name)
|
99
|
+
end
|
100
|
+
|
101
|
+
pindo_project_dir = Dir.pwd
|
102
|
+
|
103
|
+
ios_autobuild(unity_helper:unity_helper, unity_exe_path:unity_exe_path)
|
104
|
+
Dir.chdir(pindo_project_dir)
|
105
|
+
|
106
|
+
and_autobuild(unity_helper:unity_helper, unity_exe_path:unity_exe_path)
|
107
|
+
Dir.chdir(pindo_project_dir)
|
108
|
+
|
109
|
+
web_autobuild(unity_helper:unity_helper, unity_exe_path:unity_exe_path)
|
110
|
+
Dir.chdir(pindo_project_dir)
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
def web_autobuild(unity_helper:nil, unity_exe_path:nil)
|
115
|
+
pindo_project_dir = Dir.pwd
|
116
|
+
|
117
|
+
web_export_dir = File.join(pindo_project_dir, "GoodPlatform/WebGL")
|
118
|
+
unity_helper.build_project(unity_exe_full_path:unity_exe_path, project_path:pindo_project_dir, platform:'WebGL')
|
119
|
+
|
120
|
+
system "open #{pindo_project_dir}"
|
121
|
+
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
def ios_autobuild(unity_helper:nil, unity_exe_path:nil)
|
126
|
+
|
127
|
+
pindo_project_dir = Dir.pwd
|
128
|
+
mainapp_bundleid= nil
|
129
|
+
if @args_bundle_id
|
130
|
+
mainapp_bundleid = @args_bundle_id
|
131
|
+
else
|
132
|
+
if @args_deploy_flag
|
133
|
+
mainapp_bundleid = get_selected_deploy_bundleid()
|
134
|
+
else
|
135
|
+
mainapp_bundleid = get_selected_dev_bundleid()
|
136
|
+
end
|
137
|
+
end
|
138
|
+
isLibrary = @args_base_flag
|
139
|
+
ios_export_lib_dir = File.join(pindo_project_dir, "GoodPlatform/BaseiOS")
|
140
|
+
if File.directory?(ios_export_lib_dir)
|
141
|
+
isLibrary = true
|
142
|
+
end
|
143
|
+
pindo_ios_project_dir = File.join(pindo_project_dir, "GoodPlatform/iOS")
|
144
|
+
if isLibrary
|
145
|
+
pindo_ios_project_dir = ios_export_lib_dir
|
146
|
+
end
|
147
|
+
unity_helper.build_project(unity_exe_full_path:unity_exe_path, project_path:pindo_project_dir, platform:'iOS', isLibrary:isLibrary)
|
148
|
+
|
149
|
+
|
150
|
+
args_temp = []
|
151
|
+
args_temp << "--bundleid=#{mainapp_bundleid}"
|
152
|
+
|
153
|
+
if @args_upload_flag
|
154
|
+
args_temp << "--proj=#{app_info_obj["appName"]}"
|
155
|
+
args_temp << "--upload"
|
156
|
+
end
|
157
|
+
|
158
|
+
Dir.chdir(pindo_ios_project_dir)
|
159
|
+
|
160
|
+
Pindo::Command::Ios::Autobuild::run(args_temp)
|
161
|
+
|
162
|
+
end
|
163
|
+
|
164
|
+
def and_autobuild(unity_helper:nil, unity_exe_path:nil)
|
165
|
+
|
166
|
+
pindo_project_dir = Dir.pwd
|
167
|
+
isLibrary = @args_base_flag
|
168
|
+
|
169
|
+
android_export_lib_dir = File.join(pindo_project_dir, "GoodPlatform/BaseAndroid")
|
170
|
+
if File.directory?(android_export_lib_dir)
|
171
|
+
isLibrary = true
|
172
|
+
end
|
173
|
+
|
174
|
+
pindo_android_project_dir = File.join(pindo_project_dir, "GoodPlatform/Android")
|
175
|
+
if isLibrary
|
176
|
+
pindo_android_project_dir = android_export_lib_dir
|
177
|
+
end
|
178
|
+
puts "开始构建Unity项目..."
|
179
|
+
|
180
|
+
unity_helper.build_project(
|
181
|
+
unity_exe_full_path: unity_exe_path,
|
182
|
+
project_path: pindo_project_dir,
|
183
|
+
platform: 'Android',
|
184
|
+
isLibrary: isLibrary
|
185
|
+
)
|
186
|
+
|
187
|
+
puts "Unity项目构建完成,准备处理Android项目..."
|
188
|
+
args_temp = []
|
189
|
+
|
190
|
+
if @args_upload_flag
|
191
|
+
args_temp << "--proj=#{app_info_obj["appName"]}"
|
192
|
+
args_temp << "--upload"
|
193
|
+
end
|
194
|
+
|
195
|
+
Dir.chdir(pindo_android_project_dir)
|
196
|
+
|
197
|
+
Pindo::Command::Android::Autobuild::run(args_temp)
|
198
|
+
|
199
|
+
end
|
200
|
+
|
201
|
+
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|