protobuf.toml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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.check_protoc_cmd]
  46. script = [
  47. """
  48. ret = which protoc
  49. if is_empty ${ret}
  50. echo Please make sure <protoc_installation_folder>/bin/ is in PATH env var
  51. echo See BUILD_ON_{LINUX|WINDOWS}.md for how to get protoc
  52. exit -1
  53. end
  54. """,
  55. ]
  56. script_runner = "@duckscript"
  57. [tasks.gen_pb_file]
  58. script = [
  59. """
  60. flowy_tool=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/scripts/flowy-tool/Cargo.toml
  61. rust_lib=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/
  62. shared_lib=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/../shared-lib
  63. flutter_lib=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/packages
  64. derive_meta=${shared_lib}/flowy-derive/src/derive_cache/derive_cache.rs
  65. flutter_package_lib=${flutter_lib}/flowy_sdk/lib
  66. cargo run \
  67. --manifest-path ${flowy_tool} pb-gen \
  68. --rust_sources ${rust_lib} ${shared_lib} \
  69. --derive_meta=${derive_meta} \
  70. --flutter_package_lib=${flutter_package_lib}
  71. """,
  72. ]
  73. script_runner = "@shell"
  74. [tasks.gen_pb_file.windows]
  75. script = [
  76. """
  77. flowy_tool=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/scripts/flowy-tool/Cargo.toml
  78. rust_source=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/
  79. # rust_lib=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib
  80. shared_lib=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/../shared-lib
  81. flutter_lib=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/packages
  82. derive_meta=set ${shared_lib}/flowy-derive/src/derive_cache/derive_cache.rs
  83. flutter_package_lib=set ${flutter_lib}/flowy_sdk/lib
  84. exec cmd /c cargo run \
  85. --manifest-path ${flowy_tool} pb-gen \
  86. --rust_source=${rust_source} \
  87. --derive_meta=${derive_meta} \
  88. --flutter_package_lib=${flutter_package_lib}
  89. """,
  90. ]
  91. script_runner = "@duckscript"
  92. [tasks.gen_dart_event]
  93. script = [
  94. """
  95. flowy_tool=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/scripts/flowy-tool/Cargo.toml
  96. flutter_lib=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/packages
  97. rust_source=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/
  98. output=${flutter_lib}/flowy_sdk/lib/dispatch/dart_event.dart
  99. cargo run \
  100. --manifest-path ${flowy_tool} dart-event \
  101. --rust_sources=${rust_source} \
  102. --output=${output}
  103. """,
  104. ]
  105. script_runner = "@shell"
  106. [tasks.gen_dart_event.windows]
  107. script = [
  108. """
  109. flowy_tool=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/scripts/flowy-tool/Cargo.toml
  110. flutter_lib=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/packages
  111. rust_source=set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/
  112. output=set ${flutter_lib}/flowy_sdk/lib/dispatch/dart_event.dart
  113. exec cmd.exe /c cargo run \
  114. --manifest-path ${flowy_tool} dart-event \
  115. --rust_source=${rust_source} \
  116. --output=${output}
  117. """,
  118. ]
  119. script_runner = "@duckscript"