[fix] 修复桥接函数遍历收集签名时,未等遍历完就结束执行,导致生成的桥接文件不完整的bug
parent
823877275c
commit
e3095ccc01
|
@ -37,6 +37,7 @@ namespace HybridCLR.Editor.Meta
|
|||
{
|
||||
return typeSig;
|
||||
}
|
||||
typeSig = typeSig.RemovePinnedAndModifiers();
|
||||
switch (typeSig.ElementType)
|
||||
{
|
||||
case ElementType.Ptr: return new PtrSig(Resolve(typeSig.Next));
|
||||
|
@ -64,7 +65,7 @@ namespace HybridCLR.Editor.Meta
|
|||
{
|
||||
GenericMVar genericVar = (GenericMVar)typeSig;
|
||||
var newSig = Resolve(methodArgsStack, genericVar.Number, true);
|
||||
if (newSig is null)
|
||||
if (newSig == null)
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
|
|
|
@ -42,6 +42,11 @@ namespace HybridCLR.Editor.Meta
|
|||
return _hashCode;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Method}|{string.Join(",", (IEnumerable<TypeSig>)KlassInst ?? Array.Empty<TypeSig>())}|{string.Join(",", (IEnumerable<TypeSig>)MethodInst ?? Array.Empty<TypeSig>())}";
|
||||
}
|
||||
|
||||
private int ComputHashCode()
|
||||
{
|
||||
int hash = MethodEqualityComparer.CompareDeclaringTypes.GetHashCode(Method);
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HybridCLR.Editor.Meta
|
||||
{
|
||||
public class UnityAOTAssemblyResolver : IAssemblyResolver
|
||||
{
|
||||
public string ResolveAssembly(string assemblyName, bool throwExIfNotFind)
|
||||
{
|
||||
//
|
||||
var assemblyFile = $"{UnityEditor.EditorApplication.applicationContentsPath}/MonoBleedingEdge/lib/mono/unityaot/{assemblyName}.dll";
|
||||
if (File.Exists(assemblyFile))
|
||||
{
|
||||
Debug.Log($"UnityAOTAssemblyResolver.ResolveAssembly:{assemblyFile}");
|
||||
return assemblyFile;
|
||||
}
|
||||
if (throwExIfNotFind)
|
||||
{
|
||||
throw new Exception($"resolve assembly:{assemblyName} fail");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 029bc0368e1ada342aa29a18d4fae879
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -30,7 +30,7 @@ namespace HybridCLR.Editor.Meta
|
|||
{
|
||||
if (Path.GetFileNameWithoutExtension(dll) == assemblyName && IsPluginDll(dll))
|
||||
{
|
||||
Debug.Log($"plugin:{dll}");
|
||||
Debug.Log($"UnityPluginAssemblyResolver.ResolveAssembly:{dll}");
|
||||
return dll;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace HybridCLR.Editor
|
|||
return typeSig;
|
||||
}
|
||||
var a = typeSig.RemovePinnedAndModifiers();
|
||||
switch (typeSig.ElementType)
|
||||
switch (a.ElementType)
|
||||
{
|
||||
case ElementType.Void: return corTypes.Void;
|
||||
case ElementType.Boolean: return corTypes.Byte;
|
||||
|
@ -87,6 +87,7 @@ namespace HybridCLR.Editor
|
|||
return new CombinedAssemblyResolver(new PathAssemblyResolver(
|
||||
SettingsUtil.GetHotUpdateDllsOutputDirByTarget(target)),
|
||||
new UnityPluginAssemblyResolver(),
|
||||
new UnityAOTAssemblyResolver(),
|
||||
new UnityEditorAssemblyResolver());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ namespace HybridCLR.Editor.MethodBridge
|
|||
}
|
||||
foreach (var method in typeDef.Methods)
|
||||
{
|
||||
// 对于带泛型的参数,统率泛型共享为object
|
||||
// 对于带泛型的参数,统一泛型共享为object
|
||||
_notGenericMethods.Add(method);
|
||||
}
|
||||
}
|
||||
|
@ -182,10 +182,10 @@ namespace HybridCLR.Editor.MethodBridge
|
|||
_newMethods = temp;
|
||||
_newMethods.Clear();
|
||||
|
||||
Task.WhenAll(_processingMethods.Select(method => Task.Run(() =>
|
||||
Task.WaitAll(_processingMethods.Select(method => Task.Run(() =>
|
||||
{
|
||||
_methodReferenceAnalyzer.WalkMethod(method.Method, method.KlassInst, method.MethodInst);
|
||||
})));
|
||||
})).ToArray());
|
||||
Debug.Log($"iteration:[{i}] allMethods:{_notGenericMethods.Count} genericClass:{_genericTypes.Count} genericMethods:{_genericMethods.Count} newMethods:{_newMethods.Count}");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "com.focus-creative-games.hybridclr_unity",
|
||||
"version": "0.4.0",
|
||||
"version": "0.4.1",
|
||||
"displayName": "HybridCLR",
|
||||
"description": "Unity package for HybridCLR. It includes editor and runtime scripts and assets for HybridCLR",
|
||||
"category": "Runtime",
|
||||
|
|
Loading…
Reference in New Issue