【调整】名称调整,统一 pb => protobuf
【特性】新增 gen_types 类型 code_template,可以自定义新的模板目录了,新增配合的命令行选项 --template:code:dir 【调整】模板参数名调整。 data_template_name => template:data:file, output_compact_json => output:data:compact_json 【修复】修复protobuf生成错误设置 language为lua的bugmain
parent
93595c7748
commit
83f81ed463
|
|
@ -198,7 +198,7 @@ namespace Luban.Job.Cfg.Defs
|
|||
{
|
||||
LoadCommon(defines, agent, args);
|
||||
|
||||
OutputCompactJson = args.OutputCompactJson;
|
||||
OutputCompactJson = args.OutputDataCompactJson;
|
||||
|
||||
SupportDatetimeType = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@ namespace Luban.Job.Cfg
|
|||
{
|
||||
public class GenArgs : GenArgsBase
|
||||
{
|
||||
[Option('s', "service", Required = true, HelpText = "service")]
|
||||
public string Service { get; set; }
|
||||
|
||||
[Option("input_data_dir", Required = true, HelpText = "input data dir")]
|
||||
public string InputDataDir { get; set; }
|
||||
|
||||
|
|
@ -23,23 +26,23 @@ namespace Luban.Job.Cfg
|
|||
[Option("output_data_json_monolithic_file", Required = false, HelpText = "output monolithic json file")]
|
||||
public string OutputDataJsonMonolithicFile { get; set; }
|
||||
|
||||
[Option("gen_types", Required = true, HelpText = "code_cs_bin,code_cs_json,code_cs_unity_json,code_lua_bin,code_java_bin,code_java_json,code_go_bin,code_go_json,code_cpp_bin,code_python3_json,code_typescript_bin,code_typescript_json,code_rust_json,code_protobuf,data_bin,data_lua,data_json,data_json2,data_json_monolithic,data_resources,data_template,data_protobuf,convert_json,convert_lua,convert_xlsx . can be multi")]
|
||||
[Option("gen_types", Required = true, HelpText = "code_cs_bin,code_cs_json,code_cs_unity_json,code_lua_bin,code_java_bin,code_java_json,code_go_bin,code_go_json,code_cpp_bin,code_python3_json,code_typescript_bin,code_typescript_json,code_rust_json,code_protobuf,code_template,data_bin,data_lua,data_json,data_json2,data_json_monolithic,data_resources,data_template,data_protobuf,convert_json,convert_lua,convert_xlsx . can be multi")]
|
||||
public string GenType { get; set; }
|
||||
|
||||
[Option("template_name", Required = false, HelpText = "template name. use with gen_types=data_template")]
|
||||
public string TemplateName { get; set; }
|
||||
[Option("template:data:file", Required = false, HelpText = "template name. use with gen_types=data_template")]
|
||||
public string TemplateDataFile { get; set; }
|
||||
|
||||
[Option("data_file_extension", Required = false, HelpText = "data file name extension. default choose by gen_type")]
|
||||
public string DataFileExtension { get; set; }
|
||||
[Option("template:code:dir", Required = false, HelpText = "code template dir. use with gen_types=code_template")]
|
||||
public string TemplateCodeDir { get; set; }
|
||||
|
||||
[Option("output_compact_json", Required = false, HelpText = "output compact json data. drop blank characters. ")]
|
||||
public bool OutputCompactJson { get; set; }
|
||||
[Option("output:data:file_extension", Required = false, HelpText = "data file name extension. default choose by gen_type")]
|
||||
public string OutputDataFileExtension { get; set; }
|
||||
|
||||
[Option('s', "service", Required = true, HelpText = "service")]
|
||||
public string Service { get; set; }
|
||||
[Option("output:data:compact_json", Required = false, HelpText = "output compact json data. drop blank characters. ")]
|
||||
public bool OutputDataCompactJson { get; set; }
|
||||
|
||||
[Option("export_exclude_tags", Required = false, HelpText = "export exclude tags. default export all tags")]
|
||||
public string ExportExcludeTags { get; set; } = "";
|
||||
[Option("output:exclude_tags", Required = false, HelpText = "export exclude tags. default export all tags")]
|
||||
public string OutputExcludeTags { get; set; } = "";
|
||||
|
||||
[Option("l10n:timezone", Required = false, HelpText = "timezone")]
|
||||
public string L10nTimeZone { get; set; }
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using Luban.Job.Common.Defs;
|
|||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using FileInfo = Luban.Common.Protos.FileInfo;
|
||||
|
||||
|
|
@ -13,6 +14,10 @@ namespace Luban.Job.Cfg
|
|||
{
|
||||
class GenContext
|
||||
{
|
||||
private readonly static AsyncLocal<GenContext> s_asyncLocal = new();
|
||||
|
||||
public static GenContext Ctx { get => s_asyncLocal.Value; set => s_asyncLocal.Value = value; }
|
||||
|
||||
public GenArgs GenArgs { get; init; }
|
||||
public DefAssembly Assembly { get; init; }
|
||||
public string GenType { get; set; }
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using Luban.Common.Protos;
|
||||
using Luban.Job.Cfg.Defs;
|
||||
using Luban.Job.Common;
|
||||
using Luban.Job.Common.Defs;
|
||||
using Luban.Job.Common.Utils;
|
||||
using System;
|
||||
|
|
@ -29,11 +30,16 @@ namespace Luban.Job.Cfg.Generate
|
|||
}
|
||||
}
|
||||
|
||||
protected virtual ELanguage GetLanguage(GenContext ctx)
|
||||
{
|
||||
return RenderFileUtil.GetLanguage(ctx.GenType);
|
||||
}
|
||||
|
||||
protected void GenerateCodeScatter(GenContext ctx)
|
||||
{
|
||||
string genType = ctx.GenType;
|
||||
ctx.Render = this;
|
||||
ctx.Lan = RenderFileUtil.GetLanguage(genType);
|
||||
ctx.Lan = GetLanguage(ctx);
|
||||
DefAssembly.LocalAssebmly.CurrentLanguage = ctx.Lan;
|
||||
foreach (var c in ctx.ExportTypes)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@ namespace Luban.Job.Cfg.Generate
|
|||
[Render("code_cpp_bin")]
|
||||
class CppCodeBinRender : TemplateCodeRenderBase
|
||||
{
|
||||
protected override string CommonRenderTemplateDir => "cpp";
|
||||
|
||||
protected override string RenderTemplateDir => "cpp_bin";
|
||||
|
||||
public override void Render(GenContext ctx)
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ namespace Luban.Job.Cfg.Generate
|
|||
[Render("code_cpp_editor")]
|
||||
class CppEditorRender : TemplateCodeRenderBase
|
||||
{
|
||||
protected override string CommonRenderTemplateDir => "cpp";
|
||||
|
||||
protected override string RenderTemplateDir => "cpp_editor_json";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ namespace Luban.Job.Cfg.Generate
|
|||
[Render("code_cs_bin")]
|
||||
class CsCodeBinRender : TemplateCodeRenderBase
|
||||
{
|
||||
protected override string CommonRenderTemplateDir => "cs";
|
||||
|
||||
protected override string RenderTemplateDir => "cs_bin";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ namespace Luban.Job.Cfg.Generate
|
|||
[Render("code_cs_json")]
|
||||
class CsCodeJsonRender : TemplateCodeRenderBase
|
||||
{
|
||||
protected override string CommonRenderTemplateDir => "cs";
|
||||
|
||||
protected override string RenderTemplateDir => "cs_json";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ namespace Luban.Job.Cfg.Generate
|
|||
[Render("code_cs_unity_json")]
|
||||
class CsCodeUnityJsonRender : TemplateCodeRenderBase
|
||||
{
|
||||
protected override string CommonRenderTemplateDir => "cs";
|
||||
|
||||
protected override string RenderTemplateDir => "cs_unity_json";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,6 @@ namespace Luban.Job.Cfg.Generate
|
|||
[Render("code_cs_unity_editor")]
|
||||
class CsEditorRender : TemplateCodeRenderBase
|
||||
{
|
||||
override protected string CommonRenderTemplateDir => "cs";
|
||||
|
||||
override protected string RenderTemplateDir => "cs_editor_json";
|
||||
|
||||
public override void Render(GenContext ctx)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace Luban.Job.Cfg.Generate
|
|||
{
|
||||
ctx.Tasks.Add(Task.Run(() =>
|
||||
{
|
||||
var file = RenderFileUtil.GetOutputFileName(genType, table.OutputDataFile, ctx.GenArgs.DataFileExtension);
|
||||
var file = RenderFileUtil.GetOutputFileName(genType, table.OutputDataFile, ctx.GenArgs.OutputDataFileExtension);
|
||||
var records = ctx.Assembly.GetTableExportDataList(table);
|
||||
if (!FileRecordCacheManager.Ins.TryGetRecordOutputData(table, records, genType, out string md5))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ namespace Luban.Job.Cfg.Generate
|
|||
[Render("code_go_bin")]
|
||||
class GoCodeBinRender : TemplateCodeRenderBase
|
||||
{
|
||||
protected override string CommonRenderTemplateDir => "go";
|
||||
|
||||
protected override string RenderTemplateDir => "go_bin";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ namespace Luban.Job.Cfg.Generate
|
|||
[Render("code_go_json")]
|
||||
class GoCodeJsonRender : TemplateCodeRenderBase
|
||||
{
|
||||
protected override string CommonRenderTemplateDir => "go";
|
||||
|
||||
protected override string RenderTemplateDir => "go_json";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ namespace Luban.Job.Cfg.Generate
|
|||
[Render("code_java_bin")]
|
||||
class JavaCodeBinRender : TemplateCodeRenderBase
|
||||
{
|
||||
protected override string CommonRenderTemplateDir => "java";
|
||||
|
||||
protected override string RenderTemplateDir => "java_bin";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ namespace Luban.Job.Cfg.Generate
|
|||
[Render("code_java_json")]
|
||||
class JavaCodeJsonRender : TemplateCodeRenderBase
|
||||
{
|
||||
protected override string CommonRenderTemplateDir => "java";
|
||||
|
||||
protected override string RenderTemplateDir => "java_json";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ namespace Luban.Job.Cfg.Generate
|
|||
{
|
||||
abstract class LuaCodeRenderBase : TemplateCodeRenderBase
|
||||
{
|
||||
protected override string CommonRenderTemplateDir => "lua";
|
||||
|
||||
public override void Render(GenContext ctx)
|
||||
{
|
||||
DefAssembly.LocalAssebmly.CurrentLanguage = Common.ELanguage.LUA;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,6 @@ namespace Luban.Job.Cfg.Generate
|
|||
[Render("code_protobuf2")]
|
||||
class Protobuf2SchemaRender : ProtobufSchemaRenderBase
|
||||
{
|
||||
protected override string RenderTemplateDir => "pb2";
|
||||
protected override string RenderTemplateDir => "protobuf2";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,6 @@ namespace Luban.Job.Cfg.Generate
|
|||
[Render("code_protobuf3")]
|
||||
class Protobuf3SchemaRender : ProtobufSchemaRenderBase
|
||||
{
|
||||
protected override string RenderTemplateDir => "pb3";
|
||||
protected override string RenderTemplateDir => "protobuf";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,11 +13,9 @@ namespace Luban.Job.Cfg.Generate
|
|||
{
|
||||
abstract class ProtobufSchemaRenderBase : TemplateCodeRenderBase
|
||||
{
|
||||
protected override string CommonRenderTemplateDir => "pb";
|
||||
|
||||
public override void Render(GenContext ctx)
|
||||
{
|
||||
DefAssembly.LocalAssebmly.CurrentLanguage = Common.ELanguage.LUA;
|
||||
DefAssembly.LocalAssebmly.CurrentLanguage = Common.ELanguage.PROTOBUF;
|
||||
var file = RenderFileUtil.GetFileOrDefault(ctx.GenArgs.OutputCodeMonolithicFile, "config.proto");
|
||||
var content = this.RenderAll(ctx.ExportTypes);
|
||||
var md5 = CacheFileUtil.GenMd5AndAddCache(file, string.Join('\n', content));
|
||||
|
|
|
|||
|
|
@ -10,8 +10,6 @@ namespace Luban.Job.Cfg.Generate
|
|||
[Render("code_python3_json")]
|
||||
class Python3CodeJsonRender : TemplateCodeRenderBase
|
||||
{
|
||||
protected override string CommonRenderTemplateDir => "python";
|
||||
|
||||
protected override string RenderTemplateDir => "python_json";
|
||||
|
||||
public override void Render(GenContext ctx)
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@ namespace Luban.Job.Cfg.Generate
|
|||
[Render("code_rust_json")]
|
||||
class RustCodeJsonRender : TemplateCodeRenderBase
|
||||
{
|
||||
protected override string CommonRenderTemplateDir => "rust";
|
||||
|
||||
protected override string RenderTemplateDir => "rust_json";
|
||||
|
||||
public override void Render(GenContext ctx)
|
||||
|
|
@ -23,7 +21,7 @@ namespace Luban.Job.Cfg.Generate
|
|||
string genType = ctx.GenType;
|
||||
var args = ctx.GenArgs;
|
||||
ctx.Render = this;
|
||||
ctx.Lan = RenderFileUtil.GetLanguage(genType);
|
||||
ctx.Lan = GetLanguage(ctx);
|
||||
DefAssembly.LocalAssebmly.CurrentLanguage = ctx.Lan;
|
||||
|
||||
var lines = new List<string>();
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace Luban.Job.Cfg.Generate
|
|||
{
|
||||
abstract class TemplateCodeRenderBase : CodeRenderBase
|
||||
{
|
||||
protected abstract string CommonRenderTemplateDir { get; }
|
||||
protected virtual string CommonRenderTemplateDir => RenderFileUtil.GetCommonTemplateDirName(DefAssembly.LocalAssebmly.CurrentLanguage);
|
||||
|
||||
protected abstract string RenderTemplateDir { get; }
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
using Luban.Job.Common;
|
||||
using Luban.Job.Common.Generate;
|
||||
using Luban.Job.Common.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Luban.Job.Cfg.Generate
|
||||
{
|
||||
[Render("code_template")]
|
||||
class TemplateCodeScatterRender : TemplateCodeRenderBase
|
||||
{
|
||||
protected override string RenderTemplateDir => GenContext.Ctx.GenArgs.TemplateCodeDir;
|
||||
|
||||
protected override ELanguage GetLanguage(GenContext ctx)
|
||||
{
|
||||
return RenderFileUtil.GetLanguage(ctx.GenArgs.TemplateCodeDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -12,12 +12,12 @@ namespace Luban.Job.Cfg.Generate
|
|||
{
|
||||
public override void Render(GenContext ctx)
|
||||
{
|
||||
string genType = ctx.GenArgs.TemplateName;
|
||||
string genType = ctx.GenArgs.TemplateDataFile;
|
||||
foreach (var table in ctx.ExportTables)
|
||||
{
|
||||
ctx.Tasks.Add(Task.Run(() =>
|
||||
{
|
||||
var file = RenderFileUtil.GetOutputFileName(genType, table.OutputDataFile, ctx.GenArgs.DataFileExtension);
|
||||
var file = RenderFileUtil.GetOutputFileName(genType, table.OutputDataFile, ctx.GenArgs.OutputDataFileExtension);
|
||||
var records = ctx.Assembly.GetTableExportDataList(table);
|
||||
if (!FileRecordCacheManager.Ins.TryGetRecordOutputData(table, records, genType, out string md5))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ namespace Luban.Job.Cfg.Generate
|
|||
var fileName = table.IsMapTable ?
|
||||
record.Data.GetField(table.IndexField.Name).Apply(ToStringVisitor2.Ins).Replace("\"", "").Replace("'", "")
|
||||
: (++index).ToString();
|
||||
var file = RenderFileUtil.GetOutputFileName(genType, $"{dirName}/{fileName}", ctx.GenArgs.DataFileExtension);
|
||||
var file = RenderFileUtil.GetOutputFileName(genType, $"{dirName}/{fileName}", ctx.GenArgs.OutputDataFileExtension);
|
||||
ctx.Tasks.Add(Task.Run(() =>
|
||||
{
|
||||
//if (!FileRecordCacheManager.Ins.TryGetRecordOutputData(table, records, genType, out string md5))
|
||||
|
|
|
|||
|
|
@ -9,14 +9,12 @@ namespace Luban.Job.Cfg.Generate
|
|||
{
|
||||
abstract class TypescriptCodeRenderBase : TemplateCodeRenderBase
|
||||
{
|
||||
protected override string CommonRenderTemplateDir => "typescript";
|
||||
|
||||
public override void Render(GenContext ctx)
|
||||
{
|
||||
string genType = ctx.GenType;
|
||||
var args = ctx.GenArgs;
|
||||
ctx.Render = this;
|
||||
ctx.Lan = RenderFileUtil.GetLanguage(genType);
|
||||
ctx.Lan = GetLanguage(ctx);
|
||||
DefAssembly.LocalAssebmly.CurrentLanguage = ctx.Lan;
|
||||
|
||||
var lines = new List<string>(10000);
|
||||
|
|
|
|||
|
|
@ -81,9 +81,14 @@ namespace Luban.Job.Cfg
|
|||
errMsg = "--input_l10n_text_files must be provided with --output_l10n_not_translated_text_file";
|
||||
return false;
|
||||
}
|
||||
if (genTypes.Contains("data_template") ^ !string.IsNullOrWhiteSpace(options.TemplateName))
|
||||
if (genTypes.Contains("data_template") ^ !string.IsNullOrWhiteSpace(options.TemplateDataFile))
|
||||
{
|
||||
errMsg = "gen_types data_template should use with --template_name";
|
||||
errMsg = "gen_types data_template should use with --template:data:file";
|
||||
return false;
|
||||
}
|
||||
if (genTypes.Contains("code_template") ^ !string.IsNullOrWhiteSpace(options.TemplateCodeDir))
|
||||
{
|
||||
errMsg = "gen_types code_template should use with --template:code:dir";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -144,7 +149,7 @@ namespace Luban.Job.Cfg
|
|||
|
||||
TimeZoneInfo timeZoneInfo = string.IsNullOrEmpty(args.L10nTimeZone) ? null : TimeZoneInfo.FindSystemTimeZoneById(args.L10nTimeZone);
|
||||
|
||||
var excludeTags = args.ExportExcludeTags.Split(',').Select(t => t.Trim().ToLowerInvariant()).Where(t => !string.IsNullOrEmpty(t)).ToList();
|
||||
var excludeTags = args.OutputExcludeTags.Split(',').Select(t => t.Trim().ToLowerInvariant()).Where(t => !string.IsNullOrEmpty(t)).ToList();
|
||||
var ass = new DefAssembly(args.L10nPatchName, timeZoneInfo, excludeTags, agent);
|
||||
ass.Load(rawDefines, agent, args);
|
||||
|
||||
|
|
@ -199,6 +204,7 @@ namespace Luban.Job.Cfg
|
|||
Tasks = tasks,
|
||||
DataLoader = CheckLoadCfgDataAsync,
|
||||
};
|
||||
GenContext.Ctx = ctx;
|
||||
|
||||
var render = RenderFactory.CreateRender(genType);
|
||||
if (render == null)
|
||||
|
|
@ -210,6 +216,7 @@ namespace Luban.Job.Cfg
|
|||
await CheckLoadCfgDataAsync();
|
||||
}
|
||||
render.Render(ctx);
|
||||
GenContext.Ctx = null;
|
||||
}
|
||||
await Task.WhenAll(tasks.ToArray());
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ namespace Luban.Job.Common.Utils
|
|||
{ "javascript", ELanguage.JAVASCRIPT },
|
||||
{ "erlang", ELanguage.ERLANG },
|
||||
{ "rust", ELanguage.RUST },
|
||||
{ "pb", ELanguage.PROTOBUF },
|
||||
{ "protobuf", ELanguage.PROTOBUF },
|
||||
};
|
||||
|
||||
public static ELanguage GetLanguage(string genType)
|
||||
|
|
@ -84,7 +84,26 @@ namespace Luban.Job.Common.Utils
|
|||
return lan;
|
||||
}
|
||||
}
|
||||
throw new ArgumentException($"not support output data type:{genType}");
|
||||
throw new ArgumentException($"can't guess Language from gen_type:{genType}");
|
||||
}
|
||||
|
||||
public static string GetCommonTemplateDirName(ELanguage lan)
|
||||
{
|
||||
return lan switch
|
||||
{
|
||||
ELanguage.CS => "cs",
|
||||
ELanguage.JAVA => "java",
|
||||
ELanguage.GO => "go",
|
||||
ELanguage.CPP => "cpp",
|
||||
ELanguage.LUA => "lua",
|
||||
ELanguage.PYTHON => "python",
|
||||
ELanguage.TYPESCRIPT => "typescript",
|
||||
ELanguage.JAVASCRIPT => "javascript",
|
||||
ELanguage.ERLANG => "erlang",
|
||||
ELanguage.RUST => "rust",
|
||||
ELanguage.PROTOBUF => "protobuf",
|
||||
_ => throw new Exception($"not support common template dir for lan:{lan}"),
|
||||
};
|
||||
}
|
||||
|
||||
private static readonly Dictionary<string, string> s_name2Suxxifx = new()
|
||||
|
|
|
|||
|
|
@ -1,55 +0,0 @@
|
|||
using Luban.Job.Common.Defs;
|
||||
using Luban.Job.Common.Tpl;
|
||||
using Scriban;
|
||||
|
||||
namespace Luban.Job.Common.Utils
|
||||
{
|
||||
public static class RenderUtil
|
||||
{
|
||||
public static string RenderCsEnumClass(DefEnum e)
|
||||
{
|
||||
var template = StringTemplateManager.Ins.GetTemplate("common/cs/enum");
|
||||
var result = template.Render(e);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static string RenderJavaEnumClass(DefEnum e)
|
||||
{
|
||||
var template = StringTemplateManager.Ins.GetTemplate("common/java/enum");
|
||||
var result = template.Render(e);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static string RenderCppEnumClass(DefEnum e)
|
||||
{
|
||||
var template = StringTemplateManager.Ins.GetTemplate("common/cpp/enum");
|
||||
var result = template.Render(e);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static string RenderPythonEnumClass(DefEnum e)
|
||||
{
|
||||
var template = StringTemplateManager.Ins.GetTemplate("common/python/enum");
|
||||
var result = template.Render(e);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static string RenderTypescriptEnumClass(DefEnum e)
|
||||
{
|
||||
var template = StringTemplateManager.Ins.GetTemplate("common/typescript/enum");
|
||||
var result = template.Render(e);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static string RenderRustEnumClass(DefEnum e)
|
||||
{
|
||||
var template = StringTemplateManager.Ins.GetTemplate("common/rust/enum");
|
||||
var result = template.Render(e);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -22,7 +22,10 @@ namespace Luban.Job.Db.Generate
|
|||
|
||||
public string Render(DefEnum e)
|
||||
{
|
||||
return RenderUtil.RenderCsEnumClass(e);
|
||||
var template = StringTemplateManager.Ins.GetTemplate("common/cs/enum");
|
||||
var result = template.Render(e);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public string Render(DefBean b)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,10 @@ namespace Luban.Job.Db.Generate
|
|||
|
||||
public string Render(DefEnum e)
|
||||
{
|
||||
return RenderUtil.RenderCsEnumClass(e);
|
||||
var template = StringTemplateManager.Ins.GetTemplate("common/cs/enum");
|
||||
var result = template.Render(e);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public string Render(DefBean b)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,9 @@ namespace Luban.Job.Db.Generate
|
|||
|
||||
private string Render(DefEnum e)
|
||||
{
|
||||
return RenderUtil.RenderTypescriptEnumClass(e);
|
||||
var template = StringTemplateManager.Ins.GetTemplate("common/typescript/enum");
|
||||
var result = template.Render(e);
|
||||
return result;
|
||||
}
|
||||
|
||||
public string Render(DefBean b)
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@
|
|||
<None Update="Templates\common\lua\base.tpl">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Templates\common\pb\enum.tpl">
|
||||
<None Update="Templates\common\protobuf\enum.tpl">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Templates\common\python\enum.tpl">
|
||||
|
|
@ -166,16 +166,16 @@
|
|||
<None Update="Templates\config\lua_lua\all.tpl">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Templates\config\pb2\bean.tpl">
|
||||
<None Update="Templates\config\protobuf2\bean.tpl">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Templates\config\pb2\all.tpl">
|
||||
<None Update="Templates\config\protobuf2\all.tpl">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Templates\config\pb2\table.tpl">
|
||||
<None Update="Templates\config\protobuf2\table.tpl">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Templates\config\pb2\tables.tpl">
|
||||
<None Update="Templates\config\protobuf2\tables.tpl">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Templates\config\python_json\bean.tpl">
|
||||
|
|
|
|||
|
|
@ -18,6 +18,14 @@
|
|||
"TestEncryptMemory-DisableCache": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "-t D:\\workspace\\luban_examples\\Projects\\Csharp_CustomTemplate_EncryptMemory\\CustomTemplate --disable_cache"
|
||||
},
|
||||
"CodeTemplate-AsyncLoad-DisableCache": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "-t D:\\workspace\\luban_examples\\Projects\\Csharp_CustomTemplate_ExternalCodeTemplate\\CustomTemplate --disable_cache"
|
||||
},
|
||||
"ExternalCodeTemplate": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "-t D:\\workspace\\luban_examples\\Projects\\Csharp_CustomTemplate_ExternalCodeTemplate\\CustomTemplate --disable_cache"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue