From 2335e047b45e99a98eab5c345f4bce3abdab6f30 Mon Sep 17 00:00:00 2001 From: Shayne Fletcher Date: Sat, 3 Feb 2024 10:37:40 -0800 Subject: [PATCH] fix include type src failure Summary: before this diff ``` cd ~/fbsource/fbcode/common/rust/cargo_from_buck/fbcode/security/flare/if/flare_if cargo build ``` fails with errors (P1172791642) ``` Failed while running thrift compilation: No such file or directory (os error 2) ``` Reviewed By: dtolnay Differential Revision: D53382391 Privacy Context Container: L1124100 fbshipit-source-id: fdc9d541fb75c53b1aba3da1f57976846de78f9f --- shed/thrift_compiler/src/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/shed/thrift_compiler/src/lib.rs b/shed/thrift_compiler/src/lib.rs index ebbebf144..04f042563 100644 --- a/shed/thrift_compiler/src/lib.rs +++ b/shed/thrift_compiler/src/lib.rs @@ -197,11 +197,15 @@ impl Config { } for lib_include_src in &self.lib_include_srcs { println!("cargo:rerun-if-changed={lib_include_src}"); - fs::copy(lib_include_src, out.join(lib_include_src))?; + if let GenContext::Lib = self.gen_context { + fs::copy(lib_include_src, out.join(lib_include_src))?; + } } for types_include_src in &self.types_include_srcs { println!("cargo:rerun-if-changed={types_include_src}"); - fs::copy(types_include_src, out.join(types_include_src))?; + if let GenContext::Types = self.gen_context { + fs::copy(types_include_src, out.join(types_include_src))?; + } } if let [(_name, file)] = &input[..] {