diff --git a/rslib/build.rs b/rslib/build.rs index 9722afc41..5c044fcc6 100644 --- a/rslib/build.rs +++ b/rslib/build.rs @@ -1,6 +1,7 @@ use std::fmt::Write; use std::fs; use std::path::Path; +use std::process::Command; use fluent_syntax::ast::{Entry::Message, ResourceEntry}; use fluent_syntax::parser::parse; @@ -200,15 +201,20 @@ fn main() -> std::io::Result<()> { fs::write(rust_string_path, rust_string_vec(&idents))?; // output protobuf generated code - // we avoid default OUT_DIR for now, as it breaks code completion - std::env::set_var("OUT_DIR", "src"); println!("cargo:rerun-if-changed=../proto/backend.proto"); - let mut config = prost_build::Config::new(); - config.service_generator(service_generator()); config + // we avoid default OUT_DIR for now, as it breaks code completion + .out_dir("src") + .service_generator(service_generator()) .compile_protos(&["../proto/backend.proto"], &["../proto"]) .unwrap(); + // rustfmt the protobuf code + let rustfmt = Command::new("rustfmt") + .arg(Path::new("src/backend_proto.rs")) + .status() + .unwrap(); + assert!(rustfmt.success(), "rustfmt backend_proto.rs failed"); // write the other language ftl files let mut ftl_lang_dirs = vec!["./ftl/repo/core".to_string()]; diff --git a/rslib/rustfmt.toml b/rslib/rustfmt.toml deleted file mode 100644 index bd0ab67a8..000000000 --- a/rslib/rustfmt.toml +++ /dev/null @@ -1 +0,0 @@ -ignore = ["backend_proto.rs"]