diff --git a/src/Luban.Job.Cfg/Source/Generate/PythonCodeRenderBase.cs b/src/Luban.Job.Cfg/Source/Generate/PythonCodeRenderBase.cs index 83b8726..0b9f558 100644 --- a/src/Luban.Job.Cfg/Source/Generate/PythonCodeRenderBase.cs +++ b/src/Luban.Job.Cfg/Source/Generate/PythonCodeRenderBase.cs @@ -16,8 +16,9 @@ namespace Luban.Job.Cfg.Generate var lines = new List(10000); static void PreContent(List fileContent) { - fileContent.Add(PythonStringTemplates.ImportTython3Enum); - fileContent.Add(PythonStringTemplates.PythonVectorTypes); + //fileContent.Add(PythonStringTemplates.ImportTython3Enum); + //fileContent.Add(PythonStringTemplates.PythonVectorTypes); + fileContent.Add(StringTemplateUtil.GetTemplateString("config/python_json/include")); } GenerateCodeMonolithic(ctx, RenderFileUtil.GetFileOrDefault(ctx.GenArgs.OutputCodeMonolithicFile, "Types.py"), lines, PreContent, null); @@ -31,8 +32,7 @@ namespace Luban.Job.Cfg.Generate public override string RenderService(string name, string module, List tables) { var template = StringTemplateUtil.GetTemplate("config/python_json/tables"); - var result = template.RenderCode(new - { + var result = template.RenderCode(new { Name = name, Namespace = module, Tables = tables, diff --git a/src/Luban.Server/Luban.Server.csproj b/src/Luban.Server/Luban.Server.csproj index f0541ef..97fa148 100644 --- a/src/Luban.Server/Luban.Server.csproj +++ b/src/Luban.Server/Luban.Server.csproj @@ -167,6 +167,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest diff --git a/src/Luban.Job.Common/Source/Utils/PythonStringTemplates.cs b/src/Luban.Server/Templates/config/python_json/include.tpl similarity index 85% rename from src/Luban.Job.Common/Source/Utils/PythonStringTemplates.cs rename to src/Luban.Server/Templates/config/python_json/include.tpl index 4ea269b..008ee4d 100644 --- a/src/Luban.Job.Common/Source/Utils/PythonStringTemplates.cs +++ b/src/Luban.Server/Templates/config/python_json/include.tpl @@ -1,8 +1,6 @@ -namespace Luban.Job.Common.Utils -{ - public class PythonStringTemplates - { - public const string PythonVectorTypes = @" +from enum import Enum +import abc + class Vector2: def __init__(self, x, y): self.x = x @@ -54,11 +52,3 @@ class Vector4: raise Exception() return Vector4(x, y, z, w) -"; - - public const string ImportTython3Enum = @" -from enum import Enum -import abc -"; - } -}