chore: write dart_event file

This commit is contained in:
appflowy
2022-02-16 10:00:31 +08:00
parent bf3a0b6e5b
commit cd013529d4
29 changed files with 177 additions and 102 deletions

View File

@ -29,8 +29,8 @@ dart-notify = {path = "../dart-notify" }
flowy-derive = {path = "../../../shared-lib/flowy-derive" }
[features]
default = ["flowy-sdk/dart"]
flutter = ["dart-notify/dart"]
default = ["flowy-sdk/dart", "dart-notify/dart", "flutter"]
flutter = []
http_server = ["flowy-sdk/http_server", "flowy-sdk/use_bunyan"]
#use_serde = ["bincode"]
#use_protobuf= ["protobuf"]

View File

@ -1,5 +1,16 @@
use lib_infra::code_gen;
use lib_infra::code_gen::dart_event;
fn main() {
code_gen::protobuf_file::gen(env!("CARGO_PKG_NAME"), "./src/protobuf/proto");
#[cfg(feature = "flutter")]
copy_dart_event_files();
}
#[cfg(feature = "flutter")]
fn copy_dart_event_files() {
let workspace_dir = std::env::var("CARGO_MAKE_WORKING_DIRECTORY").unwrap();
let flutter_sdk_path = std::env::var("FLUTTER_FLOWY_SDK_PATH").unwrap();
let output_file = format!("{}/{}/lib/dispatch/code_gen.dart", workspace_dir, flutter_sdk_path);
dart_event::write_dart_event_file(&output_file);
}