Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/jzero/internal/command/gen/genrpc/genrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ func (jr *JzeroRpc) Gen() (map[string]rpcparser.Proto, error) {
if err != nil {
return nil, err
}
logx.Debugf("excludeThirdPartyProtoFiles = %s", excludeThirdPartyProtoFiles)

// 获取 proto 的 go_package
var protoParser protoparse.Parser
Expand Down
25 changes: 24 additions & 1 deletion cmd/jzero/internal/command/gen/genzrpcclient/genzrpcclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ func Generate(genModule bool) (err error) {
if err != nil {
return err
}
logx.Debugf("excludeThirdPartyProtoFiles: %v", excludeThirdPartyProtoFiles)

var services []string
for _, fp := range files {
Expand Down Expand Up @@ -226,7 +227,7 @@ func Generate(genModule bool) (err error) {
}
}

protocCmd := fmt.Sprintf("protoc %s -I%s -I%s --go_out=%s --go_opt=module=%s --go-grpc_out=%s --go-grpc_opt=module=%s",
protocCmd := fmt.Sprintf("protoc %s -I%s -I%s --go_out=%s --go_opt=module=%s --go_opt=M%s=%s --go-grpc_out=%s --go-grpc_opt=module=%s --go-grpc_opt=M%s=%s",
fp,
config.C.ProtoDir(),
filepath.Join(config.C.ProtoDir(), "third_party"),
Expand All @@ -237,13 +238,35 @@ func Generate(genModule bool) (err error) {
return filepath.Join(config.C.Gen.Zrpcclient.Output)
}(),
module,
rel,
func() string {
if strings.HasPrefix(goPackage, module) {
return goPackage
}

if genModule {
return filepath.ToSlash(filepath.Join(module, "model", goPackage))
}
return filepath.ToSlash(filepath.Join(module, config.C.Gen.Zrpcclient.Output, "model", goPackage))
}(),
func() string {
if !genModule {
return "."
}
return filepath.Join(config.C.Gen.Zrpcclient.Output)
}(),
module,
rel,
func() string {
if strings.HasPrefix(goPackage, module) {
return goPackage
}

if genModule {
return filepath.ToSlash(filepath.Join(module, "model", goPackage))
}
return filepath.ToSlash(filepath.Join(module, config.C.Gen.Zrpcclient.Output, "model", goPackage))
}(),
)

for _, exp := range excludeThirdPartyProtoFiles {
Expand Down
19 changes: 19 additions & 0 deletions docs/src/release/v1.2.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: v1.2.1
icon: catppuccin:release
order: 6
---

## 问题修复

### cmd/jzero

* 修复当指定了 desc 时还对远程数据库地址生成了代码问题 [#385](https://github.com/jzero-io/jzero/pull/385)

* 修复当 proto 中存在子文件夹时生成 zrpcclient 问题 [#386](https://github.com/jzero-io/jzero/pull/386)

## 更新步骤

```shell
jzero upgrade --channel v1.2.1
```
Loading