From d4eba22a9cc31fcbc87e164a7fe1a771ee418dcc Mon Sep 17 00:00:00 2001 From: Andres Suarez Date: Wed, 22 Mar 2023 20:12:49 -0700 Subject: [PATCH] Fix tonic_build OSS build Reviewed By: capickett Differential Revision: D44324686 fbshipit-source-id: 930a442bed79bcee3f17cd7e984963fa78ea27c4 --- protocol-rpc/build.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/protocol-rpc/build.rs b/protocol-rpc/build.rs index 0fc8d23..9a3f012 100644 --- a/protocol-rpc/build.rs +++ b/protocol-rpc/build.rs @@ -12,9 +12,11 @@ fn main() -> Result<(), Box> { "pjc.proto", "suidcreate.proto", ]; + let out_env = if cfg!(fbcode_build) { "OUT" } else { "OUT_DIR" }; + let out_dir = std::env::var_os(out_env).unwrap_or_else(|| panic!("env `{out_env}` not set")); tonic_build::configure() - .out_dir(std::env::var("OUT").unwrap()) + .out_dir(&out_dir) .compile( proto_files, // HACK: we need '.' directory for build with Buck