Compare commits
No commits in common. "develop" and "main" have entirely different histories.
|
|
@ -5,7 +5,6 @@ using Luban.Job.Common.Generate;
|
||||||
using Luban.Job.Common.Utils;
|
using Luban.Job.Common.Utils;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO.Packaging;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
@ -14,33 +13,13 @@ namespace Luban.Job.Cfg.Generate
|
||||||
{
|
{
|
||||||
abstract class ProtobufSchemaRenderBase : TemplateCodeRenderBase
|
abstract class ProtobufSchemaRenderBase : TemplateCodeRenderBase
|
||||||
{
|
{
|
||||||
public string GoPackage;
|
|
||||||
|
|
||||||
public override void Render(GenContext ctx)
|
public override void Render(GenContext ctx)
|
||||||
{
|
{
|
||||||
DefAssembly.LocalAssebmly.CurrentLanguage = Common.ELanguage.PROTOBUF;
|
DefAssembly.LocalAssebmly.CurrentLanguage = Common.ELanguage.PROTOBUF;
|
||||||
var file = RenderFileUtil.GetFileOrDefault(ctx.GenArgs.OutputCodeMonolithicFile, "schema.proto");
|
var file = RenderFileUtil.GetFileOrDefault(ctx.GenArgs.OutputCodeMonolithicFile, "schema.proto");
|
||||||
GoPackage = ctx.GenArgs.ProtobufGoPackge;
|
|
||||||
var content = this.RenderAll(ctx.ExportTypes);
|
var content = this.RenderAll(ctx.ExportTypes);
|
||||||
var md5 = CacheFileUtil.GenMd5AndAddCache(file, string.Join('\n', content));
|
var md5 = CacheFileUtil.GenMd5AndAddCache(file, string.Join('\n', content));
|
||||||
ctx.GenCodeFilesInOutputCodeDir.Add(new FileInfo() { FilePath = file, MD5 = md5 });
|
ctx.GenCodeFilesInOutputCodeDir.Add(new FileInfo() { FilePath = file, MD5 = md5 });
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string RenderAll(List<DefTypeBase> types)
|
|
||||||
{
|
|
||||||
var enums = types.Where(t => t is DefEnum).ToList();
|
|
||||||
var beans = types.Where(t => t is DefBean).ToList();
|
|
||||||
var tables = types.Where(t => t is DefTable).ToList();
|
|
||||||
|
|
||||||
var template = GetConfigTemplate("all");
|
|
||||||
var result = template.RenderCode(new {
|
|
||||||
Namespace = DefAssembly.LocalAssebmly.TopModule,
|
|
||||||
Go = GoPackage,
|
|
||||||
Enums = enums.Select(e => Render((DefEnum)e)).ToList(),
|
|
||||||
Beans = beans.Select(b => Render((DefBean)b)).ToList(),
|
|
||||||
Tables = tables.Select(t => Render((DefTable)t)).ToList(),
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,9 +59,6 @@ namespace Luban.Job.Common
|
||||||
[Option("external:selectors", Required = false, HelpText = "external selectors")]
|
[Option("external:selectors", Required = false, HelpText = "external selectors")]
|
||||||
public string ExternalSelectors { get; set; }
|
public string ExternalSelectors { get; set; }
|
||||||
|
|
||||||
[Option("protobuf:go_package", Required = false, HelpText = "option go_package")]
|
|
||||||
public string ProtobufGoPackge { get; set; }
|
|
||||||
|
|
||||||
public AccessConvention AccessConventionBeanMember { get; set; }
|
public AccessConvention AccessConventionBeanMember { get; set; }
|
||||||
|
|
||||||
public bool ValidateOutouptCodeDir(ref string errMsg)
|
public bool ValidateOutouptCodeDir(ref string errMsg)
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
package {{x.namespace}};
|
package {{x.namespace}};
|
||||||
|
|
||||||
option go_package = "{{x.go}}";
|
|
||||||
|
|
||||||
// luban internal types begin
|
// luban internal types begin
|
||||||
message Vector2 {
|
message Vector2 {
|
||||||
float x = 1;
|
float x = 1;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue