[new] add MethodBridge.cpp.tpl. MethodBridgeGeneratorCommand doesn't generate and override from same file
parent
dd8d812641
commit
208372e6af
|
|
@ -0,0 +1,32 @@
|
||||||
|
#include <codegen/il2cpp-codegen-metadata.h>
|
||||||
|
#if HYBRIDCLR_UNITY_2023_OR_NEW
|
||||||
|
#include <codegen/il2cpp-codegen.h>
|
||||||
|
#elif HYBRIDCLR_UNITY_2022
|
||||||
|
#include <codegen/il2cpp-codegen-il2cpp.h>
|
||||||
|
#elif HYBRIDCLR_UNITY_2020 || HYBRIDCLR_UNITY_2021
|
||||||
|
#include <codegen/il2cpp-codegen-common-big.h>
|
||||||
|
#else
|
||||||
|
#include <codegen/il2cpp-codegen-common.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "vm/ClassInlines.h"
|
||||||
|
#include "vm/Object.h"
|
||||||
|
#include "vm/Class.h"
|
||||||
|
#include "vm/ScopedThreadAttacher.h"
|
||||||
|
|
||||||
|
#include "../metadata/MetadataUtil.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "../interpreter/InterpreterModule.h"
|
||||||
|
#include "../interpreter/MethodBridge.h"
|
||||||
|
#include "../interpreter/Interpreter.h"
|
||||||
|
#include "../interpreter/MemoryUtil.h"
|
||||||
|
#include "../interpreter/InstrinctDef.h"
|
||||||
|
|
||||||
|
using namespace hybridclr::interpreter;
|
||||||
|
using namespace hybridclr::metadata;
|
||||||
|
|
||||||
|
//!!!{{CODE
|
||||||
|
|
||||||
|
|
||||||
|
//!!!}}CODE
|
||||||
|
|
@ -31,9 +31,9 @@ namespace HybridCLR.Editor.Commands
|
||||||
Directory.Delete(il2cppBuildCachePath, true);
|
Directory.Delete(il2cppBuildCachePath, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void GenerateMethodBridgeCppFile(IReadOnlyCollection<GenericMethod> genericMethods, List<RawReversePInvokeMethodInfo> reversePInvokeMethods, IReadOnlyCollection<RawCalliMethodSignatureInfo> calliMethodSignatures, string outputFile)
|
private static void GenerateMethodBridgeCppFile(IReadOnlyCollection<GenericMethod> genericMethods, List<RawReversePInvokeMethodInfo> reversePInvokeMethods, IReadOnlyCollection<RawCalliMethodSignatureInfo> calliMethodSignatures, string tempFile, string outputFile)
|
||||||
{
|
{
|
||||||
string templateCode = File.ReadAllText(outputFile, Encoding.UTF8);
|
string templateCode = File.ReadAllText(tempFile, Encoding.UTF8);
|
||||||
var g = new Generator(new Generator.Options()
|
var g = new Generator(new Generator.Options()
|
||||||
{
|
{
|
||||||
TemplateCode = templateCode,
|
TemplateCode = templateCode,
|
||||||
|
|
@ -84,9 +84,10 @@ namespace HybridCLR.Editor.Commands
|
||||||
var calliAnalyzer = new CalliAnalyzer(cache, hotUpdateDlls);
|
var calliAnalyzer = new CalliAnalyzer(cache, hotUpdateDlls);
|
||||||
calliAnalyzer.Run();
|
calliAnalyzer.Run();
|
||||||
|
|
||||||
|
string templateFile = $"{SettingsUtil.TemplatePathInPackage}/MethodBridge.cpp.tpl";
|
||||||
string outputFile = $"{SettingsUtil.GeneratedCppDir}/MethodBridge.cpp";
|
string outputFile = $"{SettingsUtil.GeneratedCppDir}/MethodBridge.cpp";
|
||||||
|
|
||||||
GenerateMethodBridgeCppFile(methodBridgeAnalyzer.GenericMethods, reversePInvokeAnalyzer.ReversePInvokeMethods, calliAnalyzer.CalliMethodSignatures, outputFile);
|
GenerateMethodBridgeCppFile(methodBridgeAnalyzer.GenericMethods, reversePInvokeAnalyzer.ReversePInvokeMethods, calliAnalyzer.CalliMethodSignatures, templateFile, outputFile);
|
||||||
|
|
||||||
CleanIl2CppBuildCache();
|
CleanIl2CppBuildCache();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue