From 04952278d75bdcbd14515e0473834bcf4a81be28 Mon Sep 17 00:00:00 2001 From: omarzhang <635856256@qq.com> Date: Tue, 2 Nov 2021 11:18:18 +0800 Subject: [PATCH] =?UTF-8?q?1=EF=BC=8C=E4=BF=AE=E5=A4=8Dwindows=E4=B8=8B?= =?UTF-8?q?=E7=94=9F=E6=88=90PB=E6=96=87=E4=BB=B6=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E7=94=A8*.proto=E7=9A=84=E9=97=AE=E9=A2=98=202=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0pb=E6=96=87=E4=BB=B6=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=96=B9=E5=BA=93=E7=9A=84=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=B9protocol/thirdapis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- command/gen/gen_pb.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/command/gen/gen_pb.go b/command/gen/gen_pb.go index e342208a..0f8c45c0 100644 --- a/command/gen/gen_pb.go +++ b/command/gen/gen_pb.go @@ -31,7 +31,7 @@ func doGenPb() { mlog.Fatalf(`proto files folder "%s" does not exist`, protoFolder) } // folder scanning. - files, err := gfile.ScanDirFile(protoFolder, "*.proto", true) + files, err := gfile.ScanDirFile(protoFolder, "*.proto", false) if err != nil { mlog.Fatal(err) } @@ -40,7 +40,7 @@ func doGenPb() { } dirSet := gset.NewStrSet() for _, file := range files { - dirSet.Add(gfile.Dir(file)) + dirSet.Add(file) } var ( servicePath = gfile.RealPath(".") @@ -48,13 +48,17 @@ func doGenPb() { ) dirSet.Iterator(func(protoDirPath string) bool { parsingCommand := fmt.Sprintf( - "protoc --gofast_out=plugins=grpc:. %s/*.proto -I%s", + "protoc --gofast_out=plugins=grpc:. %s -I%s", protoDirPath, servicePath, ) if goPathSrc != "" { parsingCommand += " -I" + goPathSrc } + thirdapipath := "protocol/thirdapis" + if gfile.Exists(thirdapipath) { + parsingCommand += " -I" + thirdapipath + } mlog.Print(parsingCommand) if output, err := gproc.ShellExec(parsingCommand); err != nil { mlog.Print(output)