Skip to content

Commit

Permalink
proto rust.yml workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
youngday committed Jun 16, 2024
1 parent 18da472 commit 7533bd2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,13 @@ name = "quic_server"
path = "examples/quic/server.rs"

# please uncomment for grpc
# [[example]]
# name = "grpc-client"
# path = "examples/grpc_poem/helloworld/src/client.rs"

# [[example]]
# name = "grpc-server"
# path = "examples/grpc_poem/helloworld/src/server.rs"
# [[example]]
# name = "grpc-jsoncodec-server"
# path = "examples/grpc_poem/jsoncodec/src/server.rs"
[[example]]
name = "grpc-client"
path = "examples/grpc_poem/helloworld/src/client.rs"

[[example]]
name = "grpc-server"
path = "examples/grpc_poem/helloworld/src/server.rs"
[[example]]
name = "grpc-jsoncodec-server"
path = "examples/grpc_poem/jsoncodec/src/server.rs"
23 changes: 15 additions & 8 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
// please uncomment for grpc
// use std::io::Result;
use std::io::Result;
use std::env;
use std::path::PathBuf;

use poem_grpc_build::Config;

fn main() -> Result<()> {
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
Config::new()
.codec("::poem_grpc::codec::JsonCodec")
.type_attribute(".", "#[derive(serde::Deserialize, serde::Serialize)]")
.file_descriptor_set_path(out_dir.join("helloworld_descriptor.bin"))
.compile(&["./proto/helloworld.proto"], &["./proto"])
}


// use poem_grpc_build::Config;

// fn main() -> Result<()> {
// Config::new()
// .codec("::poem_grpc::codec::JsonCodec")
// .type_attribute(".", "#[derive(serde::Deserialize, serde::Serialize)]")
// .compile(&["./proto/helloworld.proto"], &["./proto"])
// }

0 comments on commit 7533bd2

Please sign in to comment.