2022-09-22 08:56:07 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using UnityEditor;
|
2024-05-25 09:49:22 +08:00
|
|
|
|
using UnityEditor.Build;
|
2022-09-22 08:56:07 +08:00
|
|
|
|
|
|
|
|
|
namespace HybridCLR.Editor.Commands
|
|
|
|
|
{
|
|
|
|
|
public static class PrebuildCommand
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 按照必要的顺序,执行所有生成操作,适合打包前操作
|
|
|
|
|
/// </summary>
|
2022-09-23 14:26:28 +08:00
|
|
|
|
[MenuItem("HybridCLR/Generate/All", priority = 200)]
|
2022-09-22 08:56:07 +08:00
|
|
|
|
public static void GenerateAll()
|
|
|
|
|
{
|
2024-05-25 09:49:22 +08:00
|
|
|
|
var installer = new Installer.InstallerController();
|
|
|
|
|
if (!installer.HasInstalledHybridCLR())
|
|
|
|
|
{
|
|
|
|
|
throw new BuildFailedException($"You have not initialized HybridCLR, please install it via menu 'HybridCLR/Installer'");
|
|
|
|
|
}
|
2022-12-14 14:11:32 +08:00
|
|
|
|
BuildTarget target = EditorUserBuildSettings.activeBuildTarget;
|
|
|
|
|
CompileDllCommand.CompileDll(target);
|
2022-11-05 22:22:39 +08:00
|
|
|
|
Il2CppDefGeneratorCommand.GenerateIl2CppDef();
|
2022-09-22 08:56:07 +08:00
|
|
|
|
|
2022-12-14 14:11:32 +08:00
|
|
|
|
// 这几个生成依赖HotUpdateDlls
|
|
|
|
|
LinkGeneratorCommand.GenerateLinkXml(target);
|
2022-12-16 11:03:03 +08:00
|
|
|
|
|
|
|
|
|
// 生成裁剪后的aot dll
|
2023-09-05 16:47:28 +08:00
|
|
|
|
StripAOTDllCommand.GenerateStripedAOTDlls(target);
|
2022-09-22 08:56:07 +08:00
|
|
|
|
|
2022-12-14 14:11:32 +08:00
|
|
|
|
// 桥接函数生成依赖于AOT dll,必须保证已经build过,生成AOT dll
|
|
|
|
|
MethodBridgeGeneratorCommand.GenerateMethodBridge(target);
|
2022-12-16 11:03:03 +08:00
|
|
|
|
ReversePInvokeWrapperGeneratorCommand.GenerateReversePInvokeWrapper(target);
|
|
|
|
|
AOTReferenceGeneratorCommand.GenerateAOTGenericReference(target);
|
2022-09-22 08:56:07 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|