build.rs 590 B

12345678910111213141516
  1. use lib_infra::code_gen;
  2. use lib_infra::code_gen::dart_event;
  3. fn main() {
  4. code_gen::protobuf_file::gen(env!("CARGO_PKG_NAME"), "./src/protobuf/proto");
  5. #[cfg(feature = "flutter")]
  6. copy_dart_event_files();
  7. }
  8. #[cfg(feature = "flutter")]
  9. fn copy_dart_event_files() {
  10. let workspace_dir = std::env::var("CARGO_MAKE_WORKING_DIRECTORY").unwrap();
  11. let flutter_sdk_path = std::env::var("FLUTTER_FLOWY_SDK_PATH").unwrap();
  12. let output_file = format!("{}/{}/lib/dispatch/code_gen.dart", workspace_dir, flutter_sdk_path);
  13. dart_event::write_dart_event_file(&output_file);
  14. }