fastlane-plugin-zhuixi_build_app 0.2.0 → 1.0.1

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