protobuf.toml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. [tasks.install_protobuf]
  2. mac_alias = "install-protobuf"
  3. windows_alias = "install-protobuf-windows"
  4. linux_alias = "install-protobuf"
  5. [tasks.install-protobuf]
  6. condition_script = [
  7. """
  8. if ! command -v protoc-gen-dart
  9. then
  10. exit 0
  11. fi
  12. # installed
  13. exit 1
  14. """,
  15. ]
  16. run_task = { name = ["install_protobuf_compiler"] }
  17. [tasks.install-protobuf-windows]
  18. script = """
  19. ret = which dart
  20. if is_empty ${ret}
  21. echo Please make sure flutter/dart is properly installed and in PATH env var
  22. exit -1
  23. end
  24. ret = which protoc-gen-dart
  25. if is_empty ${ret}
  26. exec cmd.exe /c dart pub global activate protoc_plugin
  27. home_dir = get_home_dir
  28. echo Please add '${home_dir}\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\bin' into PATH env var
  29. exit -1
  30. end
  31. """
  32. script_runner = "@duckscript"
  33. [tasks.install_protobuf_compiler]
  34. script = """
  35. echo "Install protoc_plugin (Dart)"
  36. dart pub global activate protoc_plugin
  37. """
  38. script_runner = "@shell"
  39. [tasks.install_protobuf_compiler.linux]
  40. script = """
  41. echo "Install protoc_plugin (Dart)"
  42. dart pub global activate protoc_plugin
  43. """
  44. script_runner = "@shell"
  45. [tasks.gen_pb_file]
  46. script = [
  47. """
  48. flowy_tool=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/scripts/flowy-tool/Cargo.toml
  49. rust_lib=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/
  50. shared_lib=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/../shared-lib
  51. flutter_lib=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/packages
  52. derive_meta=${shared_lib}/flowy-derive/src/derive_cache/derive_cache.rs
  53. flutter_package_lib=${flutter_lib}/flowy_sdk/lib
  54. cargo run \
  55. --manifest-path ${flowy_tool} pb-gen \
  56. --rust_sources ${rust_lib} ${shared_lib} \
  57. --derive_meta=${derive_meta} \
  58. --flutter_package_lib=${flutter_package_lib}
  59. """,
  60. ]
  61. script_runner = "@shell"
  62. [tasks.gen_pb_file.windows]
  63. script = [
  64. """
  65. flowy_tool=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/scripts/flowy-tool/Cargo.toml
  66. rust_source=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/
  67. # rust_lib=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib
  68. shared_lib=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/../shared-lib
  69. flutter_lib=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/packages
  70. derive_meta=set ${shared_lib}/flowy-derive/src/derive_cache/derive_cache.rs
  71. flutter_package_lib=set ${flutter_lib}/flowy_sdk/lib
  72. exec cmd /c cargo run \
  73. --manifest-path ${flowy_tool} pb-gen \
  74. --rust_source=${rust_source} \
  75. --derive_meta=${derive_meta} \
  76. --flutter_package_lib=${flutter_package_lib}
  77. """,
  78. ]
  79. script_runner = "@duckscript"
  80. [tasks.gen_dart_event]
  81. script = [
  82. """
  83. flowy_tool=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/scripts/flowy-tool/Cargo.toml
  84. flutter_lib=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/packages
  85. rust_source=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/
  86. output=${flutter_lib}/flowy_sdk/lib/dispatch/dart_event.dart
  87. cargo run \
  88. --manifest-path ${flowy_tool} dart-event \
  89. --rust_sources=${rust_source} \
  90. --output=${output}
  91. """,
  92. ]
  93. script_runner = "@shell"
  94. [tasks.gen_dart_event.windows]
  95. script = [
  96. """
  97. flowy_tool=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/scripts/flowy-tool/Cargo.toml
  98. flutter_lib=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/packages
  99. rust_source=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/
  100. output=set ${flutter_lib}/flowy_sdk/lib/dispatch/dart_event.dart
  101. exec cmd.exe /c cargo run \
  102. --manifest-path ${flowy_tool} dart-event \
  103. --rust_source=${rust_source} \
  104. --output=${output}
  105. """,
  106. ]
  107. script_runner = "@duckscript"