[change] 移除DHE相关代码

main
walon 2022-12-03 11:56:36 +08:00
parent bc6e285b92
commit e7fac5b0b8
10 changed files with 0 additions and 223 deletions

View File

@ -1,56 +0,0 @@
using HybridCLR.Editor.DHE;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEditor;
using UnityEngine;
namespace HybridCLR.Editor.Commands
{
public static class DifferentialHybridExecutionCommand
{
[MenuItem("HybridCLR/Generate/DHEAssemblyList", priority = 110)]
public static void GenerateAssemblyList()
{
var options = new AssemblyListGenerator.Options()
{
DifferentialHybridAssembyList = (HybridCLRSettings.Instance.differentialHybridAssemblies ?? Array.Empty<string>()).ToList(),
OutputFile = $"{SettingsUtil.LocalIl2CppDir}/libil2cpp/hybridclr/Il2CppCompatibleDef.cpp",
};
var g = new AssemblyListGenerator(options);
g.Generate();
}
[MenuItem("HybridCLR/Generate/DHEAssemblyOptionDatas", priority = 111)]
public static void GenerateAssemblyOptionDatas()
{
GenerateAssemblyOptionDatas(true);
}
public static void GenerateAssemblyOptionDatas(bool compileDll)
{
if (compileDll)
{
CompileDllCommand.CompileDllActiveBuildTarget();
}
string[] differentialHybridAssemblyList = HybridCLRSettings.Instance.differentialHybridAssemblies;
if (differentialHybridAssemblyList == null || differentialHybridAssemblyList.Length == 0)
{
Debug.Log("[DifferentialHybridExecutionCommand.GenerateAssemblyOptionDatas] differentialHybridAssemblies is empty. skip generation.");
return;
}
var options = new AssemblyOptionDataGenerator.Options()
{
DifferentialHybridAssembyList = differentialHybridAssemblyList.ToList(),
OutputDir = $"{SettingsUtil.ProjectDir}/{HybridCLRSettings.Instance.differentialHybridOptionOutputDir}",
};
var g = new AssemblyOptionDataGenerator(options);
g.Generate();
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 998b5f512dc60924e953a558ed250e15
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -16,8 +16,6 @@ namespace HybridCLR.Editor.Commands
public static void GenerateAll() public static void GenerateAll()
{ {
Il2CppDefGeneratorCommand.GenerateIl2CppDef(); Il2CppDefGeneratorCommand.GenerateIl2CppDef();
DifferentialHybridExecutionCommand.GenerateAssemblyList();
DifferentialHybridExecutionCommand.GenerateAssemblyOptionDatas();
// 顺序随意 // 顺序随意
ReversePInvokeWrapperGeneratorCommand.GenerateReversePInvokeWrapper(); ReversePInvokeWrapperGeneratorCommand.GenerateReversePInvokeWrapper();

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 1e6e11530acf7134796d0a439a6bbe61
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,44 +0,0 @@
using HybridCLR.Editor.Template;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using UnityEngine;
namespace HybridCLR.Editor.DHE
{
public class AssemblyListGenerator
{
public class Options
{
public string OutputFile { get; set; }
public List<string> DifferentialHybridAssembyList { get; set; }
}
private readonly Options _options;
public AssemblyListGenerator(Options options)
{
_options = options;
}
public void Generate()
{
var frr = new FileRegionReplace(File.ReadAllText(_options.OutputFile));
List<string> lines = new List<string>();
foreach (var ass in _options.DifferentialHybridAssembyList)
{
lines.Add($"\t\t\"{ass}\",");
}
frr.Replace("DHE", string.Join("\n", lines));
frr.Commit(_options.OutputFile);
Debug.Log($"output:{_options.OutputFile}");
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: d6be260bc9a8a40468a82b9ea49b89a1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,68 +0,0 @@
using dnlib.DotNet;
using HybridCLR.Editor.Commands;
using HybridCLR.Editor.Meta;
using HybridCLR.Runtime;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using UnityEditor;
using UnityEngine;
namespace HybridCLR.Editor.DHE
{
public class AssemblyOptionDataGenerator
{
public class Options
{
public string OutputDir { get; set; }
public List<string> DifferentialHybridAssembyList { get; set; }
}
private readonly Options _options;
public AssemblyOptionDataGenerator(Options options)
{
_options = options;
}
public void Generate()
{
foreach(string assName in _options.DifferentialHybridAssembyList)
{
using (var assCollector = new AssemblyCache(MetaUtil.CreateBuildTargetAssemblyResolver(EditorUserBuildSettings.activeBuildTarget)))
{
var ass = assCollector.LoadModule(assName);
var dhaOptions = new DifferentialHybridAssemblyOptions()
{
notChangeMethodTokens = new List<uint>(),
};
foreach (var type in ass.GetTypes())
{
foreach (var method in type.Methods)
{
var attr = method.CustomAttributes.Where(a => a.AttributeType.FullName == "HybridCLR.Runtime.UnchangedAttribute").FirstOrDefault();
if (attr != null)
{
if ((bool)attr.ConstructorArguments[0].Value)
{
dhaOptions.notChangeMethodTokens.Add(method.MDToken.Raw);
Debug.Log($"Unchanged method:{method.MDToken.Raw} {method}");
}
}
}
}
string outOptionFile = $"{_options.OutputDir}/{assName}.dhao.bytes";
File.WriteAllBytes(outOptionFile, dhaOptions.Marshal());
Debug.Log($"[AssemblyOptionDataGenerator] assembly:{ass} output:{outOptionFile}");
}
}
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 4a4eda50e51d72d499b439da236a8371
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -20,8 +20,6 @@ namespace HybridCLR.Editor
private SerializedProperty _externalHotUpdateAssembliyDirs; private SerializedProperty _externalHotUpdateAssembliyDirs;
private SerializedProperty _strippedAOTDllOutputRootDir; private SerializedProperty _strippedAOTDllOutputRootDir;
private SerializedProperty _patchAOTAssemblies; private SerializedProperty _patchAOTAssemblies;
private SerializedProperty _differentialHybridAssemblies;
private SerializedProperty _differentialHybridOptionOutputDir;
private SerializedProperty _collectAssetReferenceTypes; private SerializedProperty _collectAssetReferenceTypes;
private SerializedProperty _outputLinkFile; private SerializedProperty _outputLinkFile;
private SerializedProperty _outputAOTGenericReferenceFile; private SerializedProperty _outputAOTGenericReferenceFile;
@ -50,8 +48,6 @@ namespace HybridCLR.Editor
_externalHotUpdateAssembliyDirs = _serializedObject.FindProperty("externalHotUpdateAssembliyDirs"); _externalHotUpdateAssembliyDirs = _serializedObject.FindProperty("externalHotUpdateAssembliyDirs");
_strippedAOTDllOutputRootDir = _serializedObject.FindProperty("strippedAOTDllOutputRootDir"); _strippedAOTDllOutputRootDir = _serializedObject.FindProperty("strippedAOTDllOutputRootDir");
_patchAOTAssemblies = _serializedObject.FindProperty("patchAOTAssemblies"); _patchAOTAssemblies = _serializedObject.FindProperty("patchAOTAssemblies");
_differentialHybridAssemblies = _serializedObject.FindProperty("differentialHybridAssemblies");
_differentialHybridOptionOutputDir = _serializedObject.FindProperty("differentialHybridOptionOutputDir");
_collectAssetReferenceTypes = _serializedObject.FindProperty("collectAssetReferenceTypes"); _collectAssetReferenceTypes = _serializedObject.FindProperty("collectAssetReferenceTypes");
_outputLinkFile = _serializedObject.FindProperty("outputLinkFile"); _outputLinkFile = _serializedObject.FindProperty("outputLinkFile");
_outputAOTGenericReferenceFile = _serializedObject.FindProperty("outputAOTGenericReferenceFile"); _outputAOTGenericReferenceFile = _serializedObject.FindProperty("outputAOTGenericReferenceFile");
@ -141,8 +137,6 @@ namespace HybridCLR.Editor
EditorGUILayout.PropertyField(_externalHotUpdateAssembliyDirs); EditorGUILayout.PropertyField(_externalHotUpdateAssembliyDirs);
EditorGUILayout.PropertyField(_strippedAOTDllOutputRootDir); EditorGUILayout.PropertyField(_strippedAOTDllOutputRootDir);
EditorGUILayout.PropertyField(_patchAOTAssemblies); EditorGUILayout.PropertyField(_patchAOTAssemblies);
EditorGUILayout.PropertyField(_differentialHybridAssemblies);
EditorGUILayout.PropertyField(_differentialHybridOptionOutputDir);
EditorGUILayout.PropertyField(_collectAssetReferenceTypes); EditorGUILayout.PropertyField(_collectAssetReferenceTypes);
EditorGUILayout.PropertyField(_outputLinkFile); EditorGUILayout.PropertyField(_outputLinkFile);
EditorGUILayout.PropertyField(_outputAOTGenericReferenceFile); EditorGUILayout.PropertyField(_outputAOTGenericReferenceFile);

View File

@ -38,12 +38,6 @@ namespace HybridCLR.Editor
[Header("补充元数据AOT dlls")] [Header("补充元数据AOT dlls")]
public string[] patchAOTAssemblies; public string[] patchAOTAssemblies;
[Header("差分混合热更新 dlls")]
public string[] differentialHybridAssemblies;
[Header("差分混合热更新配置数据输出目录")]
public string differentialHybridOptionOutputDir = "HybridCLRData/DifferentialHybridOptionDatas";
[Header("生成link.xml时扫描asset中引用的类型")] [Header("生成link.xml时扫描asset中引用的类型")]
public bool collectAssetReferenceTypes; public bool collectAssetReferenceTypes;