flutter.toml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. [tasks.appflowy]
  2. mac_alias = "appflowy-macos"
  3. windows_alias = "appflowy-windows"
  4. linux_alias = "appflowy-linux"
  5. [tasks.appflowy-macos]
  6. dependencies = ["appflowy-core-release"]
  7. run_task = { name = [
  8. "code_generation",
  9. "set-app-version",
  10. "flutter-build",
  11. "copy-to-product",
  12. ] }
  13. script_runner = "@shell"
  14. [tasks.appflowy-macos-universal]
  15. run_task = { name = [
  16. "code_generation",
  17. "set-app-version",
  18. "flutter-build",
  19. "copy-to-product",
  20. ] }
  21. script_runner = "@shell"
  22. [tasks.appflowy-windows]
  23. dependencies = ["appflowy-core-release"]
  24. run_task = { name = [
  25. "code_generation",
  26. "set-app-version",
  27. "flutter-build",
  28. "copy-to-product",
  29. ] }
  30. [tasks.appflowy-linux]
  31. dependencies = ["appflowy-core-release"]
  32. run_task = { name = [
  33. "code_generation",
  34. "set-app-version",
  35. "flutter-build",
  36. "copy-to-product",
  37. "create-release-archive",
  38. ] }
  39. script_runner = "@shell"
  40. [tasks.appflowy-dev]
  41. mac_alias = "appflowy-macos-dev"
  42. windows_alias = "appflowy-windows-dev"
  43. linux_alias = "appflowy-linux-dev"
  44. [tasks.appflowy-ios-dev]
  45. dependencies = ["appflowy-core-dev-ios"]
  46. run_task = { name = [
  47. "code_generation",
  48. "set-app-version",
  49. "flutter-build",
  50. ] }
  51. script_runner = "@shell"
  52. [tasks.appflowy-macos-dev]
  53. dependencies = ["appflowy-core-dev"]
  54. run_task = { name = [
  55. "code_generation",
  56. "set-app-version",
  57. "flutter-build",
  58. "copy-to-product",
  59. ] }
  60. script_runner = "@shell"
  61. [tasks.appflowy-windows-dev]
  62. dependencies = ["appflowy-core-dev"]
  63. run_task = { name = [
  64. "code_generation",
  65. "set-app-version",
  66. "flutter-build",
  67. "copy-to-product",
  68. ] }
  69. [tasks.appflowy-linux-dev]
  70. dependencies = ["appflowy-core-dev"]
  71. run_task = { name = [
  72. "code_generation",
  73. "set-app-version",
  74. "flutter-build",
  75. "copy-to-product",
  76. ] }
  77. script_runner = "@shell"
  78. [tasks.copy-to-product]
  79. mac_alias = "copy-to-product-macos"
  80. windows_alias = "copy-to-product-windows"
  81. linux_alias = "copy-to-product-linux"
  82. [tasks.copy-to-product-macos]
  83. script = [
  84. """
  85. product_path=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/product/${APP_VERSION}
  86. output_path=${product_path}/${TARGET_OS}/${FLUTTER_OUTPUT_DIR}
  87. if [ -d "${output_path}" ]; then
  88. rm -rf ${output_path}/
  89. fi
  90. mkdir -p ${output_path}
  91. product=${PRODUCT_NAME}.${PRODUCT_EXT}
  92. cp -R ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/build/${TARGET_OS}/Build/Products/${FLUTTER_OUTPUT_DIR}/${product} \
  93. ${output_path}/${product}
  94. """,
  95. ]
  96. script_runner = "@shell"
  97. [tasks.copy-to-product-linux]
  98. script = [
  99. """
  100. product_path=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/product/${APP_VERSION}
  101. output_path=${product_path}/${TARGET_OS}/${FLUTTER_OUTPUT_DIR}
  102. if [ -d "${output_path}" ]; then
  103. rm -rf ${output_path}/
  104. fi
  105. mkdir -p ${output_path}
  106. product=${PRODUCT_NAME}
  107. cp -R ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/build/${TARGET_OS}/${LINUX_ARCH}/${BUILD_FLAG}/bundle \
  108. ${output_path}/${product}
  109. cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/linux/appflowy.desktop.temp ${output_path}/${product}
  110. cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/assets/images/flowy_logo.svg ${output_path}/${product}
  111. """,
  112. ]
  113. script_runner = "@shell"
  114. [tasks.copy-to-product-windows]
  115. script = [
  116. """
  117. product_path= set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/product/${APP_VERSION}
  118. output_path= set ${product_path}/${TARGET_OS}
  119. if is_path_exists ${output_path}
  120. rm -r ${output_path}/
  121. fi
  122. mkdir ${output_path}
  123. product= set ${PRODUCT_NAME}
  124. glob_cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/build/${TARGET_OS}/runner/${FLUTTER_OUTPUT_DIR}/**/* \
  125. ${output_path}/${product}
  126. """,
  127. ]
  128. script_runner = "@duckscript"
  129. [tasks.set-app-version]
  130. script = ["""
  131. if is_empty ${APP_VERSION}
  132. APP_VERSION = set ${CURRENT_APP_VERSION}
  133. set_env APP_VERSION ${CURRENT_APP_VERSION}
  134. end
  135. echo APP_VERSION: ${APP_VERSION}
  136. """]
  137. script_runner = "@duckscript"
  138. # The following tasks will create an archive that will be used on the GitHub Releases section
  139. # The archives are created using different compression programs depending on the target OS
  140. # The archive will be composed of all files that are located in the /Release/AppFlowy directory
  141. [tasks.create-release-archive]
  142. mac_alias = "create-release-archive-macos"
  143. windows_alias = "create-release-archive-windows"
  144. linux_alias = "create-release-archive-linux"
  145. [tasks.create-release-archive-linux]
  146. script = [
  147. "cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/product/${APP_VERSION}/${TARGET_OS}/Release",
  148. "tar -czf ${PRODUCT_NAME}-${TARGET_OS}-x86.tar.gz *",
  149. ]
  150. [tasks.create-release-archive-windows]
  151. script = [
  152. # TODO
  153. # "cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/product/${VERSION}/${TARGET_OS}/Release/${PRODUCT_NAME}",
  154. # "tar -czf ${PRODUCT_NAME}-${TARGET_OS}-x86.tar.gz *"
  155. ]
  156. [tasks.create-release-archive-macos]
  157. script = [
  158. # TODO
  159. # "cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/product/${VERSION}/${TARGET_OS}/Release/${PRODUCT_NAME}",
  160. # "tar -czf ${PRODUCT_NAME}-${TARGET_OS}-x86.tar.gz *"
  161. ]
  162. [tasks.flutter-build]
  163. script = ["""
  164. cd appflowy_flutter/
  165. flutter pub get
  166. flutter build ${TARGET_OS} --${BUILD_FLAG} --verbose
  167. """]
  168. script_runner = "@shell"
  169. [tasks.flutter-build.windows]
  170. script = ["""
  171. cd appflowy_flutter
  172. exec cmd.exe /c flutter pub get
  173. exec cmd.exe /c flutter build ${TARGET_OS} --${BUILD_FLAG} --build-name=${APP_VERSION}
  174. """]
  175. script_runner = "@duckscript"
  176. [tasks.code_generation]
  177. script_runner = "@shell"
  178. script = [
  179. """
  180. cd appflowy_flutter
  181. flutter clean
  182. flutter pub get
  183. cd ../
  184. sh scripts/code_generation/generate.sh
  185. """
  186. ]
  187. [tasks.code_generation.windows]
  188. script_runner = "@duckscript"
  189. script = [
  190. """
  191. cd ./appflowy_flutter/
  192. exec cmd.exe /c flutter clean
  193. exec cmd.exe /c flutter pub get
  194. cd ../
  195. exec scripts/code_generation/generate.cmd
  196. """,
  197. ]
  198. [tasks.dry_code_generation]
  199. script_runner = "@shell"
  200. script = [
  201. """
  202. cd appflowy_flutter
  203. dart run easy_localization:generate -S assets/translations/ -f keys -o locale_keys.g.dart -S assets/translations -s en.json
  204. dart run build_runner build -d
  205. """,
  206. ]
  207. [tasks.dry_code_generation.windows]
  208. script_runner = "@duckscript"
  209. script = [
  210. """
  211. cd ./appflowy_flutter/
  212. exec cmd.exe /c dart run easy_localization:generate -S assets/translations/ -f keys -o locale_keys.g.dart -S assets/translations -s en.json
  213. exec cmd.exe /c dart run build_runner build -d
  214. """,
  215. ]