[refactor] 重构并且修复了Generate相关Assembly Resolve潜在的bug。

[opt] 优化 PrebuildCommand.Build 中多次编译热更新dll的问题,大幅缩短了时间。
This commit is contained in:
walon
2022-12-14 14:11:32 +08:00
parent 947b15e7d9
commit 00f94335c3
20 changed files with 154 additions and 244 deletions
+6 -8
View File
@@ -8,7 +8,7 @@ using UnityEngine;
namespace HybridCLR.Editor.Meta
{
public class PathAssemblyResolver : IAssemblyResolver
public class PathAssemblyResolver : AssemblyResolverBase
{
private readonly string[] _searchPaths;
public PathAssemblyResolver(params string[] searchPaths)
@@ -16,7 +16,7 @@ namespace HybridCLR.Editor.Meta
_searchPaths = searchPaths;
}
public string ResolveAssembly(string assemblyName, bool throwExIfNotFind)
protected override bool TryResolveAssembly(string assemblyName, out string assemblyPath)
{
foreach(var path in _searchPaths)
{
@@ -24,14 +24,12 @@ namespace HybridCLR.Editor.Meta
if (File.Exists(assPath))
{
Debug.Log($"resolve {assemblyName} at {assPath}");
return assPath;
assemblyPath = assPath;
return true;
}
}
if (throwExIfNotFind)
{
throw new Exception($"resolve assembly:{assemblyName} fail");
}
return null;
assemblyPath = null;
return false;
}
}
}