fastlane-plugin-zhuixi_build_app 0.2.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/zhuixi_build_app/actions/download_resources_action.rb +45 -0
- data/lib/fastlane/plugin/zhuixi_build_app/actions/get_game_list_action.rb +56 -0
- data/lib/fastlane/plugin/zhuixi_build_app/actions/get_pack_config_action.rb +47 -0
- data/lib/fastlane/plugin/zhuixi_build_app/actions/login_action.rb +5 -3
- data/lib/fastlane/plugin/zhuixi_build_app/actions/read_config_action.rb +3 -3
- data/lib/fastlane/plugin/zhuixi_build_app/actions/xcodeproj_merge_action.rb +319 -0
- data/lib/fastlane/plugin/zhuixi_build_app/actions/zhuixi_build_app_action.rb +5 -2
- data/lib/fastlane/plugin/zhuixi_build_app/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df9d6d1e29048019bfb8c723657d38c8efa848990fef6306e77c0b14728809ac
|
4
|
+
data.tar.gz: 46141d7e25e32f5308d0bb15552a2e46a072476407532dd3825c0a95913e0dd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c0bfb09951916cd8ba375832330d50c9f678bc64fb7da98ef7625e76f5b6f6d6e3dc0d74f41995595a969f950e61fd099bb1e37a3c00d664f6b34db29e39d02
|
7
|
+
data.tar.gz: 04bc9c75cbe01ce1a883b0d46c1bb4255ce75c8f6e16f58de31b507cb7a6e23ff884bd2e4b2cbcba10d86243eb5c97fc0cd966d5ba82d30633a5378f705252fb
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class DownloadResourcesAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
#下载渠道资源
|
6
|
+
download_resource(params[:resourcesUrl])
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.download_resource(resourcesUrl)
|
10
|
+
|
11
|
+
#创建zhuixi
|
12
|
+
parent_path = File.dirname(lane_context[:ori_xcodeproj_path])
|
13
|
+
lane_context[:zhuixi_path] = File.join(parent_path, "zhuixi", lane_context[:platform_id].to_s)
|
14
|
+
|
15
|
+
if File.exist?(lane_context[:zhuixi_path].to_s)
|
16
|
+
FileUtils.rm_rf(lane_context[:zhuixi_path])
|
17
|
+
end
|
18
|
+
FileUtils.mkdir_p(lane_context[:zhuixi_path])
|
19
|
+
|
20
|
+
# 下载资源包到root_folder下
|
21
|
+
destination_path = File.join(parent_path, "resource.zip")
|
22
|
+
File.open(destination_path, "wb") do |file|
|
23
|
+
file.write URI.open(resourcesUrl).read
|
24
|
+
end
|
25
|
+
|
26
|
+
# # 解压资源包到zhuixi_path里
|
27
|
+
Fastlane::Actions.sh("unzip #{File.join(parent_path, "resource.zip")} -d #{lane_context[:zhuixi_path]}")
|
28
|
+
# 删除__MACOSX目录及其子目录
|
29
|
+
Fastlane::Actions.sh("rm -rf #{File.join(lane_context[:zhuixi_path], "__MACOSX")}")
|
30
|
+
FileUtils.rm_rf(destination_path)
|
31
|
+
UI.message("ZHUIXI---下载资源成功!")
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.available_options
|
35
|
+
[
|
36
|
+
FastlaneCore::ConfigItem.new(key: :resourcesUrl,
|
37
|
+
env_name: "ZHUIXI_BUILD_APP_YOUR_OPTION",
|
38
|
+
description: "GetPackConfigAction",
|
39
|
+
optional: false,
|
40
|
+
type: String),
|
41
|
+
]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class GetGameListAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
# 获取游戏列表并解析渠道信息
|
6
|
+
game_id = get_game_list_and_parse_channel_info(params[:user_info][:user_id], params[:user_info][:token], "2", params[:user_info][:platform_id])
|
7
|
+
return game_id
|
8
|
+
end
|
9
|
+
def self.available_options
|
10
|
+
[
|
11
|
+
FastlaneCore::ConfigItem.new(key: :user_info,
|
12
|
+
env_name: "ZHUIXI_BUILD_APP_YOUR_OPTION",
|
13
|
+
description: "GetGameListAction",
|
14
|
+
optional: false,
|
15
|
+
type: Hash),
|
16
|
+
]
|
17
|
+
end
|
18
|
+
|
19
|
+
# 获取游戏列表并解析渠道信息
|
20
|
+
def self.get_game_list_and_parse_channel_info(user_id, token, packet_os, platform_id)
|
21
|
+
uri = URI.parse("http://xg.yutennet.com/issuesy/pack/get_game_lists")
|
22
|
+
request = Net::HTTP::Post.new(uri)
|
23
|
+
request.content_type = "application/json"
|
24
|
+
request.body = JSON.dump({
|
25
|
+
"user_id" => user_id,
|
26
|
+
"token" => token,
|
27
|
+
"packet_os" => packet_os,
|
28
|
+
"platform_id" => platform_id,
|
29
|
+
})
|
30
|
+
|
31
|
+
response = Net::HTTP.start(uri.hostname, uri.port) do |http|
|
32
|
+
http.request(request)
|
33
|
+
end
|
34
|
+
|
35
|
+
if response.code == "200"
|
36
|
+
result = JSON.parse(response.body)
|
37
|
+
if result["code"] == 200
|
38
|
+
data = result["data"]
|
39
|
+
games = data["game_lists"]
|
40
|
+
for game in games
|
41
|
+
game_name = game["game_name"]
|
42
|
+
if lane_context[:selectGameName] == game_name
|
43
|
+
gameId = game["game_id"]
|
44
|
+
return gameId
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
else
|
49
|
+
puts "获取游戏列表失败:HTTP #{response.code}"
|
50
|
+
end
|
51
|
+
|
52
|
+
return {}
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class GetPackConfigAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
get_pack_config(params[:game_id])
|
6
|
+
end
|
7
|
+
|
8
|
+
# 获取打包配置数据
|
9
|
+
def self.get_pack_config(game_id)
|
10
|
+
uri = URI.parse("http://xg.yutennet.com/issuesy/pack/doPack")
|
11
|
+
request = Net::HTTP::Post.new(uri)
|
12
|
+
request.content_type = "application/json"
|
13
|
+
request.body = JSON.dump({
|
14
|
+
"user_id" => lane_context[:user_id],
|
15
|
+
"token" => lane_context[:token],
|
16
|
+
"packet_os" => "2",
|
17
|
+
"platform_id" => lane_context[:platform_id],
|
18
|
+
"game_id" => game_id,
|
19
|
+
})
|
20
|
+
|
21
|
+
response = Net::HTTP.start(uri.hostname, uri.port) do |http|
|
22
|
+
http.request(request)
|
23
|
+
end
|
24
|
+
|
25
|
+
if response.code == "200"
|
26
|
+
result = JSON.parse(response.body)
|
27
|
+
if result["code"] == 200
|
28
|
+
data = result["data"]
|
29
|
+
lane_context[:configParams] = data["config"]
|
30
|
+
resourcesUrl = data["resources_url"]
|
31
|
+
return resourcesUrl.to_s
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.available_options
|
37
|
+
[
|
38
|
+
FastlaneCore::ConfigItem.new(key: :game_id,
|
39
|
+
env_name: "ZHUIXI_BUILD_APP_YOUR_OPTION",
|
40
|
+
description: "GetPackConfigAction",
|
41
|
+
optional: false,
|
42
|
+
type: String),
|
43
|
+
]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -24,12 +24,14 @@ module Fastlane
|
|
24
24
|
if result["code"] == 200
|
25
25
|
user_id = result["data"]["user_id"]
|
26
26
|
token = result["data"]["token"]
|
27
|
+
lane_context[:user_id] = user_id
|
28
|
+
lane_context[:token] = token
|
27
29
|
platforms = result["data"]["platform_lists"]
|
28
30
|
puts "ZHUIXI---登陆成功!platform:\n" + platforms.to_s
|
29
31
|
for platform in platforms
|
30
|
-
if
|
31
|
-
|
32
|
-
return user_id, token,
|
32
|
+
if lane_context[:selectPlatformName] == platform["platform_name"]
|
33
|
+
lane_context[:platform_id] = platform["platform_id"]
|
34
|
+
return { user_id: user_id, token: token, platform_id: lane_context[:platform_id] }
|
33
35
|
end
|
34
36
|
end
|
35
37
|
else
|
@@ -9,9 +9,9 @@ module Fastlane
|
|
9
9
|
# game_id = app_file_config[:game_id]
|
10
10
|
account = app_file_config[:account]
|
11
11
|
password = app_file_config[:password]
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
lane_context[:selectGameName] = app_file_config[:selectGameName]
|
13
|
+
lane_context[:selectPlatformName] = app_file_config[:platform]
|
14
|
+
lane_context[:ori_xcodeproj_path] = app_file_config[:ori_xcodeproj_path]
|
15
15
|
UI.message("ZHUIXI---读取配置成功!app_file_path:\n#{app_file_path}")
|
16
16
|
# 返回 account 和 password
|
17
17
|
return { account: account, password: password }
|
@@ -0,0 +1,319 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class XcodeprojMergeAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
xcodeproj_merge()
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.xcodeproj_merge()
|
9
|
+
createProjectFiles()
|
10
|
+
lane_context[:project] = Xcodeproj::Project.open(lane_context[:cha_project_path])
|
11
|
+
lane_context[:target] = lane_context[:project].targets.first
|
12
|
+
lane_context[:group] = lane_context[:project].main_group.find_subpath(File.join("zhuixi"), true)
|
13
|
+
lane_context[:group].set_source_tree("SOURCE_ROOT") # 把group的source_tree设置成 'SOURCE_ROOT'
|
14
|
+
getDesgroup(lane_context[:project].main_group)
|
15
|
+
FileUtils.rm_rf(Dir.glob(File.join(lane_context[:cha_resources_path], "*")))
|
16
|
+
add_channel_sdk_resources()
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.createProjectFiles
|
20
|
+
initData()
|
21
|
+
if (File::exist?(lane_context[:cha_project_path]))
|
22
|
+
# FileUtils.remove_dir(destFile, force = false)
|
23
|
+
FileUtils.remove_dir(lane_context[:cha_project_path], force = true)
|
24
|
+
puts "渠道xcodeproj删除成功" + lane_context[:cha_project_path]
|
25
|
+
# FileUtils.rm_rf(lane_context[:cha_project_path], :secure=>true)
|
26
|
+
end
|
27
|
+
|
28
|
+
Dir::mkdir(lane_context[:cha_project_path], mode = 0777)
|
29
|
+
Dir.glob(File.join(lane_context[:ori_xcodeproj_path], "*")) do |file|
|
30
|
+
unless File.basename(file) == "xcshareddata"
|
31
|
+
dest = File.join(lane_context[:cha_project_path], File.basename(file))
|
32
|
+
FileUtils.cp_r(file, dest)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
# FileUtils.cp(@ori_pbxproj_path, lane_context[:cha_project_path])
|
36
|
+
# FileUtils.cp_r(@ori_workspace_path, @cha_workspace_path)
|
37
|
+
|
38
|
+
# FileUtils.cp_r(@ori_scheme_dir, lane_context[:cha_project_path])
|
39
|
+
|
40
|
+
unless File::exist?(lane_context[:cha_project_path])
|
41
|
+
puts "渠道创建失败"
|
42
|
+
return
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.initData()
|
47
|
+
ori_xcodeproj_dir = File::dirname(lane_context[:ori_xcodeproj_path])
|
48
|
+
ori_project_name_pre = File.basename(lane_context[:ori_xcodeproj_path], ".xcodeproj")
|
49
|
+
cha_project_name = ori_project_name_pre + "_" + lane_context[:platform_id].to_s + ".xcodeproj"
|
50
|
+
lane_context[:cha_project_path] = File.join(ori_xcodeproj_dir, cha_project_name)
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.removeBuildPhaseFilesRecursively(aGroup)
|
54
|
+
aGroup.files.each do |file|
|
55
|
+
if file.real_path.to_s.end_with?(".m", ".mm")
|
56
|
+
lane_context[:target].source_build_phase.remove_file_reference(file)
|
57
|
+
elsif file.real_path.to_s.end_with?(".h")
|
58
|
+
lane_context[:target].headers_build_phase.remove_file_reference(file)
|
59
|
+
elsif file.real_path.to_s.end_with?(".plist", ".bundle", ".txt")
|
60
|
+
lane_context[:target].resources_build_phase.remove_file_reference(file)
|
61
|
+
elsif file.real_path.to_s.end_with?(".framework", ".a")
|
62
|
+
lane_context[:target].frameworks_build_phase.remove_file_reference(file)
|
63
|
+
lane_context[:target].copy_files_build_phases.each do |item|
|
64
|
+
if item.name == "Embed Frameworks"
|
65
|
+
item.remove_file_reference(file)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
aGroup.groups.each do |group|
|
71
|
+
removeBuildPhaseFilesRecursively(group)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.getDesgroup(resGroup)
|
76
|
+
resGroup.groups.each do |group|
|
77
|
+
if group.display_name == "resources"
|
78
|
+
lane_context[:cha_resources_path] = group.real_path
|
79
|
+
removeBuildPhaseFilesRecursively(group)
|
80
|
+
group.clear
|
81
|
+
else
|
82
|
+
getDesgroup(group)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.add_channel_sdk_resources()
|
88
|
+
|
89
|
+
# 获取 Info.plist 文件的 Build Setting
|
90
|
+
info_plist_build_setting = lane_context[:target].build_configuration_list.get_setting("INFOPLIST_FILE")
|
91
|
+
|
92
|
+
info_plist_path = info_plist_build_setting["Release"]
|
93
|
+
|
94
|
+
info_plist_absolute_path = File.expand_path(info_plist_path, File.dirname(lane_context[:cha_project_path]))
|
95
|
+
|
96
|
+
# 复制 Info.plist 文件到指定目录
|
97
|
+
FileUtils.cp(info_plist_absolute_path, File.join(lane_context[:zhuixi_path], "Info.plist"))
|
98
|
+
|
99
|
+
# 2. 读取 info.plist 文件
|
100
|
+
info_plist_data = Plist.parse_xml(info_plist_absolute_path)
|
101
|
+
|
102
|
+
# 如果 info_plist_data 没有 LSApplicationQueriesSchemes 配置,先创建一个空数组
|
103
|
+
info_plist_data["LSApplicationQueriesSchemes"] ||= []
|
104
|
+
|
105
|
+
# 3. 读取 TempInfo.plist 文件
|
106
|
+
temp_info_plist_data = Plist.parse_xml(File.join(lane_context[:zhuixi_path], "TempInfo.plist"))
|
107
|
+
|
108
|
+
# 添加 TempInfo.plist 中不存在的 LSApplicationQueriesSchemes 配置到 info.plist 文件
|
109
|
+
temp_info_plist_data["LSApplicationQueriesSchemes"].each do |scheme|
|
110
|
+
info_plist_data["LSApplicationQueriesSchemes"] << scheme unless info_plist_data["LSApplicationQueriesSchemes"].include?(scheme)
|
111
|
+
end
|
112
|
+
|
113
|
+
# 5. 写入 info.plist 文件
|
114
|
+
File.write(info_plist_absolute_path, info_plist_data.to_plist)
|
115
|
+
|
116
|
+
config_info_plist_data = Plist.parse_xml(File.join(lane_context[:zhuixi_path], "ConfigInfo.plist"))
|
117
|
+
|
118
|
+
system_frameworks = config_info_plist_data["systemFrameworks"]
|
119
|
+
system_libraries = config_info_plist_data["systemLibraries"]
|
120
|
+
|
121
|
+
# Add the system frameworks to the Xcode project
|
122
|
+
unless system_frameworks.nil? || system_frameworks.empty?
|
123
|
+
frameworks_group = lane_context[:project].frameworks_group # Find or create the "Frameworks" group
|
124
|
+
system_frameworks.each do |framework|
|
125
|
+
framework_path = "Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/#{framework}"
|
126
|
+
unless ref = frameworks_group.find_file_by_path(framework_path)
|
127
|
+
ref = frameworks_group.new_file(framework_path, :developer_dir)
|
128
|
+
end
|
129
|
+
unless lane_context[:target].frameworks_build_phase.include?(ref)
|
130
|
+
lane_context[:target].frameworks_build_phase.add_file_reference(ref, true)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
# Add the system libraries to the Xcode project
|
136
|
+
unless system_libraries.nil? || system_libraries.empty?
|
137
|
+
libraries_group = lane_context[:project].frameworks_group
|
138
|
+
system_libraries.each do |library|
|
139
|
+
libraries_path = "Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/#{library}"
|
140
|
+
unless ref = libraries_group.files.find { |ref| ref.path == path }
|
141
|
+
ref = libraries_group.new_file(libraries_path, :developer_dir)
|
142
|
+
end
|
143
|
+
unless lane_context[:target].frameworks_build_phase.include? (ref)
|
144
|
+
lane_context[:target].frameworks_build_phase.add_file_reference(ref, true)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
#设置渠道工程的info路径
|
149
|
+
lane_context[:target].build_configuration_list.build_configurations.each do |config|
|
150
|
+
config.build_settings["INFOPLIST_FILE"] = File.join(lane_context[:zhuixi_path], "Info.plist")
|
151
|
+
end
|
152
|
+
|
153
|
+
add_channel_sdk_library()
|
154
|
+
end
|
155
|
+
# 是否在动态库集合
|
156
|
+
def self.isEmbedFramework(filename, setting)
|
157
|
+
embedArc = ["boRanSDK.framework", "NyBugly.framework", "XHYSDK.framework"]
|
158
|
+
|
159
|
+
if !setting
|
160
|
+
temp_name = filename.to_s
|
161
|
+
else
|
162
|
+
temp_name = filename.display_name
|
163
|
+
end
|
164
|
+
if !setting and temp_name.end_with?(embedArc[0], embedArc[1], embedArc[2])
|
165
|
+
return true
|
166
|
+
elsif setting and embedArc.include?(temp_name)
|
167
|
+
return true
|
168
|
+
else
|
169
|
+
return false
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
def self.add_channel_sdk_library()
|
174
|
+
channel_resources_folder = File.join(lane_context[:zhuixi_path], "resources")
|
175
|
+
# 获取需要的通道build settings
|
176
|
+
search_paths = lane_context[:target].build_configuration_list.get_setting("FRAMEWORK_SEARCH_PATHS")
|
177
|
+
library_search_paths = lane_context[:target].build_configuration_list.get_setting("LIBRARY_SEARCH_PATHS")
|
178
|
+
|
179
|
+
merge_nygameinfo()
|
180
|
+
getAllRes(channel_resources_folder)
|
181
|
+
|
182
|
+
build_app_action()
|
183
|
+
end
|
184
|
+
# 查询所有文件
|
185
|
+
def self.getAllRes(rootDir)
|
186
|
+
isfile = rootDir.to_s.end_with?(".framework", ".bundle")
|
187
|
+
if File.directory?(rootDir) and !isfile
|
188
|
+
Dir.foreach(rootDir) do |filepath|
|
189
|
+
if filepath != "." and filepath != ".." and filepath != ".DS_Store"
|
190
|
+
getAllRes(rootDir + "/" + filepath)
|
191
|
+
end
|
192
|
+
end
|
193
|
+
else
|
194
|
+
addFileToTarget(rootDir)
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
def self.addFileToTarget(filename)
|
199
|
+
if filename != "." and filename != ".." and filename != ".DS_Store"
|
200
|
+
# puts filename
|
201
|
+
file_ref = lane_context[:group].new_reference(filename)
|
202
|
+
|
203
|
+
if filename.to_s.end_with?("pbobjc.m", "pbobjc.mm")
|
204
|
+
lane_context[:target].add_file_references(file_ref, "-fno-objc-arc")
|
205
|
+
elsif filename.to_s.end_with?(".framework", ".a")
|
206
|
+
lib_real_path = File::dirname(filename)
|
207
|
+
|
208
|
+
if filename.to_s.end_with?(".framework") and !"".eql? lib_real_path
|
209
|
+
config_list_fra = lane_context[:target].build_configuration_list.get_setting("FRAMEWORK_SEARCH_PATHS")
|
210
|
+
old_fra_list = config_list_fra["Release"]
|
211
|
+
if !old_fra_list || "$(inherited)".eql?(old_fra_list)
|
212
|
+
old_fra_list = []
|
213
|
+
old_fra_list.push("$(inherited)")
|
214
|
+
end
|
215
|
+
old_fra_list.push(lib_real_path)
|
216
|
+
lane_context[:target].build_configuration_list.set_setting("FRAMEWORK_SEARCH_PATHS", old_fra_list)
|
217
|
+
end
|
218
|
+
|
219
|
+
if filename.to_s.end_with?(".a") and !"".eql? lib_real_path
|
220
|
+
config_list_lib = lane_context[:target].build_configuration_list.get_setting("LIBRARY_SEARCH_PATHS")
|
221
|
+
old_lib_list = config_list_lib["Release"]
|
222
|
+
if !old_lib_list || "$(inherited)".eql?(old_lib_list)
|
223
|
+
old_lib_list = []
|
224
|
+
old_lib_list.push("$(inherited)")
|
225
|
+
end
|
226
|
+
old_lib_list.push(lib_real_path)
|
227
|
+
lane_context[:target].build_configuration_list.set_setting("LIBRARY_SEARCH_PATHS", old_lib_list)
|
228
|
+
end
|
229
|
+
#项目中可能有多个copy files build phases,找到刚刚创建的那个,然后把xx.framework引入
|
230
|
+
|
231
|
+
if !"".eql? lib_real_path and isEmbedFramework(filename, false)
|
232
|
+
lane_context[:target].copy_files_build_phases.each do |item|
|
233
|
+
if item.name == "Embed Frameworks"
|
234
|
+
#引入xx.framework
|
235
|
+
item.add_file_reference(file_ref)
|
236
|
+
#设置copy file buldphase中的Destination选项,使用枚举值表示的。"10"表示Frameworks
|
237
|
+
#这个值我是通过对比设置前后的两个文件找出来的
|
238
|
+
item.dst_subfolder_spec = "10"
|
239
|
+
#勾上code sign on copy选项(默认是没勾上的)
|
240
|
+
item.files.each do |e|
|
241
|
+
if isEmbedFramework(e, true)
|
242
|
+
e.settings = Hash.new
|
243
|
+
e.settings["ATTRIBUTES"] = ["CodeSignOnCopy", "RemoveHeadersOnCopy"]
|
244
|
+
end
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
249
|
+
lane_context[:target].frameworks_build_phase.add_file_reference(file_ref, true)
|
250
|
+
elsif filename.to_s.end_with?(".plist", ".bundle")
|
251
|
+
lane_context[:target].resources_build_phase.add_file_reference(file_ref, true)
|
252
|
+
elsif filename.to_s.end_with?(".m", ".mm", ".cpp")
|
253
|
+
lane_context[:target].source_build_phase.add_file_reference(file_ref, true)
|
254
|
+
# elsif (!filename.to_s.end_with?(".h"))
|
255
|
+
# lane_context[:target].add_resources([file_ref])
|
256
|
+
end
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
def self.merge_nygameinfo()
|
261
|
+
channel_resources_folder = File.join(lane_context[:zhuixi_path], "resources")
|
262
|
+
filepath = File.join(channel_resources_folder, "nygameinfo.plist")
|
263
|
+
|
264
|
+
puts lane_context[:configParams]
|
265
|
+
other_action.update_plist(
|
266
|
+
plist_path: filepath,
|
267
|
+
block: proc do |plist|
|
268
|
+
if plist[:requestURL.to_s]
|
269
|
+
plist.delete(:requestURL.to_s)
|
270
|
+
end
|
271
|
+
lane_context[:configParams].each do |key, value|
|
272
|
+
case key
|
273
|
+
when :gamename.to_s
|
274
|
+
plist[:game_name.to_s] = value.to_s
|
275
|
+
when :gameappid.to_s
|
276
|
+
plist[:game_appid.to_s] = value.to_s
|
277
|
+
when :gameid.to_s
|
278
|
+
plist["game_id"] = value.to_s
|
279
|
+
when :gameurl.to_s
|
280
|
+
plist[:ff_url.to_s] = value.to_s
|
281
|
+
else
|
282
|
+
plist[key] = value.to_s
|
283
|
+
end
|
284
|
+
end
|
285
|
+
end,
|
286
|
+
)
|
287
|
+
end
|
288
|
+
|
289
|
+
def self.build_app_action()
|
290
|
+
other_action.recreate_schemes(project: lane_context[:cha_project_path])
|
291
|
+
schemefile = ""
|
292
|
+
Find.find(File.join(lane_context[:cha_project_path], "xcuserdata")) do |schemefilepath|
|
293
|
+
if schemefilepath.include? ".xcscheme"
|
294
|
+
new_schemefilepath = File.join(File.dirname(schemefilepath), File.basename(schemefilepath, ".xcscheme") + "_" + lane_context[:platform_id].to_s + ".xcscheme")
|
295
|
+
File.rename(schemefilepath, new_schemefilepath)
|
296
|
+
schemefile = File.basename(new_schemefilepath, ".xcscheme")
|
297
|
+
end
|
298
|
+
end
|
299
|
+
lane_context[:project].save()
|
300
|
+
# Find.find(File.join(lane_context[:cha_project_path], "xcuserdata")) do |schemefilepath|
|
301
|
+
# if schemefilepath.include? ".xcscheme"
|
302
|
+
# schemefile = schemefilepath
|
303
|
+
# end
|
304
|
+
# end
|
305
|
+
|
306
|
+
# 执行 fastlane gym
|
307
|
+
puts lane_context[:configParams]
|
308
|
+
timestamp = Time.now.strftime("%Y%m%d%H%M%S")
|
309
|
+
output_name = lane_context[:configParams]["gamename"] + "_" + lane_context[:platform_id].to_s + "_" + lane_context[:selectPlatformName] + "_" + timestamp
|
310
|
+
other_action.gym(
|
311
|
+
project: lane_context[:cha_project_path],
|
312
|
+
silent: true,
|
313
|
+
output_name: output_name,
|
314
|
+
include_symbols: false,
|
315
|
+
)
|
316
|
+
end
|
317
|
+
end
|
318
|
+
end
|
319
|
+
end
|
@@ -8,9 +8,12 @@ module Fastlane
|
|
8
8
|
config = other_action.read_config(
|
9
9
|
app_file_path: params[:app_file_path],
|
10
10
|
)
|
11
|
-
other_action.login(credentials: config)
|
11
|
+
user_info = other_action.login(credentials: config)
|
12
|
+
game_id = other_action.get_game_list(user_info: user_info)
|
13
|
+
resourcesUrl = other_action.get_pack_config(game_id: game_id.to_s)
|
14
|
+
other_action.download_resources(resourcesUrl: resourcesUrl)
|
15
|
+
other_action.xcodeproj_merge
|
12
16
|
end
|
13
|
-
|
14
17
|
def self.return_value
|
15
18
|
# If your method provides a return value, you can describe here what it does
|
16
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-zhuixi_build_app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RedSevenMale
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -159,8 +159,12 @@ files:
|
|
159
159
|
- LICENSE
|
160
160
|
- README.md
|
161
161
|
- lib/fastlane/plugin/zhuixi_build_app.rb
|
162
|
+
- lib/fastlane/plugin/zhuixi_build_app/actions/download_resources_action.rb
|
163
|
+
- lib/fastlane/plugin/zhuixi_build_app/actions/get_game_list_action.rb
|
164
|
+
- lib/fastlane/plugin/zhuixi_build_app/actions/get_pack_config_action.rb
|
162
165
|
- lib/fastlane/plugin/zhuixi_build_app/actions/login_action.rb
|
163
166
|
- lib/fastlane/plugin/zhuixi_build_app/actions/read_config_action.rb
|
167
|
+
- lib/fastlane/plugin/zhuixi_build_app/actions/xcodeproj_merge_action.rb
|
164
168
|
- lib/fastlane/plugin/zhuixi_build_app/actions/zhuixi_build_app_action.rb
|
165
169
|
- lib/fastlane/plugin/zhuixi_build_app/helper/zhuixi_build_app_helper.rb
|
166
170
|
- lib/fastlane/plugin/zhuixi_build_app/version.rb
|