flutter.toml 6.2 KB

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