diff --git a/Editor/BuildProcessors/CheckSettings.cs b/Editor/BuildProcessors/CheckSettings.cs index dd397aa..a5840bc 100644 --- a/Editor/BuildProcessors/CheckSettings.cs +++ b/Editor/BuildProcessors/CheckSettings.cs @@ -56,6 +56,11 @@ namespace HybridCLR.Editor.BuildProcessors 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; if (((gs.hotUpdateAssemblies?.Length + gs.hotUpdateAssemblyDefinitions?.Length) ?? 0) == 0) { diff --git a/Editor/Installer/InstallerController.cs b/Editor/Installer/InstallerController.cs index 768515f..c44186f 100644 --- a/Editor/Installer/InstallerController.cs +++ b/Editor/Installer/InstallerController.cs @@ -27,12 +27,15 @@ namespace HybridCLR.Editor.Installer public string PackageVersion { get; private set; } + public string InstalledLibil2cppVersion { get; private set; } + public InstallerController() { _curVersion = ParseUnityVersion(Application.unityVersion); _versionManifest = GetHybridCLRVersionManifest(); _curDefaultVersion = _versionManifest.versions.FirstOrDefault(v => v.unity_version == _curVersion.major.ToString()); PackageVersion = LoadPackageInfo().version; + InstalledLibil2cppVersion = ReadLocalVersion(); } private HybridclrVersionManifest GetHybridCLRVersionManifest() @@ -157,6 +160,23 @@ namespace HybridCLR.Editor.Installer 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() { InstallFromLocal(PrepareLibil2cppWithHybridclrFromGitRepo()); @@ -237,6 +257,7 @@ namespace HybridCLR.Editor.Installer if (HasInstalledHybridCLR()) { + WriteLocalVersion(); Debug.Log("Install Sucessfully"); } else diff --git a/Editor/Installer/InstallerWindow.cs b/Editor/Installer/InstallerWindow.cs index f1a2b62..178db1e 100644 --- a/Editor/Installer/InstallerWindow.cs +++ b/Editor/Installer/InstallerWindow.cs @@ -46,7 +46,9 @@ namespace HybridCLR.Editor.Installer EditorGUILayout.LabelField($"Package Version: v{_controller.PackageVersion}"); GUILayout.Space(5f); - + EditorGUILayout.LabelField($"Installed libil2cpp Version: {_controller.InstalledLibil2cppVersion ?? "Unknown"}"); + GUILayout.Space(5f); + GUILayout.Space(10f); InstallerController.CompatibleType compatibleType = _controller.GetCompatibleType();