PrebuildCommand.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using UnityEditor;
  7. namespace HybridCLR.Editor.Commands
  8. {
  9. public static class PrebuildCommand
  10. {
  11. /// <summary>
  12. /// 按照必要的顺序,执行所有生成操作,适合打包前操作
  13. /// </summary>
  14. [MenuItem("HybridCLR/Generate/All", priority = 200)]
  15. public static void GenerateAll()
  16. {
  17. BuildTarget target = EditorUserBuildSettings.activeBuildTarget;
  18. CompileDllCommand.CompileDll(target);
  19. Il2CppDefGeneratorCommand.GenerateIl2CppDef();
  20. // 这几个生成依赖HotUpdateDlls
  21. LinkGeneratorCommand.GenerateLinkXml(target);
  22. // 生成裁剪后的aot dll
  23. StripAOTDllCommand.GenerateStripedAOTDlls(target, EditorUserBuildSettings.selectedBuildTargetGroup);
  24. // 桥接函数生成依赖于AOT dll,必须保证已经build过,生成AOT dll
  25. MethodBridgeGeneratorCommand.GenerateMethodBridge(target);
  26. ReversePInvokeWrapperGeneratorCommand.GenerateReversePInvokeWrapper(target);
  27. AOTReferenceGeneratorCommand.GenerateAOTGenericReference(target);
  28. }
  29. }
  30. }