avantgardnerio commented on code in PR #3580:
URL: https://github.com/apache/arrow-datafusion/pull/3580#discussion_r976938276


##########
datafusion/proto/build.rs:
##########
@@ -72,8 +73,24 @@ fn build() -> Result<(), String> {
 
 #[cfg(not(feature = "json"))]
 fn build() -> Result<(), String> {
+    use std::io::Write;
+
+    let out = std::path::PathBuf::from(
+        std::env::var("OUT_DIR").expect("Cannot find OUT_DIR environment 
variable"),
+    );
+
     prost_build::Config::new()
-        .out_dir("src/generated")
         .compile_protos(&["proto/datafusion.proto"], &["proto"])
-        .map_err(|e| format!("protobuf compilation failed: {}", e))
+        .map_err(|e| format!("protobuf compilation failed: {}", e))?;
+
+    let proto = std::fs::read_to_string(out.join("datafusion.rs")).unwrap();
+    let mut file = std::fs::OpenOptions::new()
+        .write(true)
+        .truncate(true)
+        .create(true)
+        .open("src/generated/datafusion.rs")
+        .unwrap();
+    file.write(proto.as_str().as_ref()).unwrap();

Review Comment:
   Generate code the same way no matter which feature is selected.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to