【优化】如果模板代码生成的内容为空,则不生成此文件
parent
79d52c8820
commit
93595c7748
|
|
@ -39,7 +39,12 @@ namespace Luban.Job.Cfg.Generate
|
|||
{
|
||||
ctx.Tasks.Add(Task.Run(() =>
|
||||
{
|
||||
var content = FileHeaderUtil.ConcatAutoGenerationHeader(ctx.Render.RenderAny(c), ctx.Lan);
|
||||
string body = ctx.Render.RenderAny(c);
|
||||
if (string.IsNullOrWhiteSpace(body))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var content = FileHeaderUtil.ConcatAutoGenerationHeader(body, ctx.Lan);
|
||||
var file = RenderFileUtil.GetDefTypePath(c.FullName, ctx.Lan);
|
||||
var md5 = CacheFileUtil.GenMd5AndAddCache(file, content);
|
||||
ctx.GenCodeFilesInOutputCodeDir.Add(new FileInfo() { FilePath = file, MD5 = md5 });
|
||||
|
|
@ -50,7 +55,12 @@ namespace Luban.Job.Cfg.Generate
|
|||
{
|
||||
var module = ctx.TopModule;
|
||||
var name = ctx.TargetService.Manager;
|
||||
var content = FileHeaderUtil.ConcatAutoGenerationHeader(ctx.Render.RenderService(name, module, ctx.ExportTables), ctx.Lan);
|
||||
var body = ctx.Render.RenderService(name, module, ctx.ExportTables);
|
||||
if (string.IsNullOrWhiteSpace(body))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var content = FileHeaderUtil.ConcatAutoGenerationHeader(body, ctx.Lan);
|
||||
var file = RenderFileUtil.GetDefTypePath(name, ctx.Lan);
|
||||
var md5 = CacheFileUtil.GenMd5AndAddCache(file, content);
|
||||
ctx.GenCodeFilesInOutputCodeDir.Add(new FileInfo() { FilePath = file, MD5 = md5 });
|
||||
|
|
|
|||
|
|
@ -13,7 +13,11 @@
|
|||
},
|
||||
"TestTemplate-DisableCache": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "-t D:\\workspace\\luban_examples\\Projects\\CustomTemplates --disable_template_cache"
|
||||
"commandLineArgs": "-t D:\\workspace\\luban_examples\\Projects\\CustomTemplates --disable_cache"
|
||||
},
|
||||
"TestEncryptMemory-DisableCache": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "-t D:\\workspace\\luban_examples\\Projects\\Csharp_CustomTemplate_EncryptMemory\\CustomTemplate --disable_cache"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue