remove files generated by code gen before code gen

This commit is contained in:
appflowy 2021-07-13 10:11:02 +08:00
parent 7a4d950c9c
commit cabd2384a2
7 changed files with 70 additions and 46 deletions

View File

@ -21,7 +21,7 @@
<entry key="animations">
<value>
<list>
<option value="$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/animations-2.0.0/lib" />
<option value="$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/animations-2.0.1/lib" />
</list>
</value>
</entry>
@ -310,6 +310,7 @@
<value>
<list>
<option value="$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_lints-1.0.3/lib" />
<option value="$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_lints-1.0.4/lib" />
</list>
</value>
</entry>
@ -641,7 +642,7 @@
<entry key="sized_context">
<value>
<list>
<option value="$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/sized_context-0.2.1+1/lib" />
<option value="$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/sized_context-1.0.0+1/lib" />
</list>
</value>
</entry>
@ -769,7 +770,7 @@
<entry key="universal_platform">
<value>
<list>
<option value="$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/universal_platform-0.1.3/lib" />
<option value="$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/universal_platform-1.0.0+1/lib" />
</list>
</value>
</entry>
@ -898,7 +899,7 @@
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-22.0.0/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-1.4.0/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-1.7.2/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/animations-2.0.0/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/animations-2.0.1/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/archive-3.1.2/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/args-1.6.0/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/args-2.1.1/lib" />
@ -951,6 +952,7 @@
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_keyboard_visibility_platform_interface-2.0.0/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_keyboard_visibility_web-2.0.0/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_lints-1.0.3/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_lints-1.0.4/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/freezed-0.14.2/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/freezed_annotation-0.14.1/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/freezed_annotation-0.14.2/lib" />
@ -1001,7 +1003,7 @@
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/shelf-1.1.4/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/shelf_web_socket-0.2.3/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/shelf_web_socket-1.0.1/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/sized_context-0.2.1+1/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/sized_context-1.0.0+1/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/source_gen-1.0.2/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.8.1/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.10.0/lib" />
@ -1020,7 +1022,7 @@
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/timing-1.0.0/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/tuple-2.0.0/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/typed_data-1.3.0/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/universal_platform-0.1.3/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/universal_platform-1.0.0+1/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-6.0.3/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-6.0.9/lib" />
<root url="file://$PROJECT_DIR$/../../flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_linux-2.0.0/lib" />

View File

@ -1,4 +1,4 @@
// Auto-generated, do not edit
// Auto-generated, do not edit
export 'protobuf/kv.pb.dart';
export 'protobuf/ffi_response.pb.dart';
export 'protobuf/ffi_request.pb.dart';

View File

@ -442,26 +442,26 @@ static file_descriptor_proto_data: &'static [u8] = b"\
_value\x18\x04\x20\x01(\x01H\x02R\nfloatValue\x12\x1f\n\nbool_value\x18\
\x05\x20\x01(\x08H\x03R\tboolValueB\x12\n\x10one_of_str_valueB\x12\n\x10\
one_of_int_valueB\x14\n\x12one_of_float_valueB\x13\n\x11one_of_bool_valu\
eJ\xa9\x03\n\x06\x12\x04\0\0\x08\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\
\n\x02\x04\0\x12\x04\x02\0\x08\x01\n\n\n\x03\x04\0\x01\x12\x03\x02\x08\
\x10\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x04\x13\n\x0c\n\x05\x04\0\x02\0\
\x05\x12\x03\x03\x04\n\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x03\x0b\x0e\n\
\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\x11\x12\n\x0b\n\x04\x04\0\x08\0\
\x12\x03\x04\x044\n\x0c\n\x05\x04\0\x08\0\x01\x12\x03\x04\n\x1a\n\x0b\n\
\x04\x04\0\x02\x01\x12\x03\x04\x1d2\n\x0c\n\x05\x04\0\x02\x01\x05\x12\
\x03\x04\x1d#\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x04$-\n\x0c\n\x05\
\x04\0\x02\x01\x03\x12\x03\x0401\n\x0b\n\x04\x04\0\x08\x01\x12\x03\x05\
\x043\n\x0c\n\x05\x04\0\x08\x01\x01\x12\x03\x05\n\x1a\n\x0b\n\x04\x04\0\
\x02\x02\x12\x03\x05\x1d1\n\x0c\n\x05\x04\0\x02\x02\x05\x12\x03\x05\x1d\
\"\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x05#,\n\x0c\n\x05\x04\0\x02\x02\
\x03\x12\x03\x05/0\n\x0b\n\x04\x04\0\x08\x02\x12\x03\x06\x048\n\x0c\n\
\x05\x04\0\x08\x02\x01\x12\x03\x06\n\x1c\n\x0b\n\x04\x04\0\x02\x03\x12\
\x03\x06\x1f6\n\x0c\n\x05\x04\0\x02\x03\x05\x12\x03\x06\x1f%\n\x0c\n\x05\
\x04\0\x02\x03\x01\x12\x03\x06&1\n\x0c\n\x05\x04\0\x02\x03\x03\x12\x03\
\x0645\n\x0b\n\x04\x04\0\x08\x03\x12\x03\x07\x044\n\x0c\n\x05\x04\0\x08\
\x03\x01\x12\x03\x07\n\x1b\n\x0b\n\x04\x04\0\x02\x04\x12\x03\x07\x1e2\n\
\x0c\n\x05\x04\0\x02\x04\x05\x12\x03\x07\x1e\"\n\x0c\n\x05\x04\0\x02\x04\
\x01\x12\x03\x07#-\n\x0c\n\x05\x04\0\x02\x04\x03\x12\x03\x0701b\x06proto\
eJ\xa9\x03\n\x06\x12\x04\0\0\x07\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\
\n\x02\x04\0\x12\x04\x01\0\x07\x01\n\n\n\x03\x04\0\x01\x12\x03\x01\x08\
\x10\n\x0b\n\x04\x04\0\x02\0\x12\x03\x02\x04\x13\n\x0c\n\x05\x04\0\x02\0\
\x05\x12\x03\x02\x04\n\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x02\x0b\x0e\n\
\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x02\x11\x12\n\x0b\n\x04\x04\0\x08\0\
\x12\x03\x03\x044\n\x0c\n\x05\x04\0\x08\0\x01\x12\x03\x03\n\x1a\n\x0b\n\
\x04\x04\0\x02\x01\x12\x03\x03\x1d2\n\x0c\n\x05\x04\0\x02\x01\x05\x12\
\x03\x03\x1d#\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x03$-\n\x0c\n\x05\
\x04\0\x02\x01\x03\x12\x03\x0301\n\x0b\n\x04\x04\0\x08\x01\x12\x03\x04\
\x043\n\x0c\n\x05\x04\0\x08\x01\x01\x12\x03\x04\n\x1a\n\x0b\n\x04\x04\0\
\x02\x02\x12\x03\x04\x1d1\n\x0c\n\x05\x04\0\x02\x02\x05\x12\x03\x04\x1d\
\"\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x04#,\n\x0c\n\x05\x04\0\x02\x02\
\x03\x12\x03\x04/0\n\x0b\n\x04\x04\0\x08\x02\x12\x03\x05\x048\n\x0c\n\
\x05\x04\0\x08\x02\x01\x12\x03\x05\n\x1c\n\x0b\n\x04\x04\0\x02\x03\x12\
\x03\x05\x1f6\n\x0c\n\x05\x04\0\x02\x03\x05\x12\x03\x05\x1f%\n\x0c\n\x05\
\x04\0\x02\x03\x01\x12\x03\x05&1\n\x0c\n\x05\x04\0\x02\x03\x03\x12\x03\
\x0545\n\x0b\n\x04\x04\0\x08\x03\x12\x03\x06\x044\n\x0c\n\x05\x04\0\x08\
\x03\x01\x12\x03\x06\n\x1b\n\x0b\n\x04\x04\0\x02\x04\x12\x03\x06\x1e2\n\
\x0c\n\x05\x04\0\x02\x04\x05\x12\x03\x06\x1e\"\n\x0c\n\x05\x04\0\x02\x04\
\x01\x12\x03\x06#-\n\x0c\n\x05\x04\0\x02\x04\x03\x12\x03\x0601b\x06proto\
3\
";

View File

