mirror of
https://github.com/focus-creative-games/hybridclr_unity.git
synced 2026-11-20 23:52:41 +08:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fdba92588a | |||
| bf6ae99dad | |||
| dbd8121ee2 | |||
| 5a50778821 | |||
| 6834a17968 | |||
| ef70a49ae2 | |||
| 83c336a5ce |
Binary file not shown.
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f42c0f03663d4c14f8a49912c08a514f
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b3b3b1f0cbc038149acb4d23bc6d5bf5
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"unity_version":"2019",
|
||||
"hybridclr" : { "branch":"main", "hash":"531f98365eebce5d1390175be2b41c41e217d918"},
|
||||
"il2cpp_plus": { "branch":"2019-main", "hash":"ebe5190b0404d1857832bd1d52ebec7c3730a01d"}
|
||||
},
|
||||
{
|
||||
"unity_version":"2020",
|
||||
"hybridclr" : { "branch":"main", "hash":"531f98365eebce5d1390175be2b41c41e217d918"},
|
||||
"il2cpp_plus": { "branch":"2020-main", "hash":"c6cf54285381d0b03a58126e0d39b6e4d11937b7"}
|
||||
},
|
||||
{
|
||||
"unity_version":"2021",
|
||||
"hybridclr" : { "branch":"main", "hash":"531f98365eebce5d1390175be2b41c41e217d918"},
|
||||
"il2cpp_plus": { "branch":"2021-main", "hash":"99cd1cbbfc1f637460379e81c9a7776cd3e662ad"}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -24,8 +24,8 @@ namespace HybridCLR.Editor.BuildProcessors
|
||||
Debug.Log($"[FilterHotFixAssemblies] disabled");
|
||||
return assemblies;
|
||||
}
|
||||
List<string> allHotUpdateDllNames = SettingsUtil.HotUpdateAssemblyNames;
|
||||
List<string> allHotupdateDllFiles = SettingsUtil.HotUpdateAssemblyFiles;
|
||||
List<string> allHotUpdateDllNames = SettingsUtil.HotUpdateAssemblyNamesExcludePreserved;
|
||||
List<string> allHotupdateDllFiles = SettingsUtil.HotUpdateAssemblyFilesExcludePreserved;
|
||||
|
||||
// 检查是否重复填写
|
||||
var hotUpdateDllSet = new HashSet<string>();
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace HybridCLR.Editor.BuildProcessors
|
||||
{
|
||||
var patcher = new ScriptingAssembliesJsonPatcher();
|
||||
patcher.Load(file);
|
||||
patcher.AddScriptingAssemblies(SettingsUtil.PatchingHotUpdateAssemblyFiles);
|
||||
patcher.AddScriptingAssemblies(SettingsUtil.HotUpdateAssemblyFilesIncludePreserved);
|
||||
patcher.Save(file);
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,7 @@ namespace HybridCLR.Editor.BuildProcessors
|
||||
{
|
||||
var binFile = new UnityBinFile();
|
||||
binFile.Load(binPath);
|
||||
binFile.AddScriptingAssemblies(SettingsUtil.PatchingHotUpdateAssemblyFiles);
|
||||
binFile.AddScriptingAssemblies(SettingsUtil.HotUpdateAssemblyFilesIncludePreserved);
|
||||
binFile.Save(binPath);
|
||||
Debug.Log($"[PatchScriptingAssemblyList] patch {binPath}");
|
||||
}
|
||||
@@ -142,7 +142,7 @@ namespace HybridCLR.Editor.BuildProcessors
|
||||
foreach (string binPath in binFiles)
|
||||
{
|
||||
var patcher = new Dataunity3dPatcher();
|
||||
patcher.ApplyPatch(binPath, SettingsUtil.PatchingHotUpdateAssemblyFiles);
|
||||
patcher.ApplyPatch(binPath, SettingsUtil.HotUpdateAssemblyFilesIncludePreserved);
|
||||
Debug.Log($"[PatchScriptingAssemblyList] patch {binPath}");
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace HybridCLR.Editor.Commands
|
||||
public static void GenerateAOTGenericReference(BuildTarget target)
|
||||
{
|
||||
var gs = SettingsUtil.HybridCLRSettings;
|
||||
List<string> hotUpdateDllNames = SettingsUtil.HotUpdateAssemblyNames;
|
||||
List<string> hotUpdateDllNames = SettingsUtil.HotUpdateAssemblyNamesExcludePreserved;
|
||||
|
||||
using (AssemblyReferenceDeepCollector collector = new AssemblyReferenceDeepCollector(MetaUtil.CreateHotUpdateAndAOTAssemblyResolver(target, hotUpdateDllNames), hotUpdateDllNames))
|
||||
{
|
||||
|
||||
@@ -18,7 +18,9 @@ namespace HybridCLR.Editor.Commands
|
||||
var options = new Il2CppDef.Il2CppDefGenerator.Options()
|
||||
{
|
||||
UnityVersion = Application.unityVersion,
|
||||
HotUpdateAssemblies = SettingsUtil.HotUpdateAssemblyNamesIncludePreserved,
|
||||
OutputFile = $"{SettingsUtil.LocalIl2CppDir}/libil2cpp/il2cpp-config.h",
|
||||
OutputFile2 = $"{SettingsUtil.LocalIl2CppDir}/libil2cpp/hybridclr/Il2CppCompatibleDef.cpp",
|
||||
};
|
||||
|
||||
var g = new Il2CppDef.Il2CppDefGenerator(options);
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace HybridCLR.Editor.Commands
|
||||
{
|
||||
var ls = SettingsUtil.HybridCLRSettings;
|
||||
|
||||
List<string> hotfixAssemblies = SettingsUtil.HotUpdateAssemblyNames;
|
||||
List<string> hotfixAssemblies = SettingsUtil.HotUpdateAssemblyNamesExcludePreserved;
|
||||
|
||||
var analyzer = new Analyzer(MetaUtil.CreateHotUpdateAndAOTAssemblyResolver(target, hotfixAssemblies), HybridCLRSettings.Instance.collectAssetReferenceTypes);
|
||||
var refTypes = analyzer.CollectRefs(hotfixAssemblies);
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace HybridCLR.Editor.Commands
|
||||
|
||||
public static void GenerateMethodBridge(BuildTarget target)
|
||||
{
|
||||
List<string> hotUpdateDllNames = SettingsUtil.HotUpdateAssemblyNames;
|
||||
List<string> hotUpdateDllNames = SettingsUtil.HotUpdateAssemblyNamesExcludePreserved;
|
||||
using (AssemblyReferenceDeepCollector collector = new AssemblyReferenceDeepCollector(MetaUtil.CreateHotUpdateAndAOTAssemblyResolver(target, hotUpdateDllNames), hotUpdateDllNames))
|
||||
{
|
||||
var analyzer = new Analyzer(new Analyzer.Options
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace HybridCLR.Editor.Commands
|
||||
|
||||
public static void GenerateReversePInvokeWrapper(BuildTarget target)
|
||||
{
|
||||
List<string> hotUpdateDlls = SettingsUtil.HotUpdateAssemblyNames;
|
||||
List<string> hotUpdateDlls = SettingsUtil.HotUpdateAssemblyNamesExcludePreserved;
|
||||
using (var cache = new AssemblyCache(MetaUtil.CreateHotUpdateAndAOTAssemblyResolver(target, hotUpdateDlls)))
|
||||
{
|
||||
var analyzer = new ReversePInvokeWrap.Analyzer(cache, hotUpdateDlls);
|
||||
|
||||
@@ -15,8 +15,12 @@ namespace HybridCLR.Editor.Il2CppDef
|
||||
{
|
||||
public class Options
|
||||
{
|
||||
public List<string> HotUpdateAssemblies { get; set; }
|
||||
|
||||
public string OutputFile { get; set; }
|
||||
|
||||
public string OutputFile2 { get; set; }
|
||||
|
||||
public string UnityVersion { get; set; }
|
||||
}
|
||||
|
||||
@@ -30,6 +34,12 @@ namespace HybridCLR.Editor.Il2CppDef
|
||||
private static readonly Regex s_unityVersionPat = new Regex(@"(\d+)\.(\d+)\.(\d+)");
|
||||
|
||||
public void Generate()
|
||||
{
|
||||
GenerateIl2CppConfig();
|
||||
GeneratePlaceHolderAssemblies();
|
||||
}
|
||||
|
||||
private void GenerateIl2CppConfig()
|
||||
{
|
||||
var frr = new FileRegionReplace(File.ReadAllText(_options.OutputFile));
|
||||
|
||||
@@ -55,5 +65,22 @@ namespace HybridCLR.Editor.Il2CppDef
|
||||
frr.Commit(_options.OutputFile);
|
||||
Debug.Log($"[HybridCLR.Editor.Il2CppDef.Generator] output:{_options.OutputFile}");
|
||||
}
|
||||
|
||||
private void GeneratePlaceHolderAssemblies()
|
||||
{
|
||||
var frr = new FileRegionReplace(File.ReadAllText(_options.OutputFile2));
|
||||
|
||||
List<string> lines = new List<string>();
|
||||
|
||||
foreach (var ass in _options.HotUpdateAssemblies)
|
||||
{
|
||||
lines.Add($"\t\t\"{ass}\",");
|
||||
}
|
||||
|
||||
frr.Replace("PLACE_HOLDER", string.Join("\n", lines));
|
||||
|
||||
frr.Commit(_options.OutputFile2);
|
||||
Debug.Log($"[HybridCLR.Editor.Il2CppDef.Generator] output:{_options.OutputFile2}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace HybridCLR.Editor.Installer
|
||||
p.StartInfo.CreateNoWindow = true;
|
||||
p.StartInfo.RedirectStandardOutput = true;
|
||||
p.StartInfo.RedirectStandardError = true;
|
||||
string argsStr = string.Join(" ", args.Select(arg => "\"" + arg + "\""));
|
||||
string argsStr = string.Join(" ", args);
|
||||
p.StartInfo.Arguments = argsStr;
|
||||
if (log)
|
||||
{
|
||||
@@ -56,15 +56,6 @@ namespace HybridCLR.Editor.Installer
|
||||
}
|
||||
}
|
||||
|
||||
public static bool ExistProgram(string prog)
|
||||
{
|
||||
#if UNITY_EDITOR_WIN
|
||||
return RunCommand(".", "where", new string[] {prog}) == 0;
|
||||
#elif UNITY_EDITOR_OSX || UNITY_EDITOR_LINUX
|
||||
return RunCommand(".", "which", new string[] {prog}) == 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
public static void RemoveDir(string dir, bool log = false)
|
||||
{
|
||||
|
||||
@@ -20,24 +20,60 @@ namespace HybridCLR.Editor.Installer
|
||||
Ok,
|
||||
}
|
||||
|
||||
public partial class InstallerController
|
||||
|
||||
|
||||
|
||||
public class InstallerController
|
||||
{
|
||||
private const string hybridclr_repo_path = "hybridclr_repo";
|
||||
|
||||
private const string il2cpp_plus_repo_path = "il2cpp_plus_repo";
|
||||
|
||||
|
||||
|
||||
public int MajorVersion => _curVersion.major;
|
||||
|
||||
private UnityVersion _curVersion;
|
||||
private readonly UnityVersion _curVersion;
|
||||
|
||||
private readonly HybridclrVersionManifest _versionManifest;
|
||||
private readonly HybridclrVersionInfo _curDefaultVersion;
|
||||
|
||||
public InstallerController()
|
||||
{
|
||||
_curVersion = ParseUnityVersion(Application.unityVersion);
|
||||
_versionManifest = GetHybridCLRVersionManifest();
|
||||
_curDefaultVersion = _versionManifest.versions.Find(v => v.unity_version == _curVersion.major.ToString());
|
||||
}
|
||||
|
||||
public class UnityVersion
|
||||
private HybridclrVersionManifest GetHybridCLRVersionManifest()
|
||||
{
|
||||
string versionFile = $"{SettingsUtil.ProjectDir}/{SettingsUtil.HybridCLRDataPathInPackage}/hybridclr_version.json";
|
||||
return JsonUtility.FromJson<HybridclrVersionManifest>(File.ReadAllText(versionFile, Encoding.UTF8));
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
class VersionDesc
|
||||
{
|
||||
public string branch;
|
||||
|
||||
public string hash;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
class HybridclrVersionInfo
|
||||
{
|
||||
public string unity_version;
|
||||
|
||||
public VersionDesc hybridclr;
|
||||
|
||||
public VersionDesc il2cpp_plus;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
class HybridclrVersionManifest
|
||||
{
|
||||
public List<HybridclrVersionInfo> versions;
|
||||
}
|
||||
|
||||
private class UnityVersion
|
||||
{
|
||||
public int major;
|
||||
public int minor1;
|
||||
@@ -120,75 +156,22 @@ namespace HybridCLR.Editor.Installer
|
||||
}
|
||||
}
|
||||
|
||||
private string _hybridclrLocalVersion;
|
||||
public string HybridclrLocalVersion => _curDefaultVersion.hybridclr.hash;
|
||||
|
||||
public string HybridclrLocalVersion => _hybridclrLocalVersion != null ? _hybridclrLocalVersion : _hybridclrLocalVersion = GetHybridCLRLocalVersion();
|
||||
public string Il2cppPlusLocalVersion => _curDefaultVersion.il2cpp_plus.hash;
|
||||
|
||||
|
||||
public string HybridCLRRepoInstalledVersion
|
||||
{
|
||||
get { return EditorPrefs.GetString($"hybridclr_repo#{MajorVersion}"); }
|
||||
set { EditorPrefs.SetString($"hybridclr_repo#{MajorVersion}", value); }
|
||||
}
|
||||
|
||||
public string Il2CppRepoInstalledVersion
|
||||
{
|
||||
get { return EditorPrefs.GetString($"il2cpp_plus_repo#{MajorVersion}"); }
|
||||
set { EditorPrefs.SetString($"il2cpp_plus_repo#{MajorVersion}", value); }
|
||||
}
|
||||
|
||||
|
||||
private 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 "";
|
||||
}
|
||||
|
||||
private string _il2cppPlusLocalVersion;
|
||||
|
||||
public string Il2cppPlusLocalVersion => _il2cppPlusLocalVersion != null ? _il2cppPlusLocalVersion : _il2cppPlusLocalVersion = GetIl2cppPlusLocalVersion();
|
||||
|
||||
private string GetIl2cppPlusLocalVersion()
|
||||
{
|
||||
string workDir = SettingsUtil.HybridCLRDataDir;
|
||||
string il2cppPlusRepoDir = $"{workDir}/{il2cpp_plus_repo_path}";
|
||||
if (Directory.Exists(il2cppPlusRepoDir))
|
||||
{
|
||||
var ret = BashUtil.RunCommand2(il2cppPlusRepoDir, "git",
|
||||
new string[] { "log", "HEAD", "-n", "1", "--pretty=format:\"%H\"", },
|
||||
false);
|
||||
if (ret.ExitCode == 0)
|
||||
{
|
||||
return ret.StdOut.Trim();
|
||||
}
|
||||
else
|
||||
{
|
||||
return "ERROR";
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private string GetIl2CppPathByContentPath(string contentPath)
|
||||
{
|
||||
return $"{contentPath}/il2cpp";
|
||||
}
|
||||
|
||||
|
||||
public void InstallDefaultHybridCLR()
|
||||
{
|
||||
InstallLocalHybridCLR(HybridclrLocalVersion, Il2cppPlusLocalVersion);
|
||||
}
|
||||
|
||||
public void InstallLocalHybridCLR(string hybridclrVer, string il2cppPlusVer)
|
||||
{
|
||||
RunInitLocalIl2CppData(GetIl2CppPathByContentPath(EditorApplication.applicationContentsPath), _curVersion, hybridclrVer, il2cppPlusVer);
|
||||
@@ -218,15 +201,20 @@ namespace HybridCLR.Editor.Installer
|
||||
#endif
|
||||
}
|
||||
|
||||
void CloneSpeicificCommitId(string workDir, string repoUrl, string branch, string repoDir, string commitId)
|
||||
{
|
||||
BashUtil.RemoveDir(repoDir);
|
||||
BashUtil.RunCommand(workDir, "git", new string[] {"clone", "-b", branch, repoUrl, repoDir});
|
||||
BashUtil.RunCommand($"{repoDir}", "git", new string[] { "checkout", commitId });
|
||||
}
|
||||
|
||||
private void RunInitLocalIl2CppData(string editorIl2cppPath, UnityVersion version, string hybridclrVer, string il2cppPlusVer)
|
||||
{
|
||||
#if UNITY_EDITOR_WIN
|
||||
if (!BashUtil.ExistProgram("git"))
|
||||
if (!IsComaptibleVersion())
|
||||
{
|
||||
throw new Exception($"安装本地il2cpp需要使用git从远程拉取仓库,请先安装git");
|
||||
Debug.LogError($"il2cpp 版本不兼容,最小版本为 {GetCurrentUnityVersionMinCompatibleVersionStr()}");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
string workDir = SettingsUtil.HybridCLRDataDir;
|
||||
Directory.CreateDirectory(workDir);
|
||||
//BashUtil.RecreateDir(workDir);
|
||||
@@ -238,44 +226,12 @@ namespace HybridCLR.Editor.Installer
|
||||
// clone hybridclr
|
||||
string hybridclrRepoURL = HybridCLRSettings.Instance.hybridclrRepoURL;
|
||||
string hybridclrRepoDir = $"{workDir}/{hybridclr_repo_path}";
|
||||
{
|
||||
BashUtil.RemoveDir(hybridclrRepoDir);
|
||||
string[] args = new string[]
|
||||
{
|
||||
"clone",
|
||||
"--depth=1",
|
||||
"-b",
|
||||
hybridclrVer,
|
||||
hybridclrRepoURL,
|
||||
hybridclrRepoDir,
|
||||
};
|
||||
var ret = BashUtil.RunCommand(workDir, "git", args);
|
||||
//if (ret != 0)
|
||||
//{
|
||||
// throw new Exception($"git clone 失败");
|
||||
//}
|
||||
}
|
||||
CloneSpeicificCommitId(workDir, hybridclrRepoURL, _curDefaultVersion.hybridclr.branch, hybridclrRepoDir, hybridclrVer);
|
||||
|
||||
// clone il2cpp_plus
|
||||
string il2cppPlusRepoURL = HybridCLRSettings.Instance.il2cppPlusRepoURL;
|
||||
string il2cppPlusRepoDir = $"{workDir}/{il2cpp_plus_repo_path}";
|
||||
{
|
||||
BashUtil.RemoveDir(il2cppPlusRepoDir);
|
||||
string[] args = new string[]
|
||||
{
|
||||
"clone",
|
||||
"--depth=1",
|
||||
"-b",
|
||||
il2cppPlusVer,
|
||||
il2cppPlusRepoURL,
|
||||
il2cppPlusRepoDir,
|
||||
};
|
||||
var ret = BashUtil.RunCommand(workDir, "git", args);
|
||||
//if (ret != 0)
|
||||
//{
|
||||
// throw new Exception($"git clone 失败");
|
||||
//}
|
||||
}
|
||||
CloneSpeicificCommitId(workDir, il2cppPlusRepoURL, _curDefaultVersion.il2cpp_plus.branch, il2cppPlusRepoDir, il2cppPlusVer);
|
||||
|
||||
// create LocalIl2Cpp
|
||||
string localUnityDataDir = SettingsUtil.LocalUnityDataDir;
|
||||
@@ -310,17 +266,17 @@ namespace HybridCLR.Editor.Installer
|
||||
Debug.LogError($"未找到当前版本:{curVersionStr} 对应的改造过的 Unity.IL2CPP.dll,打包出的程序将会崩溃");
|
||||
}
|
||||
}
|
||||
if (version.major >= 2021)
|
||||
{
|
||||
Debug.LogError($"如果需要打包iOS,必须手动替换UnityEditor.CoreModule.dll为修改后的版本,否则无法获得AOT dlls。详见 https://focus-creative-games.github.io/hybridclr/modify_unity_dll/#unityeditor-coremodule-dll");
|
||||
}
|
||||
if (HasInstalledHybridCLR())
|
||||
{
|
||||
Debug.Log("安装成功!");
|
||||
_hybridclrLocalVersion = null;
|
||||
_il2cppPlusLocalVersion = null;
|
||||
HybridCLRRepoInstalledVersion = hybridclrVer;
|
||||
Il2CppRepoInstalledVersion = il2cppPlusVer;
|
||||
Debug.Log("安装成功");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("安装失败!");
|
||||
Debug.LogError("安装失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,22 +10,9 @@ namespace HybridCLR.Editor.Installer
|
||||
{
|
||||
private InstallerController _controller;
|
||||
|
||||
string _hybridclrVersion;
|
||||
string _il2cppPlusVersion;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
_controller = new InstallerController();
|
||||
_hybridclrVersion = _controller.HybridCLRRepoInstalledVersion;
|
||||
if (string.IsNullOrWhiteSpace(_hybridclrVersion))
|
||||
{
|
||||
_hybridclrVersion = "1.0";
|
||||
}
|
||||
_il2cppPlusVersion = _controller.Il2CppRepoInstalledVersion;
|
||||
if (string.IsNullOrWhiteSpace(_il2cppPlusVersion))
|
||||
{
|
||||
_il2cppPlusVersion = $"{_controller.MajorVersion}-1.0";
|
||||
}
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
@@ -44,34 +31,33 @@ namespace HybridCLR.Editor.Installer
|
||||
SettingsService.OpenProjectSettings("Project/HybridCLR Settings");
|
||||
}
|
||||
|
||||
bool hasInstall = _controller.HasInstalledHybridCLR();
|
||||
|
||||
GUILayout.Space(10f);
|
||||
|
||||
EditorGUILayout.BeginVertical("box");
|
||||
bool hasInstall = _controller.HasInstalledHybridCLR();
|
||||
EditorGUILayout.LabelField($"安装状态:{(hasInstall ? "已安装" : "未安装")}", EditorStyles.boldLabel);
|
||||
GUILayout.Space(10f);
|
||||
|
||||
if (hasInstall)
|
||||
{
|
||||
EditorGUILayout.LabelField($"HybridCLR 版本: {_controller.HybridclrLocalVersion}");
|
||||
GUILayout.Space(5f);
|
||||
EditorGUILayout.LabelField($"il2cpp_plus 版本: {_controller.Il2cppPlusLocalVersion}");
|
||||
GUILayout.Space(5f);
|
||||
//GUIInstallButton("检查更新", "检查", UpdateHybridCLR);
|
||||
//GUILayout.Space(40f);
|
||||
}
|
||||
EditorGUILayout.LabelField($"HybridCLR 版本: {_controller.HybridclrLocalVersion}");
|
||||
GUILayout.Space(5f);
|
||||
EditorGUILayout.LabelField($"il2cpp_plus 版本: {_controller.Il2cppPlusLocalVersion}");
|
||||
GUILayout.Space(5f);
|
||||
//GUIInstallButton("检查更新", "检查", UpdateHybridCLR);
|
||||
//GUILayout.Space(40f);
|
||||
|
||||
GUILayout.Space(10f);
|
||||
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField("待安装的 hybridclr 仓库版本号(或branch或tag)(默认取最新版本):", GUILayout.MaxWidth(400));
|
||||
_hybridclrVersion = EditorGUILayout.TextField(_hybridclrVersion);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
//EditorGUILayout.BeginHorizontal();
|
||||
//EditorGUILayout.LabelField("待安装的 hybridclr 仓库版本号(或branch或tag)(默认取最新版本):", GUILayout.MaxWidth(400));
|
||||
//_hybridclrVersion = EditorGUILayout.TextField(_hybridclrVersion);
|
||||
//EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField($"待安装的 il2cpp_plus 仓库版本号(或branch或tag)(默认取{_controller.MajorVersion}-main分支最新版本):", GUILayout.MaxWidth(400));
|
||||
_il2cppPlusVersion = EditorGUILayout.TextField(_il2cppPlusVersion);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
//EditorGUILayout.BeginHorizontal();
|
||||
//EditorGUILayout.LabelField($"待安装的 il2cpp_plus 仓库版本号(或branch或tag)(默认取{_controller.MajorVersion}-main分支最新版本):", GUILayout.MaxWidth(400));
|
||||
//_il2cppPlusVersion = EditorGUILayout.TextField(_il2cppPlusVersion);
|
||||
//EditorGUILayout.EndHorizontal();
|
||||
|
||||
|
||||
GUIInstallButton("安装hybridclr+il2cpp_plus代码到本地目录", "安装");
|
||||
@@ -93,20 +79,7 @@ namespace HybridCLR.Editor.Installer
|
||||
|
||||
private void InstallLocalHybridCLR()
|
||||
{
|
||||
if (!_controller.IsComaptibleVersion())
|
||||
{
|
||||
Debug.LogError($"il2cpp 版本不兼容,最小版本为 {_controller.GetCurrentUnityVersionMinCompatibleVersionStr()}");
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(_hybridclrVersion))
|
||||
{
|
||||
_hybridclrVersion = "main";
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(_il2cppPlusVersion))
|
||||
{
|
||||
_il2cppPlusVersion = $"{_controller.MajorVersion}-main";
|
||||
}
|
||||
_controller.InstallLocalHybridCLR(_hybridclrVersion, _il2cppPlusVersion);
|
||||
_controller.InstallDefaultHybridCLR();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+15
-11
@@ -65,9 +65,9 @@ namespace HybridCLR.Editor
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 所有热更新dll列表。放到此列表中的dll在打包时OnFilterAssemblies回调中被过滤。
|
||||
/// 热更新dll列表。不包含 preserveHotUpdateAssemblies。
|
||||
/// </summary>
|
||||
public static List<string> HotUpdateAssemblyNames
|
||||
public static List<string> HotUpdateAssemblyNamesExcludePreserved
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -84,31 +84,35 @@ namespace HybridCLR.Editor
|
||||
}
|
||||
}
|
||||
|
||||
public static List<string> HotUpdateAssemblyFiles => HotUpdateAssemblyNames.Select(dll => dll + ".dll").ToList();
|
||||
public static List<string> HotUpdateAssemblyFilesExcludePreserved => HotUpdateAssemblyNamesExcludePreserved.Select(dll => dll + ".dll").ToList();
|
||||
|
||||
public static List<string> PatchingHotUpdateAssemblyFiles
|
||||
|
||||
public static List<string> HotUpdateAssemblyNamesIncludePreserved
|
||||
{
|
||||
get
|
||||
{
|
||||
List<string> patchingList = HotUpdateAssemblyFiles;
|
||||
List<string> allAsses = HotUpdateAssemblyNamesExcludePreserved;
|
||||
string[] preserveAssemblyNames = HybridCLRSettings.Instance.preserveHotUpdateAssemblies;
|
||||
if (preserveAssemblyNames != null && preserveAssemblyNames.Length > 0)
|
||||
{
|
||||
foreach(var assemblyName in preserveAssemblyNames)
|
||||
foreach (var assemblyName in preserveAssemblyNames)
|
||||
{
|
||||
string dllFileName = assemblyName + ".dll";
|
||||
if (patchingList.Contains(dllFileName))
|
||||
if (allAsses.Contains(assemblyName))
|
||||
{
|
||||
throw new Exception($"[PatchingHotUpdateAssemblyFiles] assembly:'{assemblyName}' 重复");
|
||||
throw new Exception($"[HotUpdateAssemblyNamesIncludePreserved] assembly:'{assemblyName}' 重复");
|
||||
}
|
||||
patchingList.Add(dllFileName);
|
||||
allAsses.Add(assemblyName);
|
||||
}
|
||||
}
|
||||
|
||||
return patchingList;
|
||||
return allAsses;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<string> HotUpdateAssemblyFilesIncludePreserved => HotUpdateAssemblyNamesIncludePreserved.Select(ass => ass + ".dll").ToList();
|
||||
|
||||
public static List<string> AOTAssemblyNames => HybridCLRSettings.Instance.patchAOTAssemblies.ToList();
|
||||
|
||||
public static HybridCLRSettings HybridCLRSettings => HybridCLRSettings.Instance;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "com.focus-creative-games.hybridclr_unity",
|
||||
"version": "1.0.12",
|
||||
"version": "2.0.0",
|
||||
"displayName": "HybridCLR",
|
||||
"description": "Unity package for HybridCLR. It includes editor and runtime scripts and assets for HybridCLR",
|
||||
"category": "Runtime",
|
||||
|
||||
Reference in New Issue
Block a user