【热更工具】优化IOS更新卡死的问题

dev_chengFeng
JLIOSM1 2021-08-21 18:51:32 +08:00 committed by gaoxin
parent 6f108e2f5c
commit 4756f15a93
2 changed files with 46 additions and 31 deletions

View File

@ -330,15 +330,21 @@ namespace GameEditor.FrameTool
log.Add("CDN TYPE: " + cdnType);
string toolsDir = HotfixWindow._HotFixProjectPath + "/Tools/" + cdnType;
log.Add("TOOLS DIR: " + toolsDir);
string command = string.Format("python UpLoad.py {0} {1} {2}>>{3}", HotfixWindow._HotFixProjectPath + "/Root/" + dir_name, dir_cdn_setting, changeFileName, logPath + logName + ".log");
// MAC机器上pathon脚本中使用多线程会导致unity卡死
int isThread = 1;
#if UNITY_IOS
isThread = 0;
#endif
string command = string.Format("python UpLoad.py {0} {1} {2} {3} >>{4}", HotfixWindow._HotFixProjectPath + "/Root/" + dir_name, dir_cdn_setting, changeFileName, isThread, logPath + logName + ".log");
log.Add("UPLOAD COMMAND: " + command);
ProcessUtil.ProcessCommand(toolsDir, command);
string flushCommand = string.Format("python Flush.py {0}>>{1}", cdn_version.resUrl, logPath + logName + ".log");
string flushCommand = string.Format("python Flush.py {0} >>{1}", cdn_version.resUrl, logPath + logName + ".log");
log.Add("Flush COMMAND: " + flushCommand);
ProcessUtil.ProcessCommand(toolsDir, flushCommand);
// write log
EditorUtility.DisplayProgressBar("正在生成Log文件", logName, 1f);
HotFixTool.WriteLog(logPath, logName, log.ToArray());
string unityLog = changeFileName + "_Unity";
EditorUtility.DisplayProgressBar("正在生成Log文件", unityLog, 1f);
HotFixTool.WriteLog(logPath, unityLog, log.ToArray());
// git commit
string commitName = desc + "更新:" + updateName;
EditorUtility.DisplayProgressBar("正在提交到GIT", commitName, 1f);
@ -691,10 +697,15 @@ namespace GameEditor.FrameTool
log.Add("CDN TYPE: "+ info["cdn_type"]);
string toolsDir = _HotFixProjectPath + "/Tools/" + info["cdn_type"];
log.Add("TOOLS DIR: " + toolsDir);
string command = string.Format("python UpLoad.py {0} {1} {2}>>{3}", _HotFixProjectPath + "/Root/" + hfs.dir_name, hfs.dir_cdn_setting, changeFileName, hfs.path_cdn_setting + "__HotFixLog/" + logName + ".log");
// MAC机器上pathon脚本中使用多线程会导致unity卡死
int isThread = 1;
#if UNITY_IOS
isThread = 0;
#endif
string command = string.Format("python UpLoad.py {0} {1} {2} {3} >>{4}", _HotFixProjectPath + "/Root/" + hfs.dir_name, hfs.dir_cdn_setting, changeFileName, isThread, hfs.path_cdn_setting + "__HotFixLog/" + logName + ".log");
log.Add("UPLOAD COMMAND: " + command);
ProcessUtil.ProcessCommand(toolsDir, command);
string flushCommand = string.Format("python Flush.py {0}>>{1}", hfs.cdn_version.resUrl, hfs.path_cdn_setting + "__HotFixLog/" + logName + ".log");
string flushCommand = string.Format("python Flush.py {0} >>{1}", hfs.cdn_version.resUrl, hfs.path_cdn_setting + "__HotFixLog/" + logName + ".log");
log.Add("Flush COMMAND: " + flushCommand);
ProcessUtil.ProcessCommand(toolsDir, flushCommand);
// write log

View File

@ -56,37 +56,41 @@ namespace GameEditor.Util
public static void ProcessCommand(string dir, string[] coms, bool isShowWindow = false)
{
#if UNITY_IOS
string shellPath = Path.Combine(dir, "coms.shell");
string shellPath = Path.Combine(dir, "coms.sh");
if (!File.Exists(shellPath))
{
File.Create(shellPath).Close();
}
File.WriteAllLines(shellPath, coms);
System.Diagnostics.Process p = new System.Diagnostics.Process();
//设置要启动的应用程序
p.StartInfo.FileName = "/bin/bash";
//是否使用操作系统shell启动
p.StartInfo.UseShellExecute = false;
//接受来自调用程序的输入信息
p.StartInfo.RedirectStandardInput = false;
//输出信息
p.StartInfo.RedirectStandardOutput = false;
//输出错误
p.StartInfo.RedirectStandardError = false;
//不显示程序窗口
p.StartInfo.CreateNoWindow = !isShowWindow;
//设置文件夹
p.StartInfo.WorkingDirectory = dir;
p.StartInfo.Arguments = shellPath;
//启动程序
p.Start();
//等待程序执行完退出进程
p.WaitForExit();
//关闭
p.Close();
//删除命令行文件
File.Delete(shellPath);
using(System.Diagnostics.Process p = new System.Diagnostics.Process())
{
//设置要启动的应用程序
p.StartInfo.FileName = "/bin/zsh";
//是否使用操作系统shell启动
p.StartInfo.UseShellExecute = false;
//接受来自调用程序的输入信息
p.StartInfo.RedirectStandardInput = false;
//输出信息
p.StartInfo.RedirectStandardOutput = false;
//输出错误
p.StartInfo.RedirectStandardError = false;
//不显示程序窗口
p.StartInfo.CreateNoWindow = !isShowWindow;
//设置文件夹
p.StartInfo.WorkingDirectory = dir;
p.StartInfo.Arguments = shellPath;
//启动程序
p.Start();
//等待程序执行完退出进程
p.WaitForExit();
//关闭
p.Close();
//删除命令行文件
File.Delete(shellPath);
}
#else
System.Diagnostics.Process p = new System.Diagnostics.Process();
//设置要启动的应用程序