From 8d0634620a4c3a5a24b2903066b998f4f6d53fe1 Mon Sep 17 00:00:00 2001 From: walon Date: Sat, 20 May 2023 10:40:58 +0800 Subject: [PATCH] =?UTF-8?q?[new]=20HybridCLRSettings=E6=96=B0=E5=A2=9EAOT?= =?UTF-8?q?=20dll=E5=BF=AB=E7=85=A7=E7=9B=AE=E5=BD=95=EF=BC=8C=E7=94=B1?= =?UTF-8?q?=E4=BA=8E=E4=BF=9D=E5=AD=98=E6=89=93=E5=8C=85=E6=97=B6=E7=94=9F?= =?UTF-8?q?=E6=88=90=E7=9A=84AOT=20dlls?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Editor/Commands/StripAOTDllCommand.cs | 7 +++++++ Editor/Settings/HybridCLRSettingProvider.cs | 3 +++ Editor/Settings/HybridCLRSettings.cs | 7 +++++-- Editor/SettingsUtil.cs | 5 +++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Editor/Commands/StripAOTDllCommand.cs b/Editor/Commands/StripAOTDllCommand.cs index fed8c6d..4028e8c 100644 --- a/Editor/Commands/StripAOTDllCommand.cs +++ b/Editor/Commands/StripAOTDllCommand.cs @@ -12,6 +12,13 @@ namespace HybridCLR.Editor.Commands { public static class StripAOTDllCommand { + [MenuItem("HybridCLR/CreateAOTDllSnapshot", priority = 201)] + public static void CreateAOTDllSnapshot() + { + BuildTarget target = EditorUserBuildSettings.activeBuildTarget; + BashUtil.CopyDir(SettingsUtil.GetAssembliesPostIl2CppStripDir(target), SettingsUtil.GetAOTAssemblySnapshotDir(target), true); + } + [MenuItem("HybridCLR/Generate/AOTDlls", priority = 105)] public static void GenerateStripedAOTDlls() { diff --git a/Editor/Settings/HybridCLRSettingProvider.cs b/Editor/Settings/HybridCLRSettingProvider.cs index c869f80..471bfdf 100644 --- a/Editor/Settings/HybridCLRSettingProvider.cs +++ b/Editor/Settings/HybridCLRSettingProvider.cs @@ -19,6 +19,7 @@ namespace HybridCLR.Editor private SerializedProperty _hotUpdateDllCompileOutputRootDir; private SerializedProperty _externalHotUpdateAssembliyDirs; private SerializedProperty _strippedAOTDllOutputRootDir; + private SerializedProperty _strippedAOTDllSnapshotDir; private SerializedProperty _patchAOTAssemblies; private SerializedProperty _outputLinkFile; private SerializedProperty _outputAOTGenericReferenceFile; @@ -46,6 +47,7 @@ namespace HybridCLR.Editor _hotUpdateDllCompileOutputRootDir = _serializedObject.FindProperty("hotUpdateDllCompileOutputRootDir"); _externalHotUpdateAssembliyDirs = _serializedObject.FindProperty("externalHotUpdateAssembliyDirs"); _strippedAOTDllOutputRootDir = _serializedObject.FindProperty("strippedAOTDllOutputRootDir"); + _strippedAOTDllSnapshotDir = _serializedObject.FindProperty("strippedAOTDllSnapshotDir"); _patchAOTAssemblies = _serializedObject.FindProperty("patchAOTAssemblies"); _outputLinkFile = _serializedObject.FindProperty("outputLinkFile"); _outputAOTGenericReferenceFile = _serializedObject.FindProperty("outputAOTGenericReferenceFile"); @@ -134,6 +136,7 @@ namespace HybridCLR.Editor EditorGUILayout.PropertyField(_hotUpdateDllCompileOutputRootDir); EditorGUILayout.PropertyField(_externalHotUpdateAssembliyDirs); EditorGUILayout.PropertyField(_strippedAOTDllOutputRootDir); + EditorGUILayout.PropertyField(_strippedAOTDllSnapshotDir); EditorGUILayout.PropertyField(_patchAOTAssemblies); EditorGUILayout.PropertyField(_outputLinkFile); EditorGUILayout.PropertyField(_outputAOTGenericReferenceFile); diff --git a/Editor/Settings/HybridCLRSettings.cs b/Editor/Settings/HybridCLRSettings.cs index 0ec2fe0..9b861e1 100644 --- a/Editor/Settings/HybridCLRSettings.cs +++ b/Editor/Settings/HybridCLRSettings.cs @@ -32,8 +32,11 @@ namespace HybridCLR.Editor [Header("外部热更新dll搜索路径")] public string[] externalHotUpdateAssembliyDirs; - [Header("裁减后AOT dll输出根目录")] - public string strippedAOTDllOutputRootDir = "HybridCLRData/AssembliesPostIl2CppStrip"; + [Header("裁减后AOT dll的输出目录")] + public string strippedAOTDllOutputRootDir = "HybridCLRData/AOTDllOutput"; + + [Header("裁减后AOT dll的备份目录")] + public string strippedAOTDllSnapshotDir = "HybridCLRData/AOTDllSnapshot"; [Header("补充元数据AOT dlls")] public string[] patchAOTAssemblies; diff --git a/Editor/SettingsUtil.cs b/Editor/SettingsUtil.cs index 7a096f5..b8786ea 100644 --- a/Editor/SettingsUtil.cs +++ b/Editor/SettingsUtil.cs @@ -59,6 +59,11 @@ namespace HybridCLR.Editor return $"{AssembliesPostIl2CppStripDir}/{target}"; } + public static string GetAOTAssemblySnapshotDir(BuildTarget target) + { + return $"{HybridCLRSettings.Instance.strippedAOTDllSnapshotDir}/{target}"; + } + class AssemblyDefinitionData { public string name;