protobuf.toml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. end
  28. ret = which protoc-gen-dart
  29. if is_empty ${ret}
  30. home_dir = get_home_dir
  31. echo Please add '${home_dir}\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\bin' into PATH env var
  32. exit -1
  33. end
  34. """
  35. script_runner = "@duckscript"
  36. [tasks.install_protobuf_compiler]
  37. script = """
  38. echo "Install protoc_plugin (Dart)"
  39. dart pub global activate protoc_plugin
  40. """
  41. script_runner = "@shell"
  42. [tasks.install_protobuf_compiler.linux]
  43. script = """
  44. echo "Install protoc_plugin (Dart)"
  45. dart pub global activate protoc_plugin
  46. """
  47. script_runner = "@shell"
  48. [tasks.gen_pb_file]
  49. script = [
  50. """
  51. flowy_tool=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/scripts/flowy-tool/Cargo.toml
  52. rust_lib=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/
  53. shared_lib=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/../shared-lib
  54. flutter_lib=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/packages
  55. derive_meta=${shared_lib}/flowy-derive/src/derive_cache/derive_cache.rs
  56. flutter_package_lib=${flutter_lib}/flowy_sdk/lib
  57. cargo run \
  58. --manifest-path ${flowy_tool} pb-gen \
  59. --rust_sources ${rust_lib} ${shared_lib} \
  60. --derive_meta=${derive_meta} \
  61. --flutter_package_lib=${flutter_package_lib}
  62. """,
  63. ]
  64. script_runner = "@shell"
  65. [tasks.gen_pb_file.windows]
  66. script = [
  67. """
  68. flowy_tool=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/scripts/flowy-tool/Cargo.toml
  69. rust_source=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/
  70. # rust_lib=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib
  71. shared_lib=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/../shared-lib
  72. flutter_lib=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/packages
  73. derive_meta=set ${shared_lib}/flowy-derive/src/derive_cache/derive_cache.rs
  74. flutter_package_lib=set ${flutter_lib}/flowy_sdk/lib
  75. exec cmd /c cargo run \
  76. --manifest-path ${flowy_tool} pb-gen \
  77. --rust_source=${rust_source} \
  78. --derive_meta=${derive_meta} \
  79. --flutter_package_lib=${flutter_package_lib}
  80. """,
  81. ]
  82. script_runner = "@duckscript"
  83. [tasks.gen_dart_event]
  84. script = [
  85. """
  86. flowy_tool=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/scripts/flowy-tool/Cargo.toml
  87. flutter_lib=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/packages
  88. rust_source=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/
  89. output=${flutter_lib}/flowy_sdk/lib/dispatch/dart_event.dart
  90. cargo run \
  91. --manifest-path ${flowy_tool} dart-event \
  92. --rust_sources=${rust_source} \
  93. --output=${output}
  94. """,
  95. ]
  96. script_runner = "@shell"
  97. [tasks.gen_dart_event.windows]
  98. script = [
  99. """
  100. flowy_tool=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/scripts/flowy-tool/Cargo.toml
  101. flutter_lib=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/packages
  102. rust_source=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/
  103. output=set ${flutter_lib}/flowy_sdk/lib/dispatch/dart_event.dart
  104. exec cmd.exe /c cargo run \
  105. --manifest-path ${flowy_tool} dart-event \
  106. --rust_source=${rust_source} \
  107. --output=${output}
  108. """,
  109. ]
  110. script_runner = "@duckscript"