diff --git a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs index 16c2673ff..0e0e396fa 100644 --- a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs +++ b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs @@ -46,8 +46,8 @@ namespace Flax.Build.Bindings public static event Action, StringBuilder> GenerateCppBinaryModuleHeader; public static event Action, StringBuilder> GenerateCppBinaryModuleSource; public static event Action GenerateCppModuleSource; - public static event Action GenerateCppClassInternals; - public static event Action GenerateCppClassInitRuntime; + public static event Action GenerateCppTypeInternals; + public static event Action GenerateCppTypeInitRuntime; public static event Action GenerateCppScriptWrapperFunction; private static readonly List CppInBuildVariantStructures = new List @@ -1751,7 +1751,7 @@ namespace Flax.Build.Bindings } } - GenerateCppClassInternals?.Invoke(buildData, classInfo, contents); + GenerateCppTypeInternals?.Invoke(buildData, classInfo, contents); // Virtual methods overrides var setupScriptVTable = GenerateCppScriptVTable(buildData, contents, classInfo); @@ -1774,7 +1774,7 @@ namespace Flax.Build.Bindings contents.AppendLine($" ADD_INTERNAL_CALL(\"{classTypeNameManagedInternalCall}::Internal_{e.Key}\", &{e.Value});"); } } - GenerateCppClassInitRuntime?.Invoke(buildData, classInfo, contents); + GenerateCppTypeInitRuntime?.Invoke(buildData, classInfo, contents); contents.AppendLine(" }").AppendLine(); @@ -1915,6 +1915,8 @@ namespace Flax.Build.Bindings throw new NotImplementedException($"TODO: add support for API functions in structures (function {functionInfo} in structure {structureInfo.Name})"); //GenerateCppWrapperFunction(buildData, contents, structureInfo, functionInfo); } + + GenerateCppTypeInternals?.Invoke(buildData, structureInfo, contents); contents.AppendLine(" static void InitRuntime()"); contents.AppendLine(" {"); @@ -1926,6 +1928,7 @@ namespace Flax.Build.Bindings contents.AppendLine($" ADD_INTERNAL_CALL(\"{structureTypeNameManagedInternalCall}::Internal_{e.Key}\", &{e.Value});"); } } + GenerateCppTypeInitRuntime?.Invoke(buildData, structureInfo, contents); contents.AppendLine(" }").AppendLine(); @@ -2149,7 +2152,7 @@ namespace Flax.Build.Bindings contents.Append('{').AppendLine(); contents.AppendLine("public:"); - GenerateCppClassInternals?.Invoke(buildData, interfaceInfo, contents); + GenerateCppTypeInternals?.Invoke(buildData, interfaceInfo, contents); // Virtual methods overrides var setupScriptVTable = GenerateCppScriptVTable(buildData, contents, interfaceInfo); @@ -2157,7 +2160,7 @@ namespace Flax.Build.Bindings // Runtime initialization (internal methods binding) contents.AppendLine(" static void InitRuntime()"); contents.AppendLine(" {"); - GenerateCppClassInitRuntime?.Invoke(buildData, interfaceInfo, contents); + GenerateCppTypeInitRuntime?.Invoke(buildData, interfaceInfo, contents); contents.AppendLine(" }").AppendLine(); // Interface implementation wrapper accessor for scripting types diff --git a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.cs b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.cs index a299c0e26..9da0665b7 100644 --- a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.cs +++ b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.cs @@ -43,9 +43,13 @@ namespace Flax.Build.Bindings } public delegate void GenerateModuleBindingsDelegate(BuildData buildData, IGrouping binaryModule); + public delegate void GenerateBinaryModuleBindingsDelegate(BuildData buildData, ModuleInfo moduleInfo, ref BindingsResult bindings); + public delegate void ParseTypeTagDelegate(ref bool valid, TagParameter tag, ApiTypeInfo typeInfo); + public delegate void ParseMemberTagDelegate(ref bool valid, TagParameter tag, MemberInfo memberInfo); + public delegate void ParseFunctionParameterTagDelegate(ref bool valid, TagParameter tag, ref FunctionInfo.ParameterInfo parameterInfo); public static event GenerateModuleBindingsDelegate GenerateModuleBindings; @@ -87,6 +91,8 @@ namespace Flax.Build.Bindings }; if (string.IsNullOrEmpty(moduleInfo.Name)) throw new Exception("Module name cannot be empty."); + if (module.Tags != null && module.Tags.Count != 0) + moduleInfo.Tags = new Dictionary(module.Tags); buildData.ModulesInfo.Add(module, moduleInfo); // Skip for modules that cannot have API bindings diff --git a/Source/Tools/Flax.Build/Build/Module.cs b/Source/Tools/Flax.Build/Build/Module.cs index ee67c0db0..946015e21 100644 --- a/Source/Tools/Flax.Build/Build/Module.cs +++ b/Source/Tools/Flax.Build/Build/Module.cs @@ -47,6 +47,11 @@ namespace Flax.Build /// public bool Deploy = true; + /// + /// Custom module tags. Used by plugins and external tools. + /// + public Dictionary Tags = new Dictionary(); + /// /// Initializes a new instance of the class. ///