flutter.toml 6.5 KB

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