pb.toml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. [tasks.pb_init_setup_dev]
  2. description = "Setup protobuf"
  3. script = [
  4. """
  5. brew tap dart-lang/dart
  6. brew install dart
  7. pub global activate protoc_plugin
  8. cargo install --force --version 2.18.0 protobuf-codegen
  9. """,
  10. ]
  11. script_runner = "@shell"
  12. [tasks.gen_pb_file]
  13. script = [
  14. """
  15. pb_gen_exec=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/scripts/tool/rust-tool/Cargo.toml
  16. proto_source_file=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/flowy-store/src/entities/
  17. proto_define_dir=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/flowy-protobuf/define
  18. derive_file=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/flowy-ast/src/auto_gen_file/category_from_str.rs
  19. rust_mod_file=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/flowy-protobuf/src/model/mod.rs
  20. flutter_mod_file=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/flutter-lib/packages/flowy_protobuf/lib/all.dart
  21. cargo run --manifest-path ${pb_gen_exec} pb-gen -i=${proto_source_file} --derive_file=${derive_file} --proto_define_dir=${proto_define_dir} --rust_mod_file=${rust_mod_file} --flutter_mod_file=${flutter_mod_file}
  22. """,
  23. ]
  24. script_runner = "@shell"
  25. [tasks.gen_rust_pb]
  26. script = [
  27. """
  28. protoc --rust_out=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/flowy-protobuf/src/model \
  29. --proto_path=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/flowy-protobuf/define \
  30. ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/flowy-protobuf/define/*.proto
  31. """,
  32. ]
  33. script_runner = "@shell"
  34. [tasks.gen_dart_pb]
  35. script = [
  36. """
  37. dart_path=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/flutter-lib/packages/flowy_protobuf/lib/model
  38. pb_define_path=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/flowy-protobuf/define
  39. pb_proto_files=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/flowy-protobuf/define/*.proto
  40. rm -rf ${dart_path}/*
  41. protoc --dart_out=${dart_path} --proto_path=${pb_define_path} ${pb_proto_files}
  42. """,
  43. ]
  44. script_runner = "@shell"