Skip to content

Commit

Permalink
fix(volo-build): oneway init service build failed (#405)
Browse files Browse the repository at this point in the history
* fix(volo-build): oneway init service build failed

* update dep
  • Loading branch information
PureWhiteWu committed Apr 8, 2024
1 parent a0e28dd commit cf308c4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion volo-build/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "volo-build"
version = "0.10.2"
version = "0.10.3"
edition.workspace = true
homepage.workspace = true
repository.workspace = true
Expand Down
23 changes: 19 additions & 4 deletions volo-build/src/thrift_backend.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
use itertools::Itertools;
use pilota_build::{
codegen::thrift::DecodeHelper, db::RirDatabase, rir, rir::Method, tags::RustWrapperArc,
codegen::thrift::DecodeHelper,
db::RirDatabase,
rir::{self, Method},
tags::RustWrapperArc,
ty::TyKind,
CodegenBackend, Context, DefId, IdentName, Symbol, ThriftBackend,
};
use quote::format_ident;
Expand Down Expand Up @@ -639,11 +643,14 @@ impl pilota_build::CodegenBackend for VoloThriftBackend {
method: &Method,
) -> String {
let name = self.cx().rust_name(method.def_id);
let ret_ty = self
let mut ret_ty = self
.inner
.codegen_item_ty(method.ret.kind.clone())
.global_path();
let mut ret_ty = format!("volo_gen{ret_ty}");
.global_path()
.to_string();
if need_prepend_volo_gen_path(&method.ret.kind) {
ret_ty = format!("volo_gen{ret_ty}");
}
if let Some(RustWrapperArc(true)) = self
.cx()
.tags(method.ret.tags_id)
Expand Down Expand Up @@ -688,6 +695,14 @@ impl pilota_build::CodegenBackend for VoloThriftBackend {
}
}

fn need_prepend_volo_gen_path(ty: &TyKind) -> bool {
match ty {
TyKind::Arc(t) => need_prepend_volo_gen_path(&t.kind),
TyKind::Path(_) => true,
_ => false,
}
}

pub struct MkThriftBackend;

impl pilota_build::MakeBackend for MkThriftBackend {
Expand Down

0 comments on commit cf308c4

Please sign in to comment.