fix generate pb issues

This commit is contained in:
appflowy
2021-12-04 17:31:32 +08:00
parent c649673b2b
commit 63082418be
27 changed files with 79 additions and 56 deletions

View File

@ -53,12 +53,12 @@ fn write_rust_crate_mod_file(crate_infos: &[CrateProtoInfo]) {
{
Ok(ref mut file) => {
let mut mod_file_content = String::new();
mod_file_content.push_str("// Auto-generated, do not edit \n");
mod_file_content.push_str("// Auto-generated, do not edit\n");
walk_dir(
crate_info.inner.proto_file_output_dir().as_ref(),
|e| !e.file_type().is_dir(),
|_, name| {
let c = format!("\nmod {}; \npub use {}::*; \n", &name, &name);
let c = format!("\nmod {};\npub use {}::*;\n", &name, &name);
mod_file_content.push_str(c.as_ref());
},
);

View File

@ -17,10 +17,8 @@ impl CrateProtoInfo {
// mod model;
// pub use model::*;
let mod_file_path = format!("{}/mod.rs", self.inner.protobuf_crate_name());
let content = r#"
mod model;
pub use model::*;
"#;
let mut content = format!("// Auto-generated, do not edit\n");
content.push_str("mod model;\npub use model::*;");
match OpenOptions::new()
.create(true)
.write(true)