[opt] 优化link.xml生成,只加载热更新dll,不再加载它们依赖的其他dll

main
walon 2022-12-13 18:10:20 +08:00
parent c8acfef61d
commit b40d62e16e
3 changed files with 10 additions and 6 deletions

View File

@ -38,10 +38,10 @@ namespace HybridCLR.Editor.Link
var typeRefs = new HashSet<TypeRef>(TypeEqualityComparer.Instance); var typeRefs = new HashSet<TypeRef>(TypeEqualityComparer.Instance);
foreach (var rootAss in rootAssemblies) foreach (var rootAss in rootAssemblies)
{ {
var dnAss = assCollector.LoadModule(rootAss); var dnAss = assCollector.LoadModule(rootAss, _analyzeAssetType);
foreach (var type in dnAss.GetTypeRefs()) foreach (var type in dnAss.GetTypeRefs())
{ {
if (!rootAssemblyName.Contains(type.DefinitionAssembly.Name)) if (!rootAssemblyName.Contains(type.DefinitionAssembly.Name.ToString()))
{ {
typeRefs.Add(type); typeRefs.Add(type);
} }

View File

@ -27,7 +27,7 @@ namespace HybridCLR.Editor.Meta
_asmResolver.UseGAC = false; _asmResolver.UseGAC = false;
} }
public ModuleDefMD LoadModule(string moduleName) public ModuleDefMD LoadModule(string moduleName, bool loadReferenceAssemblies = true)
{ {
// Debug.Log($"load module:{moduleName}"); // Debug.Log($"load module:{moduleName}");
if (LoadedModules.TryGetValue(moduleName, out var mod)) if (LoadedModules.TryGetValue(moduleName, out var mod))
@ -37,10 +37,14 @@ namespace HybridCLR.Editor.Meta
mod = DoLoadModule(_assemblyPathResolver.ResolveAssembly(moduleName, true)); mod = DoLoadModule(_assemblyPathResolver.ResolveAssembly(moduleName, true));
LoadedModules.Add(moduleName, mod); LoadedModules.Add(moduleName, mod);
foreach (var refAsm in mod.GetAssemblyRefs()) if (loadReferenceAssemblies)
{ {
LoadModule(refAsm.Name); foreach (var refAsm in mod.GetAssemblyRefs())
{
LoadModule(refAsm.Name);
}
} }
return mod; return mod;
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "com.focus-creative-games.hybridclr_unity", "name": "com.focus-creative-games.hybridclr_unity",
"version": "1.1.11", "version": "1.1.12",
"displayName": "HybridCLR", "displayName": "HybridCLR",
"description": "Unity package for HybridCLR. It includes editor and runtime scripts and assets for HybridCLR", "description": "Unity package for HybridCLR. It includes editor and runtime scripts and assets for HybridCLR",
"category": "Runtime", "category": "Runtime",