parent
fc5bf86887
commit
1b69c9ca78
|
@ -26,6 +26,11 @@ namespace HybridCLR.Editor.Installer
|
||||||
|
|
||||||
public partial class InstallerController
|
public partial class InstallerController
|
||||||
{
|
{
|
||||||
|
private const string hybridclr_repo_path = "hybridclr_repo";
|
||||||
|
private const string hybridclr_url = "hybridclr";
|
||||||
|
private const string il2cpp_plus_repo_path = "il2cpp_plus_repo";
|
||||||
|
private const string il2cpp_plus_url = "il2cpp_plus";
|
||||||
|
|
||||||
private string m_Il2CppInstallDirectory;
|
private string m_Il2CppInstallDirectory;
|
||||||
|
|
||||||
public string Il2CppInstallDirectory
|
public string Il2CppInstallDirectory
|
||||||
|
@ -246,7 +251,7 @@ namespace HybridCLR.Editor.Installer
|
||||||
|
|
||||||
return InstallErrorCode.Ok;
|
return InstallErrorCode.Ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsUnity2019(string branch)
|
public bool IsUnity2019(string branch)
|
||||||
{
|
{
|
||||||
return branch.Contains("2019.");
|
return branch.Contains("2019.");
|
||||||
|
@ -295,14 +300,14 @@ namespace HybridCLR.Editor.Installer
|
||||||
BashUtil.CopyDir($"{SettingsUtil.HybridCLRDataPathInPackage}/iOSBuild", buildiOSDir, true);
|
BashUtil.CopyDir($"{SettingsUtil.HybridCLRDataPathInPackage}/iOSBuild", buildiOSDir, true);
|
||||||
|
|
||||||
// clone hybridclr
|
// clone hybridclr
|
||||||
string hybridclrRepoDir = $"{workDir}/hybridclr_repo";
|
string hybridclrRepoDir = $"{workDir}/{hybridclr_repo_path}";
|
||||||
{
|
{
|
||||||
BashUtil.RemoveDir(hybridclrRepoDir);
|
BashUtil.RemoveDir(hybridclrRepoDir);
|
||||||
var ret = BashUtil.RunCommand(workDir, "git", new string[]
|
var ret = BashUtil.RunCommand(workDir, "git", new string[]
|
||||||
{
|
{
|
||||||
"clone",
|
"clone",
|
||||||
"--depth=1",
|
"--depth=1",
|
||||||
GetRepoUrl("hybridclr"),
|
GetRepoUrl(hybridclr_url),
|
||||||
hybridclrRepoDir,
|
hybridclrRepoDir,
|
||||||
});
|
});
|
||||||
//if (ret != 0)
|
//if (ret != 0)
|
||||||
|
@ -312,7 +317,7 @@ namespace HybridCLR.Editor.Installer
|
||||||
}
|
}
|
||||||
|
|
||||||
// clone il2cpp_plus
|
// clone il2cpp_plus
|
||||||
string il2cppPlusRepoDir = $"{workDir}/il2cpp_plus_repo";
|
string il2cppPlusRepoDir = $"{workDir}/{il2cpp_plus_repo_path}";
|
||||||
{
|
{
|
||||||
BashUtil.RemoveDir(il2cppPlusRepoDir);
|
BashUtil.RemoveDir(il2cppPlusRepoDir);
|
||||||
var ret = BashUtil.RunCommand(workDir, "git", new string[]
|
var ret = BashUtil.RunCommand(workDir, "git", new string[]
|
||||||
|
@ -321,7 +326,7 @@ namespace HybridCLR.Editor.Installer
|
||||||
"--depth=1",
|
"--depth=1",
|
||||||
"-b",
|
"-b",
|
||||||
il2cppBranch,
|
il2cppBranch,
|
||||||
GetRepoUrl("il2cpp_plus"),
|
GetRepoUrl(il2cpp_plus_url),
|
||||||
il2cppPlusRepoDir,
|
il2cppPlusRepoDir,
|
||||||
});
|
});
|
||||||
//if (ret != 0)
|
//if (ret != 0)
|
||||||
|
|
|
@ -45,7 +45,13 @@ namespace HybridCLR.Editor.Installer
|
||||||
GUILayout.Space(10f);
|
GUILayout.Space(10f);
|
||||||
|
|
||||||
EditorGUILayout.BeginVertical("box");
|
EditorGUILayout.BeginVertical("box");
|
||||||
EditorGUILayout.LabelField($"安装状态:{(m_Controller.HasInstalledHybridCLR() ? "已安装" : "未安装")}", EditorStyles.boldLabel);
|
bool hasInstall = m_Controller.HasInstalledHybridCLR();
|
||||||
|
EditorGUILayout.LabelField($"安装状态:{(hasInstall ? "已安装" : "未安装")}", EditorStyles.boldLabel);
|
||||||
|
if (hasInstall)
|
||||||
|
{
|
||||||
|
GUIInstallButton("检查更新", "检查", UpdateHybridCLR);
|
||||||
|
}
|
||||||
|
|
||||||
GUILayout.Space(5f);
|
GUILayout.Space(5f);
|
||||||
EditorGUILayout.LabelField($"当前Unity版本: {Application.unityVersion},匹配的il2cpp_plus分支: {m_Controller.Il2CppBranch}");
|
EditorGUILayout.LabelField($"当前Unity版本: {Application.unityVersion},匹配的il2cpp_plus分支: {m_Controller.Il2CppBranch}");
|
||||||
GUISelectUnityDirectory($"il2cpp_plus分支对应的Unity兼容版本的il2cpp路径", "Select");
|
GUISelectUnityDirectory($"il2cpp_plus分支对应的Unity兼容版本的il2cpp路径", "Select");
|
||||||
|
@ -120,5 +126,22 @@ namespace HybridCLR.Editor.Installer
|
||||||
{
|
{
|
||||||
m_Controller.InitHybridCLR(m_Controller.Il2CppBranch, m_Controller.Il2CppInstallDirectory);
|
m_Controller.InitHybridCLR(m_Controller.Il2CppBranch, m_Controller.Il2CppInstallDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateHybridCLR()
|
||||||
|
{
|
||||||
|
bool hasUpdateIl2Cpp = m_Controller.HasUpdateIl2Cpp(m_Controller.Il2CppBranch);
|
||||||
|
if (hasUpdateIl2Cpp)
|
||||||
|
{
|
||||||
|
bool ret = EditorUtility.DisplayDialog("检查更新", "版本不一致", "更新","取消");
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
InitHybridCLR();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EditorUtility.DisplayDialog("检查更新", "暂无更新", "确定");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
namespace HybridCLR.Editor.Installer
|
||||||
|
{
|
||||||
|
public partial class InstallerController
|
||||||
|
{
|
||||||
|
public bool HasUpdateIl2Cpp(string il2cppBranch)
|
||||||
|
{
|
||||||
|
string workDir = SettingsUtil.HybridCLRDataDir;
|
||||||
|
// last hash hybridclr
|
||||||
|
string hybridclrRepoDir = $"{workDir}/{hybridclr_repo_path}";
|
||||||
|
{
|
||||||
|
var ret1 = BashUtil.RunCommand2(hybridclrRepoDir, "git",
|
||||||
|
new string[] { "log", "HEAD", "-n", "1", "--pretty=format:\"%H\"", });
|
||||||
|
var ret2 = BashUtil.RunCommand2(hybridclrRepoDir, "git",
|
||||||
|
new string[] { "log", "remotes/origin/HEAD", "-n", "1", "--pretty=format:\"%H\"", });
|
||||||
|
if (ret1.StdOut != ret2.StdOut)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// last hash il2cpp_plus
|
||||||
|
string il2cppPlusRepoDir = $"{workDir}/{il2cpp_plus_repo_path}";
|
||||||
|
{
|
||||||
|
var ret1 = BashUtil.RunCommand2(il2cppPlusRepoDir, "git",
|
||||||
|
new string[] { "log", $"{il2cppBranch}", "-n", "1", "--pretty=format:\"%H\"", });
|
||||||
|
var ret2 = BashUtil.RunCommand2(il2cppPlusRepoDir, "git",
|
||||||
|
new string[] { "log", $"remotes/origin/{il2cppBranch}", "-n", "1", "--pretty=format:\"%H\"", });
|
||||||
|
if (ret1.StdOut != ret2.StdOut)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 91454a4f0a354d11830642b4d4474d7e
|
||||||
|
timeCreated: 1665546286
|
Loading…
Reference in New Issue