commit
3c280ba80b
|
@ -30,10 +30,12 @@ namespace HybridCLR.Editor.Commands
|
||||||
|
|
||||||
var gs = SettingsUtil.GlobalSettings;
|
var gs = SettingsUtil.GlobalSettings;
|
||||||
|
|
||||||
|
using (AssemblyReferenceDeepCollector collector = new AssemblyReferenceDeepCollector(MetaUtil.CreateBuildTargetAssemblyResolver(EditorUserBuildSettings.activeBuildTarget), SettingsUtil.HotUpdateAssemblyNames))
|
||||||
|
{
|
||||||
var analyzer = new Analyzer(new Analyzer.Options
|
var analyzer = new Analyzer(new Analyzer.Options
|
||||||
{
|
{
|
||||||
MaxIterationCount = Math.Min(20, gs.maxGenericReferenceIteration),
|
MaxIterationCount = Math.Min(20, gs.maxGenericReferenceIteration),
|
||||||
Collector = new AssemblyReferenceDeepCollector(MetaUtil.CreateBuildTargetAssemblyResolver(EditorUserBuildSettings.activeBuildTarget), SettingsUtil.HotUpdateAssemblyNames),
|
Collector = collector,
|
||||||
});
|
});
|
||||||
|
|
||||||
analyzer.Run();
|
analyzer.Run();
|
||||||
|
@ -44,3 +46,4 @@ namespace HybridCLR.Editor.Commands
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -72,10 +72,13 @@ namespace HybridCLR.Editor.Commands
|
||||||
{
|
{
|
||||||
CompileDllCommand.CompileDllActiveBuildTarget();
|
CompileDllCommand.CompileDllActiveBuildTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using (AssemblyReferenceDeepCollector collector = new AssemblyReferenceDeepCollector(MetaUtil.CreateBuildTargetAssemblyResolver(EditorUserBuildSettings.activeBuildTarget), SettingsUtil.HotUpdateAssemblyNames))
|
||||||
|
{
|
||||||
var analyzer = new Analyzer(new Analyzer.Options
|
var analyzer = new Analyzer(new Analyzer.Options
|
||||||
{
|
{
|
||||||
MaxIterationCount = Math.Min(20, SettingsUtil.GlobalSettings.maxMethodBridgeGenericIteration),
|
MaxIterationCount = Math.Min(20, SettingsUtil.GlobalSettings.maxMethodBridgeGenericIteration),
|
||||||
Collector = new AssemblyReferenceDeepCollector(MetaUtil.CreateBuildTargetAssemblyResolver(EditorUserBuildSettings.activeBuildTarget), SettingsUtil.HotUpdateAssemblyNames),
|
Collector = collector,
|
||||||
});
|
});
|
||||||
|
|
||||||
analyzer.Run();
|
analyzer.Run();
|
||||||
|
@ -99,5 +102,7 @@ namespace HybridCLR.Editor.Commands
|
||||||
}
|
}
|
||||||
Task.WaitAll(tasks.ToArray());
|
Task.WaitAll(tasks.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,8 @@ namespace HybridCLR.Editor.Link
|
||||||
|
|
||||||
public HashSet<TypeRef> CollectRefs(List<Assembly> rootAssemblies)
|
public HashSet<TypeRef> CollectRefs(List<Assembly> rootAssemblies)
|
||||||
{
|
{
|
||||||
var assCollector = new AssemblyCache(_resolver);
|
using (var assCollector = new AssemblyCache(_resolver))
|
||||||
|
{
|
||||||
var rootAssemblyName = new HashSet<string>();
|
var rootAssemblyName = new HashSet<string>();
|
||||||
foreach (var ass in rootAssemblies)
|
foreach (var ass in rootAssemblies)
|
||||||
{
|
{
|
||||||
|
@ -43,7 +44,9 @@ namespace HybridCLR.Editor.Link
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
assCollector.Dispose();
|
||||||
return typeRefs;
|
return typeRefs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -9,11 +9,12 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace HybridCLR.Editor.Meta
|
namespace HybridCLR.Editor.Meta
|
||||||
{
|
{
|
||||||
public class AssemblyCache
|
public class AssemblyCache : IDisposable
|
||||||
{
|
{
|
||||||
private readonly IAssemblyResolver _assemblyPathResolver;
|
private readonly IAssemblyResolver _assemblyPathResolver;
|
||||||
private readonly ModuleContext _modCtx;
|
private readonly ModuleContext _modCtx;
|
||||||
private readonly AssemblyResolver _asmResolver;
|
private readonly AssemblyResolver _asmResolver;
|
||||||
|
private bool disposedValue;
|
||||||
|
|
||||||
public Dictionary<string, ModuleDefMD> LoadedModules { get; } = new Dictionary<string, ModuleDefMD>();
|
public Dictionary<string, ModuleDefMD> LoadedModules { get; } = new Dictionary<string, ModuleDefMD>();
|
||||||
|
|
||||||
|
@ -51,5 +52,26 @@ namespace HybridCLR.Editor.Meta
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (!disposedValue)
|
||||||
|
{
|
||||||
|
if (disposing)
|
||||||
|
{
|
||||||
|
foreach(var mod in LoadedModules.Values)
|
||||||
|
{
|
||||||
|
mod.Dispose();
|
||||||
|
}
|
||||||
|
LoadedModules.Clear();
|
||||||
|
}
|
||||||
|
disposedValue = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
Dispose(disposing: true);
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,13 +9,14 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace HybridCLR.Editor.Meta
|
namespace HybridCLR.Editor.Meta
|
||||||
{
|
{
|
||||||
public class AssemblyReferenceDeepCollector
|
public class AssemblyReferenceDeepCollector : IDisposable
|
||||||
{
|
{
|
||||||
private readonly IAssemblyResolver _assemblyPathResolver;
|
private readonly IAssemblyResolver _assemblyPathResolver;
|
||||||
private readonly List<string> _rootAssemblies;
|
private readonly List<string> _rootAssemblies;
|
||||||
|
|
||||||
private readonly ModuleContext _modCtx;
|
private readonly ModuleContext _modCtx;
|
||||||
private readonly AssemblyResolver _asmResolver;
|
private readonly AssemblyResolver _asmResolver;
|
||||||
|
private bool disposedValue;
|
||||||
|
|
||||||
public Dictionary<string, ModuleDefMD> LoadedModules { get; } = new Dictionary<string, ModuleDefMD>();
|
public Dictionary<string, ModuleDefMD> LoadedModules { get; } = new Dictionary<string, ModuleDefMD>();
|
||||||
|
|
||||||
|
@ -78,5 +79,26 @@ namespace HybridCLR.Editor.Meta
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (!disposedValue)
|
||||||
|
{
|
||||||
|
if (disposing)
|
||||||
|
{
|
||||||
|
foreach(var mod in LoadedModules.Values)
|
||||||
|
{
|
||||||
|
mod.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LoadedModules.Clear();
|
||||||
|
disposedValue = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
Dispose(disposing: true);
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "com.focus-creative-games.hybridclr_unity",
|
"name": "com.focus-creative-games.hybridclr_unity",
|
||||||
"version": "0.2.1",
|
"version": "0.3.0",
|
||||||
"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",
|
||||||
|
|
Loading…
Reference in New Issue