From 93595c774852ecd52b871eadc55358166fcc39ff Mon Sep 17 00:00:00 2001 From: walon Date: Sat, 4 Dec 2021 13:13:53 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E6=A8=A1=E6=9D=BF=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90?= =?UTF-8?q?=E7=9A=84=E5=86=85=E5=AE=B9=E4=B8=BA=E7=A9=BA=EF=BC=8C=E5=88=99?= =?UTF-8?q?=E4=B8=8D=E7=94=9F=E6=88=90=E6=AD=A4=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/Generate/CodeRenderBase.cs | 14 ++++++++++++-- src/Luban.Server/Properties/launchSettings.json | 6 +++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/Luban.Job.Cfg/Source/Generate/CodeRenderBase.cs b/src/Luban.Job.Cfg/Source/Generate/CodeRenderBase.cs index fce82a3..c53961b 100644 --- a/src/Luban.Job.Cfg/Source/Generate/CodeRenderBase.cs +++ b/src/Luban.Job.Cfg/Source/Generate/CodeRenderBase.cs @@ -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 }); diff --git a/src/Luban.Server/Properties/launchSettings.json b/src/Luban.Server/Properties/launchSettings.json index d3886f7..8c6c5a5 100644 --- a/src/Luban.Server/Properties/launchSettings.json +++ b/src/Luban.Server/Properties/launchSettings.json @@ -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" } } } \ No newline at end of file