flutter.toml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  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-ios",
  50. ] }
  51. script_runner = "@shell"
  52. [tasks.appflowy-android-dev]
  53. dependencies = ["appflowy-core-dev-android"]
  54. run_task = { name = [
  55. "code_generation",
  56. "set-app-version",
  57. "flutter-build-android",
  58. ] }
  59. script_runner = "@shell"
  60. [tasks.appflowy-macos-dev]
  61. dependencies = ["appflowy-core-dev"]
  62. run_task = { name = [
  63. "code_generation",
  64. "set-app-version",
  65. "flutter-build",
  66. "copy-to-product",
  67. ] }
  68. script_runner = "@shell"
  69. [tasks.appflowy-windows-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. [tasks.appflowy-linux-dev]
  78. dependencies = ["appflowy-core-dev"]
  79. run_task = { name = [
  80. "code_generation",
  81. "set-app-version",
  82. "flutter-build",
  83. "copy-to-product",
  84. ] }
  85. script_runner = "@shell"
  86. [tasks.copy-to-product]
  87. mac_alias = "copy-to-product-macos"
  88. windows_alias = "copy-to-product-windows"
  89. linux_alias = "copy-to-product-linux"
  90. [tasks.copy-to-product-macos]
  91. script = [
  92. """
  93. product_path=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/product/${APP_VERSION}
  94. output_path=${product_path}/${TARGET_OS}/${FLUTTER_OUTPUT_DIR}
  95. if [ -d "${output_path}" ]; then
  96. rm -rf ${output_path}/
  97. fi
  98. mkdir -p ${output_path}
  99. product=${PRODUCT_NAME}.${PRODUCT_EXT}
  100. cp -R ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/build/${TARGET_OS}/Build/Products/${FLUTTER_OUTPUT_DIR}/${product} \
  101. ${output_path}/${product}
  102. """,
  103. ]
  104. script_runner = "@shell"
  105. [tasks.copy-to-product-linux]
  106. script = [
  107. """
  108. product_path=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/product/${APP_VERSION}
  109. output_path=${product_path}/${TARGET_OS}/${FLUTTER_OUTPUT_DIR}
  110. if [ -d "${output_path}" ]; then
  111. rm -rf ${output_path}/
  112. fi
  113. mkdir -p ${output_path}
  114. product=${PRODUCT_NAME}
  115. cp -R ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/build/${TARGET_OS}/${LINUX_ARCH}/${BUILD_FLAG}/bundle \
  116. ${output_path}/${product}
  117. """,
  118. ]
  119. script_runner = "@shell"
  120. [tasks.copy-to-product-windows]
  121. script = [
  122. """
  123. product_path= set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/product/${APP_VERSION}
  124. output_path= set ${product_path}/${TARGET_OS}
  125. if is_path_exists ${output_path}
  126. rm -r ${output_path}/
  127. fi
  128. mkdir ${output_path}
  129. product= set ${PRODUCT_NAME}
  130. glob_cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/build/${TARGET_OS}/runner/${FLUTTER_OUTPUT_DIR}/**/* \
  131. ${output_path}/${product}
  132. """,
  133. ]
  134. script_runner = "@duckscript"
  135. [tasks.set-app-version]
  136. script = ["""
  137. if is_empty ${APP_VERSION}
  138. APP_VERSION = set ${CURRENT_APP_VERSION}
  139. set_env APP_VERSION ${CURRENT_APP_VERSION}
  140. end
  141. echo APP_VERSION: ${APP_VERSION}
  142. """]
  143. script_runner = "@duckscript"
  144. # The following tasks will create an archive that will be used on the GitHub Releases section
  145. # The archives are created using different compression programs depending on the target OS
  146. # The archive will be composed of all files that are located in the /Release/AppFlowy directory
  147. [tasks.create-release-archive]
  148. mac_alias = "create-release-archive-macos"
  149. windows_alias = "create-release-archive-windows"
  150. linux_alias = "create-release-archive-linux"
  151. [tasks.create-release-archive-linux]
  152. script = [
  153. # "cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/product/${APP_VERSION}/${TARGET_OS}/Release",
  154. # "tar -czf ${PRODUCT_NAME}-${TARGET_OS}-x86.tar.gz *",
  155. ]
  156. [tasks.create-release-archive-windows]
  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.create-release-archive-macos]
  163. script = [
  164. # TODO
  165. # "cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/product/${VERSION}/${TARGET_OS}/Release/${PRODUCT_NAME}",
  166. # "tar -czf ${PRODUCT_NAME}-${TARGET_OS}-x86.tar.gz *"
  167. ]
  168. [tasks.flutter-build]
  169. script = ["""
  170. cd appflowy_flutter/
  171. flutter pub get
  172. flutter build ${TARGET_OS} --${BUILD_FLAG} --verbose
  173. """]
  174. script_runner = "@shell"
  175. [tasks.flutter-build-ios]
  176. script = ["""
  177. cd appflowy_flutter/
  178. flutter pub get
  179. flutter build ipa --verbose
  180. """]
  181. script_runner = "@shell"
  182. [tasks.flutter-build-android]
  183. script = ["""
  184. cd appflowy_flutter/
  185. flutter pub get
  186. flutter build apk --split-per-abi --verbose
  187. """]
  188. script_runner = "@shell"
  189. [tasks.flutter-build.windows]
  190. script = ["""
  191. cd appflowy_flutter
  192. exec cmd.exe /c flutter pub get
  193. exec cmd.exe /c flutter build ${TARGET_OS} --${BUILD_FLAG} --build-name=${APP_VERSION}
  194. """]
  195. script_runner = "@duckscript"
  196. [tasks.code_generation]
  197. script_runner = "@shell"
  198. script = [
  199. """
  200. cd appflowy_flutter
  201. flutter clean
  202. flutter pub get
  203. cd ../
  204. sh scripts/code_generation/generate.sh
  205. """
  206. ]
  207. [tasks.code_generation.windows]
  208. script_runner = "@duckscript"
  209. script = [
  210. """
  211. cd ./appflowy_flutter/
  212. exec cmd.exe /c flutter clean
  213. exec cmd.exe /c flutter pub get
  214. cd ../
  215. exec scripts/code_generation/generate.cmd
  216. """,
  217. ]
  218. [tasks.dry_code_generation]
  219. script_runner = "@shell"
  220. script = [
  221. """
  222. cd appflowy_flutter
  223. dart run easy_localization:generate -S assets/translations/ -f keys -o locale_keys.g.dart -S assets/translations -s en.json
  224. dart run build_runner build -d
  225. """,
  226. ]
  227. [tasks.dry_code_generation.windows]
  228. script_runner = "@duckscript"
  229. script = [
  230. """
  231. cd ./appflowy_flutter/
  232. 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
  233. exec cmd.exe /c dart run build_runner build -d
  234. """,
  235. ]