[new] 检查当前安装的libil2cpp版本是否与package版本匹配,避免升级package后未重新install的问题
parent
216d09f7b6
commit
05a34d4d12
|
@ -56,6 +56,11 @@ namespace HybridCLR.Editor.BuildProcessors
|
||||||
throw new BuildFailedException($"You have not initialized HybridCLR, please install it via menu 'HybridCLR/Installer'");
|
throw new BuildFailedException($"You have not initialized HybridCLR, please install it via menu 'HybridCLR/Installer'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (installer.PackageVersion != installer.InstalledLibil2cppVersion)
|
||||||
|
{
|
||||||
|
throw new BuildFailedException($"You must run `HybridCLR/Installer` after upgrading package");
|
||||||
|
}
|
||||||
|
|
||||||
HybridCLRSettings gs = SettingsUtil.HybridCLRSettings;
|
HybridCLRSettings gs = SettingsUtil.HybridCLRSettings;
|
||||||
if (((gs.hotUpdateAssemblies?.Length + gs.hotUpdateAssemblyDefinitions?.Length) ?? 0) == 0)
|
if (((gs.hotUpdateAssemblies?.Length + gs.hotUpdateAssemblyDefinitions?.Length) ?? 0) == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,12 +27,15 @@ namespace HybridCLR.Editor.Installer
|
||||||
|
|
||||||
public string PackageVersion { get; private set; }
|
public string PackageVersion { get; private set; }
|
||||||
|
|
||||||
|
public string InstalledLibil2cppVersion { get; private set; }
|
||||||
|
|
||||||
public InstallerController()
|
public InstallerController()
|
||||||
{
|
{
|
||||||
_curVersion = ParseUnityVersion(Application.unityVersion);
|
_curVersion = ParseUnityVersion(Application.unityVersion);
|
||||||
_versionManifest = GetHybridCLRVersionManifest();
|
_versionManifest = GetHybridCLRVersionManifest();
|
||||||
_curDefaultVersion = _versionManifest.versions.FirstOrDefault(v => v.unity_version == _curVersion.major.ToString());
|
_curDefaultVersion = _versionManifest.versions.FirstOrDefault(v => v.unity_version == _curVersion.major.ToString());
|
||||||
PackageVersion = LoadPackageInfo().version;
|
PackageVersion = LoadPackageInfo().version;
|
||||||
|
InstalledLibil2cppVersion = ReadLocalVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
private HybridclrVersionManifest GetHybridCLRVersionManifest()
|
private HybridclrVersionManifest GetHybridCLRVersionManifest()
|
||||||
|
@ -157,6 +160,23 @@ namespace HybridCLR.Editor.Installer
|
||||||
|
|
||||||
public string ApplicationIl2cppPath => GetIl2CppPathByContentPath(EditorApplication.applicationContentsPath);
|
public string ApplicationIl2cppPath => GetIl2CppPathByContentPath(EditorApplication.applicationContentsPath);
|
||||||
|
|
||||||
|
public string LocalVersionFile => $"{SettingsUtil.LocalIl2CppDir}/libil2cpp/hybridclr/generated/libil2cpp-version.txt";
|
||||||
|
|
||||||
|
private string ReadLocalVersion()
|
||||||
|
{
|
||||||
|
if (!File.Exists(LocalVersionFile))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return File.ReadAllText(LocalVersionFile, Encoding.UTF8);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void WriteLocalVersion()
|
||||||
|
{
|
||||||
|
InstalledLibil2cppVersion = PackageVersion;
|
||||||
|
File.WriteAllText(LocalVersionFile, PackageVersion, Encoding.UTF8);
|
||||||
|
}
|
||||||
|
|
||||||
public void InstallDefaultHybridCLR()
|
public void InstallDefaultHybridCLR()
|
||||||
{
|
{
|
||||||
InstallFromLocal(PrepareLibil2cppWithHybridclrFromGitRepo());
|
InstallFromLocal(PrepareLibil2cppWithHybridclrFromGitRepo());
|
||||||
|
@ -237,6 +257,7 @@ namespace HybridCLR.Editor.Installer
|
||||||
|
|
||||||
if (HasInstalledHybridCLR())
|
if (HasInstalledHybridCLR())
|
||||||
{
|
{
|
||||||
|
WriteLocalVersion();
|
||||||
Debug.Log("Install Sucessfully");
|
Debug.Log("Install Sucessfully");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -46,7 +46,9 @@ namespace HybridCLR.Editor.Installer
|
||||||
|
|
||||||
EditorGUILayout.LabelField($"Package Version: v{_controller.PackageVersion}");
|
EditorGUILayout.LabelField($"Package Version: v{_controller.PackageVersion}");
|
||||||
GUILayout.Space(5f);
|
GUILayout.Space(5f);
|
||||||
|
EditorGUILayout.LabelField($"Installed libil2cpp Version: {_controller.InstalledLibil2cppVersion ?? "Unknown"}");
|
||||||
|
GUILayout.Space(5f);
|
||||||
|
|
||||||
GUILayout.Space(10f);
|
GUILayout.Space(10f);
|
||||||
|
|
||||||
InstallerController.CompatibleType compatibleType = _controller.GetCompatibleType();
|
InstallerController.CompatibleType compatibleType = _controller.GetCompatibleType();
|
||||||
|
|
Loading…
Reference in New Issue