desktop.toml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. # cargo make --profile production task
  2. # Run the task with profile, e.g.
  3. # cargo make --profile development-mac appflowy-sdk-dev
  4. # cargo make --profile production-windows-x86 appflowy-sdk-dev
  5. [tasks.env_check]
  6. dependencies = ["echo_env", "install_flutter_protobuf"]
  7. condition = { env_set = [
  8. "BUILD_FLAG",
  9. "RUST_COMPILE_TARGET",
  10. "CRATE_TYPE",
  11. "TARGET_OS",
  12. ], channels = [
  13. "stable",
  14. ] }
  15. [tasks.appflowy-sdk-dev]
  16. mac_alias = "appflowy-sdk-dev-macos"
  17. windows_alias = "appflowy-sdk-dev-windows"
  18. linux_alias = "appflowy-sdk-dev-linux"
  19. [tasks.appflowy-sdk-dev-android]
  20. category = "Build"
  21. dependencies = ["env_check"]
  22. run_task = { name = [
  23. "setup-crate-type",
  24. "sdk-build-android",
  25. "restore-crate-type",
  26. ] }
  27. [tasks.appflowy-sdk-dev-macos]
  28. category = "Build"
  29. dependencies = ["env_check"]
  30. run_task = { name = [
  31. "setup-crate-type",
  32. "sdk-build",
  33. "post-desktop",
  34. "restore-crate-type",
  35. ] }
  36. [tasks.appflowy-sdk-dev-windows]
  37. category = "Build"
  38. dependencies = ["env_check"]
  39. run_task = { name = [
  40. "setup-crate-type",
  41. "sdk-build",
  42. "post-desktop",
  43. "restore-crate-type",
  44. ] }
  45. [tasks.appflowy-sdk-dev-linux]
  46. category = "Build"
  47. dependencies = ["env_check"]
  48. run_task = { name = [
  49. "setup-crate-type",
  50. "sdk-build",
  51. "post-desktop",
  52. "restore-crate-type",
  53. ] }
  54. #
  55. [tasks.sdk-build]
  56. private = true
  57. script = [
  58. """
  59. cd rust-lib/
  60. rustup show
  61. echo cargo build --package=dart-ffi --target ${RUST_COMPILE_TARGET} --features "${FLUTTER_DESKTOP_FEATURES}"
  62. cargo build --package=dart-ffi --target ${RUST_COMPILE_TARGET} --features "${FLUTTER_DESKTOP_FEATURES}"
  63. cd ../
  64. """,
  65. ]
  66. script_runner = "@shell"
  67. [tasks.sdk-build-android]
  68. private = true
  69. script = [
  70. """
  71. cd rust-lib/
  72. rustup show
  73. rustup target add aarch64-linux-android \
  74. armv7-linux-androideabi \
  75. i686-linux-android \
  76. x86_64-linux-android
  77. DEST=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/android/app/src/main/jniLibs
  78. rm -rf $DEST/arm64-v8a \
  79. $DEST/armeabi-v7a \
  80. $DEST/x86 \
  81. $DEST/x86_64
  82. cargo ndk \
  83. -t arm64-v8a \
  84. -t armeabi-v7a \
  85. -t x86 \
  86. -t x86_64 \
  87. -o $DEST build
  88. cd ../
  89. """,
  90. ]
  91. script_runner = "@shell"
  92. [tasks.sdk-build.windows]
  93. private = true
  94. script = [
  95. """
  96. cd rust-lib
  97. exec cargo build --package=dart-ffi --target ${RUST_COMPILE_TARGET} --features "${FLUTTER_DESKTOP_FEATURES}"
  98. cd ..
  99. """,
  100. ]
  101. script_runner = "@duckscript"
  102. #
  103. [tasks.appflowy-sdk-release]
  104. description = "Build flowy sdk in release mode"
  105. category = "Build"
  106. dependencies = ["env_check"]
  107. run_task = { name = [
  108. "setup-crate-type",
  109. "sdk-release-build",
  110. "post-desktop",
  111. "restore-crate-type",
  112. ] }
  113. #
  114. [tasks.sdk-release-build]
  115. script = [
  116. """
  117. cd rust-lib/
  118. cargo build --${BUILD_FLAG} --package=dart-ffi --target ${RUST_COMPILE_TARGET} --features "${FLUTTER_DESKTOP_FEATURES}"
  119. cd ../
  120. """,
  121. ]
  122. script_runner = "@shell"
  123. #
  124. [tasks.post-desktop]
  125. mac_alias = "post-desktop-macos"
  126. windows_alias = "post-desktop-windows"
  127. linux_alias = "post-desktop-linux"
  128. [tasks.post-desktop-macos]
  129. private = true
  130. script = [
  131. """
  132. echo "🚀 🚀 🚀 Flowy-SDK(macOS) build success"
  133. dart_ffi_dir= set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/packages/appflowy_backend/${TARGET_OS}
  134. lib = set lib${LIB_NAME}.${LIB_EXT}
  135. cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/target/${RUST_COMPILE_TARGET}/${BUILD_FLAG}/${lib} \
  136. ${dart_ffi_dir}/${lib}
  137. cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/binding.h \
  138. ${dart_ffi_dir}/Classes/binding.h
  139. """,
  140. ]
  141. script_runner = "@duckscript"
  142. [tasks.post-desktop-windows]
  143. private = true
  144. script = [
  145. """
  146. echo "🚀 🚀 🚀 Flowy-SDK(windows) build success"
  147. dart_ffi_dir= set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/windows/flutter/dart_ffi
  148. lib = set ${LIB_NAME}.${LIB_EXT}
  149. # copy dll
  150. cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/target/${RUST_COMPILE_TARGET}/${BUILD_FLAG}/${lib} \
  151. ${dart_ffi_dir}/${lib}
  152. # copy binding.h
  153. cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/binding.h \
  154. ${dart_ffi_dir}/binding.h
  155. """,
  156. ]
  157. script_runner = "@duckscript"
  158. [tasks.post-desktop-linux]
  159. private = true
  160. script = [
  161. """
  162. echo "🚀 🚀 🚀 Flowy-SDK(linux) build success"
  163. dart_ffi_dir= set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/linux/flutter/dart_ffi
  164. lib = set lib${LIB_NAME}.${LIB_EXT}
  165. # copy dll
  166. cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/target/${RUST_COMPILE_TARGET}/${BUILD_FLAG}/${lib} \
  167. ${dart_ffi_dir}/${lib}
  168. # copy binding.h
  169. cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/binding.h \
  170. ${dart_ffi_dir}/binding.h
  171. """,
  172. ]
  173. script_runner = "@duckscript"
  174. [tasks.build-test-lib]
  175. category = "Build"
  176. dependencies = ["env_check"]
  177. run_task = { name = [
  178. "setup-test-crate-type",
  179. "build-test-backend",
  180. "copy-to-sandbox-folder",
  181. "restore-test-crate-type",
  182. ] }
  183. [tasks.build-test-backend]
  184. mac_alias = "build-test-backend-default"
  185. windows_alias = "build-test-backend-widnows"
  186. linux_alias = "build-test-backend-default"
  187. [tasks.build-test-backend-default]
  188. private = true
  189. script = [
  190. """
  191. cd rust-lib/
  192. rustup show
  193. echo cargo build --package=dart-ffi --target ${TEST_COMPILE_TARGET} --features "${FLUTTER_DESKTOP_FEATURES}"
  194. RUST_LOG=${RUST_LOG} cargo build --package=dart-ffi --target ${TEST_COMPILE_TARGET} --features "${FLUTTER_DESKTOP_FEATURES}"
  195. cd ../
  196. """,
  197. ]
  198. script_runner = "@shell"
  199. [tasks.build-test-backend-widnows]
  200. private = true
  201. script = [
  202. """
  203. cd rust-lib/
  204. rustup show
  205. echo cargo build --package=dart-ffi --target ${TEST_COMPILE_TARGET} --features "${FLUTTER_DESKTOP_FEATURES}"
  206. RUST_LOG=${TEST_RUST_LOG} cargo build --package=dart-ffi --target ${TEST_COMPILE_TARGET} --features "${FLUTTER_DESKTOP_FEATURES}"
  207. cd ../
  208. """,
  209. ]
  210. script_runner = "@shell"
  211. [tasks.copy-to-sandbox-folder]
  212. mac_alias = "copy-to-sandbox-folder-default"
  213. windows_alias = "copy-to-sandbox-folder-windows"
  214. linux_alias = "copy-to-sandbox-folder-default"
  215. [tasks.copy-to-sandbox-folder-windows]
  216. private = true
  217. script = [
  218. """
  219. # Copy the appflowy_backend lib to system temp directory for flutter unit test.
  220. lib = set ${LIB_NAME}.${TEST_LIB_EXT}
  221. dest = set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/.sandbox/${lib}
  222. rm ${dest}
  223. cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/target/${TEST_COMPILE_TARGET}/${TEST_BUILD_FLAG}/${lib} \
  224. ${dest}
  225. """,
  226. ]
  227. script_runner = "@duckscript"
  228. [tasks.copy-to-sandbox-folder-default]
  229. private = true
  230. script = [
  231. """
  232. # Copy the appflowy_backend lib to system temp directory for flutter unit test.
  233. lib = set lib${LIB_NAME}.${TEST_LIB_EXT}
  234. dest = set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/.sandbox/${lib}
  235. rm ${dest}
  236. cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/target/${TEST_COMPILE_TARGET}/${TEST_BUILD_FLAG}/${lib} \
  237. ${dest}
  238. """,
  239. ]
  240. script_runner = "@duckscript"