@ -1,5 +1,4 @@
syntax = "proto3";
message KeyValue {
string key = 1;
oneof one_of_str_value { string str_value = 2; };

View File

@ -313,24 +313,24 @@ static file_descriptor_proto_data: &'static [u8] = b"\
\x01(\tR\x05email\x12\x12\n\x04name\x18\x02\x20\x01(\tR\x04name\x12#\n\
\x06status\x18\x03\x20\x01(\x0e2\x0b.UserStatusR\x06status*1\n\nUserStat\
us\x12\x0b\n\x07Unknown\x10\0\x12\t\n\x05Login\x10\x01\x12\x0b\n\x07Expi\
red\x10\x02J\xe2\x02\n\x06\x12\x04\0\0\n\x01\n\x08\n\x01\x0c\x12\x03\0\0\
\x12\n\n\n\x02\x04\0\x12\x04\x01\0\x05\x01\n\n\n\x03\x04\0\x01\x12\x03\
\x01\x08\x12\n\x0b\n\x04\x04\0\x02\0\x12\x03\x02\x04\x15\n\x0c\n\x05\x04\
\0\x02\0\x05\x12\x03\x02\x04\n\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x02\
\x0b\x10\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x02\x13\x14\n\x0b\n\x04\x04\
\0\x02\x01\x12\x03\x03\x04\x14\n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03\x03\
\x04\n\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x03\x0b\x0f\n\x0c\n\x05\x04\
\0\x02\x01\x03\x12\x03\x03\x12\x13\n\x0b\n\x04\x04\0\x02\x02\x12\x03\x04\
\x04\x1a\n\x0c\n\x05\x04\0\x02\x02\x06\x12\x03\x04\x04\x0e\n\x0c\n\x05\
\x04\0\x02\x02\x01\x12\x03\x04\x0f\x15\n\x0c\n\x05\x04\0\x02\x02\x03\x12\
\x03\x04\x18\x19\n\n\n\x02\x05\0\x12\x04\x06\0\n\x01\n\n\n\x03\x05\0\x01\
\x12\x03\x06\x05\x0f\n\x0b\n\x04\x05\0\x02\0\x12\x03\x07\x04\x10\n\x0c\n\
\x05\x05\0\x02\0\x01\x12\x03\x07\x04\x0b\n\x0c\n\x05\x05\0\x02\0\x02\x12\
\x03\x07\x0e\x0f\n\x0b\n\x04\x05\0\x02\x01\x12\x03\x08\x04\x0e\n\x0c\n\
\x05\x05\0\x02\x01\x01\x12\x03\x08\x04\t\n\x0c\n\x05\x05\0\x02\x01\x02\
\x12\x03\x08\x0c\r\n\x0b\n\x04\x05\0\x02\x02\x12\x03\t\x04\x10\n\x0c\n\
\x05\x05\0\x02\x02\x01\x12\x03\t\x04\x0b\n\x0c\n\x05\x05\0\x02\x02\x02\
\x12\x03\t\x0e\x0fb\x06proto3\
red\x10\x02J\xe2\x02\n\x06\x12\x04\0\0\x0b\x01\n\x08\n\x01\x0c\x12\x03\0\
\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x06\x01\n\n\n\x03\x04\0\x01\x12\x03\
\x02\x08\x12\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x04\x15\n\x0c\n\x05\x04\
\0\x02\0\x05\x12\x03\x03\x04\n\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x03\
\x0b\x10\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\x13\x14\n\x0b\n\x04\x04\
\0\x02\x01\x12\x03\x04\x04\x14\n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03\x04\
\x04\n\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x04\x0b\x0f\n\x0c\n\x05\x04\
\0\x02\x01\x03\x12\x03\x04\x12\x13\n\x0b\n\x04\x04\0\x02\x02\x12\x03\x05\
\x04\x1a\n\x0c\n\x05\x04\0\x02\x02\x06\x12\x03\x05\x04\x0e\n\x0c\n\x05\
\x04\0\x02\x02\x01\x12\x03\x05\x0f\x15\n\x0c\n\x05\x04\0\x02\x02\x03\x12\
\x03\x05\x18\x19\n\n\n\x02\x05\0\x12\x04\x07\0\x0b\x01\n\n\n\x03\x05\0\
\x01\x12\x03\x07\x05\x0f\n\x0b\n\x04\x05\0\x02\0\x12\x03\x08\x04\x10\n\
\x0c\n\x05\x05\0\x02\0\x01\x12\x03\x08\x04\x0b\n\x0c\n\x05\x05\0\x02\0\
\x02\x12\x03\x08\x0e\x0f\n\x0b\n\x04\x05\0\x02\x01\x12\x03\t\x04\x0e\n\
\x0c\n\x05\x05\0\x02\x01\x01\x12\x03\t\x04\t\n\x0c\n\x05\x05\0\x02\x01\
\x02\x12\x03\t\x0c\r\n\x0b\n\x04\x05\0\x02\x02\x12\x03\n\x04\x10\n\x0c\n\
\x05\x05\0\x02\x02\x01\x12\x03\n\x04\x0b\n\x0c\n\x05\x05\0\x02\x02\x02\
\x12\x03\n\x0e\x0fb\x06proto3\
";
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;

View File

@ -1,4 +1,5 @@
syntax = "proto3";
message UserDetail {
string email = 1;
string name = 2;

View File

@ -29,6 +29,7 @@ impl ProtoGen {
fn write_proto_files(crate_infos: &Vec<CrateProtoInfo>) {
for crate_info in crate_infos {
let dir = crate_info.inner.proto_file_output_dir();
remove_everything_in_dir(dir.as_str());
crate_info.files.iter().for_each(|info| {
let proto_file_path = format!("{}/{}.proto", dir, &info.file_name);
save_content_to_file_with_diff_prompt(
@ -130,8 +131,14 @@ fn run_rust_protoc(crate_infos: &Vec<CrateProtoInfo>) {
}
}
use std::path::Path;
use std::process::Command;
fn run_flutter_protoc(crate_infos: &Vec<CrateProtoInfo>, package_info: &FlutterProtobufInfo) {
let model_dir = package_info.model_dir();
let removed_dir = format!("{}/", model_dir);
remove_everything_in_dir(removed_dir.as_str());
for crate_info in crate_infos {
let proto_path = crate_info.inner.proto_file_output_dir();
walk_dir(
@ -149,3 +156,18 @@ fn run_flutter_protoc(crate_infos: &Vec<CrateProtoInfo>, package_info: &FlutterP
);
}
}
fn remove_everything_in_dir(dir: &str) {
if !Path::new(dir).exists() {
if cmd_lib::run_cmd! {
rm -rf ${dir}
mkdir ${dir}
}
.is_err()
{
panic!("Reset protobuf directory failed")
};
} else {
std::fs::create_dir_all(dir).unwrap();
}
}