flutter.toml 6.5 KB

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