From 6ee638d9409144dc1c587283f47994ba9f4b8efd Mon Sep 17 00:00:00 2001 From: Blake Willoughby Date: Tue, 13 Jul 2021 19:35:35 +0000 Subject: [PATCH] feat(health): Expose grpc_health_v1 file descriptor set (#620) --- tonic-health/build.rs | 6 ++++++ tonic-health/src/lib.rs | 3 +++ 2 files changed, 9 insertions(+) diff --git a/tonic-health/build.rs b/tonic-health/build.rs index 602ed9c81..fcbf5e0a4 100644 --- a/tonic-health/build.rs +++ b/tonic-health/build.rs @@ -1,5 +1,11 @@ +use std::env; +use std::path::PathBuf; + fn main() -> Result<(), Box> { + let grpc_health_v1_descriptor_set_path: PathBuf = + PathBuf::from(env::var("OUT_DIR").unwrap()).join("grpc_health_v1.bin"); tonic_build::configure() + .file_descriptor_set_path(grpc_health_v1_descriptor_set_path) .build_server(true) .build_client(true) .format(false) diff --git a/tonic-health/src/lib.rs b/tonic-health/src/lib.rs index fab1bae0d..ef2f56234 100644 --- a/tonic-health/src/lib.rs +++ b/tonic-health/src/lib.rs @@ -28,6 +28,9 @@ pub mod proto { #![allow(unreachable_pub)] #![allow(missing_docs)] tonic::include_proto!("grpc.health.v1"); + + pub const GRPC_HEALTH_V1_FILE_DESCRIPTOR_SET: &'static [u8] = + tonic::include_file_descriptor_set!("grpc_health_v1"); } pub mod server;