Compare commits

...

4 Commits

Author SHA1 Message Date
walon 521db6e38c [new] 创建1.0.0版本 2022-11-28 11:11:28 +08:00
walon c85adbe65b [refactor] UNITY_VERSION 相关定义从 Il2CppCompatibleDef.h 移到 il2cpp-config.h 2022-11-24 12:09:04 +08:00
walon b9ea9b21f3 [fix] 修复扫描Plugin assembly时未忽略~结尾的目录的bug 2022-11-18 19:38:21 +08:00
walon 429845bf9e [new] installer支持使用自定义仓库地址
[opt] 优化installer的显示
2022-11-09 11:28:09 +08:00
11 changed files with 82 additions and 27 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ namespace HybridCLR.Editor.Commands
var options = new Il2CppDef.Il2CppDefGenerator.Options()
{
UnityVersion = UnityEngine.Application.unityVersion,
OutputFile = $"{SettingsUtil.LocalIl2CppDir}/libil2cpp/hybridclr/Il2CppCompatibleDef.h",
OutputFile = $"{SettingsUtil.LocalIl2CppDir}/libil2cpp/il2cpp-config.h",
};
var g = new Il2CppDef.Il2CppDefGenerator(options);
+1 -1
View File
@@ -50,7 +50,7 @@ namespace HybridCLR.Editor.Il2CppDef
}
}
frr.Replace("UNITY_CONFIG", string.Join("\n", lines));
frr.Replace("UNITY_VERSION", string.Join("\n", lines));
frr.Commit(_options.OutputFile);
Debug.Log($"[HybridCLR.Editor.Il2CppDef.Generator] output:{_options.OutputFile}");
+10 -4
View File
@@ -10,7 +10,7 @@ namespace HybridCLR.Editor.Installer
{
public static class BashUtil
{
public static int RunCommand(string workingDir, string program, string[] args)
public static int RunCommand(string workingDir, string program, string[] args, bool log = true)
{
using (Process p = new Process())
{
@@ -20,7 +20,10 @@ namespace HybridCLR.Editor.Installer
p.StartInfo.CreateNoWindow = true;
string argsStr = string.Join(" ", args.Select(arg => "\"" + arg + "\""));
p.StartInfo.Arguments = argsStr;
UnityEngine.Debug.Log($"[BashUtil] run => {program} {argsStr}");
if (log)
{
UnityEngine.Debug.Log($"[BashUtil] run => {program} {argsStr}");
}
p.Start();
p.WaitForExit();
return p.ExitCode;
@@ -28,7 +31,7 @@ namespace HybridCLR.Editor.Installer
}
public static (int ExitCode, string StdOut, string StdErr) RunCommand2(string workingDir, string program, string[] args)
public static (int ExitCode, string StdOut, string StdErr) RunCommand2(string workingDir, string program, string[] args, bool log = true)
{
using (Process p = new Process())
{
@@ -40,7 +43,10 @@ namespace HybridCLR.Editor.Installer
p.StartInfo.RedirectStandardError = true;
string argsStr = string.Join(" ", args.Select(arg => "\"" + arg + "\""));
p.StartInfo.Arguments = argsStr;
UnityEngine.Debug.Log($"[BashUtil] run => {program} {argsStr}");
if (log)
{
UnityEngine.Debug.Log($"[BashUtil] run => {program} {argsStr}");
}
p.Start();
p.WaitForExit();
+2 -2
View File
@@ -274,8 +274,8 @@ namespace HybridCLR.Editor.Installer
private static string GetRepoUrl(string repoName)
{
string repoProvider = SettingsUtil.HybridCLRSettings.cloneFromGitee ? "gitee" : "github";
return $"https://{repoProvider}.com/focus-creative-games/{repoName}";
string repoProvider = SettingsUtil.HybridCLRSettings.cloneHomeURL;
return $"{repoProvider}/{repoName}";
}
private void RunInitLocalIl2CppData(string il2cppBranch, string il2cppInstallPath)
+8 -2
View File
@@ -44,16 +44,22 @@ namespace HybridCLR.Editor.Installer
GUILayout.Space(10f);
EditorGUILayout.LabelField($"当前Unity版本: {Application.unityVersion},匹配的il2cpp_plus分支: {m_Controller.Il2CppBranch}");
GUILayout.Space(5f);
EditorGUILayout.BeginVertical("box");
bool hasInstall = m_Controller.HasInstalledHybridCLR();
EditorGUILayout.LabelField($"安装状态:{(hasInstall ? "已安装" : "未安装")}", EditorStyles.boldLabel);
if (hasInstall)
{
EditorGUILayout.LabelField($"HybridCLR 版本: {m_Controller.GetHybridCLRLocalVersion()}");
GUILayout.Space(5f);
EditorGUILayout.LabelField($"il2cpp_plus 版本: {m_Controller.GetIl2cppPlusLocalVersion(m_Controller.Il2CppBranch)}");
GUILayout.Space(5f);
GUIInstallButton("检查更新", "检查", UpdateHybridCLR);
GUILayout.Space(40f);
}
GUILayout.Space(5f);
EditorGUILayout.LabelField($"当前Unity版本: {Application.unityVersion},匹配的il2cpp_plus分支: {m_Controller.Il2CppBranch}");
GUISelectUnityDirectory($"il2cpp_plus分支对应的Unity兼容版本的il2cpp路径", "Select");
GUILayout.Space(10f);
GUIInstallButton("安装最新HybridCLR插件代码到本项目", "安装", InitHybridCLR);
+52 -9
View File
@@ -1,19 +1,62 @@
namespace HybridCLR.Editor.Installer
using System.IO;
namespace HybridCLR.Editor.Installer
{
public partial class InstallerController
{
public string GetHybridCLRLocalVersion()
{
string workDir = SettingsUtil.HybridCLRDataDir;
string hybridclrRepoDir = $"{workDir}/{hybridclr_repo_path}";
if (Directory.Exists(hybridclrRepoDir))
{
var ret = BashUtil.RunCommand2(hybridclrRepoDir, "git",
new string[] { "log", "HEAD", "-n", "1", "--pretty=format:\"%H\"", },
false);
if (ret.ExitCode == 0)
{
return ret.StdOut.Trim();
}
else
{
return "ERROR";
}
}
return "";
}
public string GetIl2cppPlusLocalVersion(string il2cppBranch)
{
string workDir = SettingsUtil.HybridCLRDataDir;
string il2cppPlusRepoDir = $"{workDir}/{il2cpp_plus_repo_path}";
if (Directory.Exists(il2cppPlusRepoDir))
{
var ret = BashUtil.RunCommand2(il2cppPlusRepoDir, "git",
new string[] { "log", $"{il2cppBranch}", "-n", "1", "--pretty=format:\"%H\"", },
false);
if (ret.ExitCode == 0)
{
return ret.StdOut.Trim();
}
else
{
return "ERROR";
}
}
return "";
}
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\"", });
BashUtil.RunCommand2(hybridclrRepoDir, "git",
new string[] { "fetch", "--depth=1" });
var ret1 = BashUtil.RunCommand2(hybridclrRepoDir, "git", new string[] { "log", "HEAD", "-n", "1", "--pretty=format:\"%H\"", }, false);
BashUtil.RunCommand2(hybridclrRepoDir, "git", new string[] { "fetch", "--depth=1" }, false);
var ret2 = BashUtil.RunCommand2(hybridclrRepoDir, "git",
new string[] { "log", "remotes/origin/HEAD", "-n", "1", "--pretty=format:\"%H\"", });
new string[] { "log", "remotes/origin/HEAD", "-n", "1", "--pretty=format:\"%H\"", }
, false);
if (ret1.StdOut != ret2.StdOut)
{
return true;
@@ -23,11 +66,11 @@
{
string il2cppPlusRepoDir = $"{workDir}/{il2cpp_plus_repo_path}";
var ret1 = BashUtil.RunCommand2(il2cppPlusRepoDir, "git",
new string[] { "log", $"{il2cppBranch}", "-n", "1", "--pretty=format:\"%H\"", });
new string[] { "log", $"{il2cppBranch}", "-n", "1", "--pretty=format:\"%H\"", }, false);
BashUtil.RunCommand2(il2cppPlusRepoDir, "git",
new string[] { "fetch", "--depth=1" });
new string[] { "fetch", "--depth=1" }, false);
var ret2 = BashUtil.RunCommand2(il2cppPlusRepoDir, "git",
new string[] { "log", $"remotes/origin/{il2cppBranch}", "-n", "1", "--pretty=format:\"%H\"", });
new string[] { "log", $"remotes/origin/{il2cppBranch}", "-n", "1", "--pretty=format:\"%H\"", }, false);
if (ret1.StdOut != ret2.StdOut)
{
return true;
+1 -1
View File
@@ -21,7 +21,7 @@ namespace HybridCLR.Editor.Meta
private bool IsPluginDll(string dllPath)
{
var fileOrDirs = new HashSet<string>(dllPath.Split('\\', '/'));
return !fileOrDirs.Intersect(s_ignoreDirs).Any();
return !fileOrDirs.Any(dir => dir.EndsWith("~")) && !fileOrDirs.Intersect(s_ignoreDirs).Any();
}
public string ResolveAssembly(string assemblyName, bool throwExIfNotFind)
+3 -3
View File
@@ -11,7 +11,7 @@ namespace HybridCLR.Editor
private SerializedObject _serializedObject;
private SerializedProperty _enable;
private SerializedProperty _useGlobalIl2cpp;
private SerializedProperty _cloneFromGitee;
private SerializedProperty _cloneHomeURL;
private SerializedProperty _hotUpdateAssemblyDefinitions;
private SerializedProperty _hotUpdateAssemblies;
private SerializedProperty _preserveHotUpdateAssemblies;
@@ -39,7 +39,7 @@ namespace HybridCLR.Editor
_serializedObject = new SerializedObject(setting);
_enable = _serializedObject.FindProperty("enable");
_useGlobalIl2cpp = _serializedObject.FindProperty("useGlobalIl2cpp");
_cloneFromGitee = _serializedObject.FindProperty("cloneFromGitee");
_cloneHomeURL = _serializedObject.FindProperty("cloneHomeURL");
_hotUpdateAssemblyDefinitions = _serializedObject.FindProperty("hotUpdateAssemblyDefinitions");
_hotUpdateAssemblies = _serializedObject.FindProperty("hotUpdateAssemblies");
_preserveHotUpdateAssemblies = _serializedObject.FindProperty("preserveHotUpdateAssemblies");
@@ -127,7 +127,7 @@ namespace HybridCLR.Editor
_serializedObject.Update();
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(_enable);
EditorGUILayout.PropertyField(_cloneFromGitee);
EditorGUILayout.PropertyField(_cloneHomeURL);
EditorGUILayout.PropertyField(_useGlobalIl2cpp);
EditorGUILayout.PropertyField(_hotUpdateAssemblyDefinitions);
EditorGUILayout.PropertyField(_hotUpdateAssemblies);
+2 -2
View File
@@ -11,8 +11,8 @@ namespace HybridCLR.Editor
[Header("使用全局安装的il2cpp")]
public bool useGlobalIl2cpp;
[Header("从gitee clone插件代码")]
public bool cloneFromGitee = true; // false 则从github上拉取
[Header("基准 git clone URL")]
public string cloneHomeURL = "https://gitee.com/focus-creative-games";
[Header("热更新Assembly Definitions")]
public AssemblyDefinitionAsset[] hotUpdateAssemblyDefinitions;
+1 -1
View File
@@ -5,7 +5,7 @@ using System.Threading.Tasks;
namespace HybridCLR.Runtime
{
[AttributeUsage(AttributeTargets.Method)]
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Struct)]
public class UnchangedAttribute : Attribute
{
public bool Unchanged { get; }
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "com.focus-creative-games.hybridclr_unity",
"version": "0.10.3",
"version": "1.0.0",
"displayName": "HybridCLR",
"description": "Unity package for HybridCLR. It includes editor and runtime scripts and assets for HybridCLR",
"category": "Runtime",