flutter.toml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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. """,
  110. ]
  111. script_runner = "@shell"
  112. [tasks.copy-to-product-windows]
  113. script = [
  114. """
  115. product_path= set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/product/${APP_VERSION}
  116. output_path= set ${product_path}/${TARGET_OS}
  117. if is_path_exists ${output_path}
  118. rm -r ${output_path}/
  119. fi
  120. mkdir ${output_path}
  121. product= set ${PRODUCT_NAME}
  122. glob_cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/build/${TARGET_OS}/runner/${FLUTTER_OUTPUT_DIR}/**/* \
  123. ${output_path}/${product}
  124. """,
  125. ]
  126. script_runner = "@duckscript"
  127. [tasks.set-app-version]
  128. script = ["""
  129. if is_empty ${APP_VERSION}
  130. APP_VERSION = set ${CURRENT_APP_VERSION}
  131. set_env APP_VERSION ${CURRENT_APP_VERSION}
  132. end
  133. echo APP_VERSION: ${APP_VERSION}
  134. """]
  135. script_runner = "@duckscript"
  136. # The following tasks will create an archive that will be used on the GitHub Releases section
  137. # The archives are created using different compression programs depending on the target OS
  138. # The archive will be composed of all files that are located in the /Release/AppFlowy directory
  139. [tasks.create-release-archive]
  140. mac_alias = "create-release-archive-macos"
  141. windows_alias = "create-release-archive-windows"
  142. linux_alias = "create-release-archive-linux"
  143. [tasks.create-release-archive-linux]
  144. script = [
  145. # "cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/product/${APP_VERSION}/${TARGET_OS}/Release",
  146. # "tar -czf ${PRODUCT_NAME}-${TARGET_OS}-x86.tar.gz *",
  147. ]
  148. [tasks.create-release-archive-windows]
  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.create-release-archive-macos]
  155. script = [
  156. # TODO
  157. # "cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/product/${VERSION}/${TARGET_OS}/Release/${PRODUCT_NAME}",
  158. # "tar -czf ${PRODUCT_NAME}-${TARGET_OS}-x86.tar.gz *"
  159. ]
  160. [tasks.flutter-build]
  161. script = ["""
  162. cd appflowy_flutter/
  163. flutter pub get
  164. flutter build ${TARGET_OS} --${BUILD_FLAG} --verbose
  165. """]
  166. script_runner = "@shell"
  167. [tasks.flutter-build.windows]
  168. script = ["""
  169. cd appflowy_flutter
  170. exec cmd.exe /c flutter pub get
  171. exec cmd.exe /c flutter build ${TARGET_OS} --${BUILD_FLAG} --build-name=${APP_VERSION}
  172. """]
  173. script_runner = "@duckscript"
  174. [tasks.code_generation]
  175. script_runner = "@shell"
  176. script = [
  177. """
  178. cd appflowy_flutter
  179. flutter clean
  180. flutter pub get
  181. cd ../
  182. sh scripts/code_generation/generate.sh
  183. """
  184. ]
  185. [tasks.code_generation.windows]
  186. script_runner = "@duckscript"
  187. script = [
  188. """
  189. cd ./appflowy_flutter/
  190. exec cmd.exe /c flutter clean
  191. exec cmd.exe /c flutter pub get
  192. cd ../
  193. exec scripts/code_generation/generate.cmd
  194. """,
  195. ]
  196. [tasks.dry_code_generation]
  197. script_runner = "@shell"
  198. script = [
  199. """
  200. cd appflowy_flutter
  201. dart run easy_localization:generate -S assets/translations/ -f keys -o locale_keys.g.dart -S assets/translations -s en.json
  202. dart run build_runner build -d
  203. """,
  204. ]
  205. [tasks.dry_code_generation.windows]
  206. script_runner = "@duckscript"
  207. script = [
  208. """
  209. cd ./appflowy_flutter/
  210. 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
  211. exec cmd.exe /c dart run build_runner build -d
  212. """,
  213. ]