123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using System.IO;
- using UnityEditor;
- using UnityEngine;
- using HybridCLR;
- namespace GFGEditor
- {
- public static class DllHelper
- {
- public static void BuildDll(string codeDir, BuildTarget target)
- {
- Directory.CreateDirectory(codeDir);
- CompileDllHelper.CompileDll(target);
- string hotfixDllSrcDir = BuildConfig.GetHotFixDllsOutputDirByTarget(target);
- foreach (var dll in BuildConfig.AllHotUpdateDllNames)
- {
- string dllPath = $"{hotfixDllSrcDir}/{dll}";
- string dllBytesPath = $"{codeDir}/{dll}.bytes";
- File.Copy(dllPath, dllBytesPath, true);
- }
- AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
- }
- public static void CopyAOTDll(string codeDir, BuildTarget target)
- {
- Directory.CreateDirectory(codeDir);
- string aotDllDir = BuildConfig.GetAssembliesPostIl2CppStripDir(target);
- foreach (var dll in BuildConfig.AOTMetaDlls)
- {
- string dllPath = $"{aotDllDir}/{dll}";
- if (!File.Exists(dllPath))
- {
- Debug.LogError($"ab中添加AOT补充元数据dll:{dllPath} 时发生错误,文件不存在。裁剪后的AOT dll在BuildPlayer时才能生成,因此需要你先构建一次游戏App后再打包。");
- continue;
- }
- string dllBytesPath = $"{codeDir}/{dll}.bytes";
- File.Copy(dllPath, dllBytesPath, true);
- }
- AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
- }
- }
- }
|