HybirdCLRInjector

HybirdCLRInjector
This commit is contained in:
ALEXTANG
2022-08-29 14:54:19 +08:00
parent 072a117643
commit 702e29177e
4 changed files with 63 additions and 9 deletions

View File

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

View File

@@ -0,0 +1,42 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using HybridCLR.Editor;
using TEngine.Runtime;
using UnityEditor;
using UnityEngine;
namespace TEngine.Editor
{
/// <summary>
/// HybirdCLR 热更新 打包插入管线
/// </summary>
public static class HybirdCLRInjectorEditor
{
[TEngineBuilderInjector(BuilderInjectorMoment.BeforeCollect_AssetBundle)]
public static void BeforeCollectAssetBundle()
{
CompileDllHelper.CompileDllActiveBuildTarget();
Log.Warning("CompileDllHelper.CompileDllActiveBuildTarget()");
var target = EditorUserBuildSettings.activeBuildTarget;
var dllDir = Constant.Setting.AssetRootPath+"/Dll";
string hotfixDllSrcDir = BuildConfig.GetHotFixDllsOutputDirByTarget(target);
foreach (var dll in BuildConfig.HotUpdateAssemblies)
{
string dllPath = $"{hotfixDllSrcDir}/{dll}";
string dllBytesPath = $"{dllDir}/{dll}.bytes";
try
{
File.Copy(dllPath, dllBytesPath, true);
}
catch (Exception e)
{
Log.Fatal(e.Message);
}
}
}
}
}

View File

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

View File

@@ -1,11 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEditor;
using UnityEngine;
using System.Collections.Generic;
namespace HybridCLR.Editor
{
@@ -17,8 +10,8 @@ namespace HybridCLR.Editor
/// </summary>
public static List<string> HotUpdateAssemblies { get; } = new List<string>
{
"TEngine.Runtime.dll",
"HotFix.dll",
"HotFix2.dll",
};
public static List<string> AOTMetaAssemblies { get; } = new List<string>()