From a9f5608ecfb3ac28390691e574ffd4c92358e0eb Mon Sep 17 00:00:00 2001 From: walon Date: Fri, 21 Jul 2023 18:05:12 +0800 Subject: [PATCH] =?UTF-8?q?[change]=20=E6=A3=80=E6=9F=A5Settings=E4=B8=AD?= =?UTF-8?q?=E7=83=AD=E6=9B=B4=E6=96=B0=E7=A8=8B=E5=BA=8F=E9=9B=86=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E9=85=8D=E7=BD=AE=E4=B8=AD=E7=A8=8B=E5=BA=8F=E9=9B=86?= =?UTF-8?q?=E5=90=8D=E4=B8=8D=E8=83=BD=E4=B8=BA=E7=A9=BA=20[fix]=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BD=93=E6=9F=90=E4=B8=AA=E7=83=AD=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E7=A8=8B=E5=BA=8F=E9=9B=86=E6=AD=A3=E5=A5=BD=E6=98=AF?= =?UTF-8?q?=E5=8F=A6=E4=B8=80=E4=B8=AAAOT=E7=A8=8B=E5=BA=8F=E9=9B=86?= =?UTF-8?q?=E5=90=8E=E7=BC=80=E6=97=B6=EF=BC=8C=E7=94=B1=E4=BA=8E=E5=8F=AA?= =?UTF-8?q?=E5=AF=B9=E6=AF=94=E5=AD=97=E7=AC=A6=E4=B8=B2=E5=B0=BE=E9=83=A8?= =?UTF-8?q?=EF=BC=8C=E6=84=8F=E5=A4=96=E5=B0=86=E8=AF=A5AOT=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E9=9B=86=E4=B9=9F=E8=BF=87=E6=BB=A4=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BuildProcessors/FilterHotFixAssemblies.cs | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/Editor/BuildProcessors/FilterHotFixAssemblies.cs b/Editor/BuildProcessors/FilterHotFixAssemblies.cs index e18f075..08bb825 100644 --- a/Editor/BuildProcessors/FilterHotFixAssemblies.cs +++ b/Editor/BuildProcessors/FilterHotFixAssemblies.cs @@ -1,6 +1,7 @@ using HybridCLR.Editor.Meta; using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -25,15 +26,18 @@ namespace HybridCLR.Editor.BuildProcessors return assemblies; } List allHotUpdateDllNames = SettingsUtil.HotUpdateAssemblyNamesExcludePreserved; - List allHotupdateDllFiles = SettingsUtil.HotUpdateAssemblyFilesExcludePreserved; // 检查是否重复填写 var hotUpdateDllSet = new HashSet(); foreach(var hotUpdateDll in allHotUpdateDllNames) { + if (string.IsNullOrWhiteSpace(hotUpdateDll)) + { + throw new BuildFailedException($"热更新 assembly 名不能为空"); + } if (!hotUpdateDllSet.Add(hotUpdateDll)) { - throw new Exception($"热更新 assembly:{hotUpdateDll} 在列表中重复,请除去重复条目"); + throw new BuildFailedException($"热更新 assembly:{hotUpdateDll} 在列表中重复,请除去重复条目"); } } @@ -41,16 +45,24 @@ namespace HybridCLR.Editor.BuildProcessors // 检查是否填写了正确的dll名称 foreach (var hotUpdateDllName in allHotUpdateDllNames) { - string hotUpdateDllFile = hotUpdateDllName + ".dll"; - if (assemblies.All(ass => !ass.EndsWith(hotUpdateDllFile)) && string.IsNullOrEmpty(assResolver.ResolveAssembly(hotUpdateDllName, false))) + if (assemblies.Select(Path.GetFileNameWithoutExtension).All(ass => ass != hotUpdateDllName) + && string.IsNullOrEmpty(assResolver.ResolveAssembly(hotUpdateDllName, false))) { - throw new Exception($"热更新 assembly:{hotUpdateDllFile} 不存在,请检查拼写错误"); + throw new BuildFailedException($"热更新 assembly:{hotUpdateDllName} 不存在,请检查拼写错误"); } - Debug.Log($"[FilterHotFixAssemblies] 过滤热更新assembly:{hotUpdateDllFile}"); } - + // 将热更dll从打包列表中移除 - return assemblies.Where(ass => allHotupdateDllFiles.All(dll => !ass.EndsWith(dll, StringComparison.OrdinalIgnoreCase))).ToArray(); + return assemblies.Where(ass => + { + string assName = Path.GetFileNameWithoutExtension(ass); + bool reserved = allHotUpdateDllNames.All(dll => !assName.Equals(dll, StringComparison.Ordinal)); + if (!reserved) + { + Debug.Log($"[FilterHotFixAssemblies] 过滤热更新assembly:{assName}"); + } + return reserved; + }).ToArray(); } } }