flutter.toml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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 = ["code_generation", "set-app-version", "flutter-build", "copy-to-product"] }
  8. script_runner = "@shell"
  9. [tasks.appflowy-windows]
  10. dependencies = ["flowy-sdk-release"]
  11. run_task = { name = ["code_generation", "set-app-version", "flutter-build", "copy-to-product"] }
  12. [tasks.appflowy-linux]
  13. dependencies = ["flowy-sdk-release"]
  14. run_task = { name = ["code_generation", "set-app-version", "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 = ["code_generation", "set-app-version", "flutter-build", "copy-to-product"] }
  23. script_runner = "@shell"
  24. [tasks.appflowy-windows-dev]
  25. dependencies = ["flowy-sdk-dev"]
  26. run_task = { name = ["code_generation", "set-app-version", "flutter-build", "copy-to-product"] }
  27. [tasks.appflowy-linux-dev]
  28. dependencies = ["flowy-sdk-dev"]
  29. run_task = { name = ["code_generation", "set-app-version", "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/${APP_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/${APP_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/${APP_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. [tasks.set-app-version]
  83. script = [
  84. """
  85. if is_empty ${APP_VERSION}
  86. APP_VERSION = set ${CURRENT_APP_VERSION}
  87. set_env APP_VERSION ${CURRENT_APP_VERSION}
  88. end
  89. echo APP_VERSION: ${APP_VERSION}
  90. """,
  91. ]
  92. script_runner = "@duckscript"
  93. # The following tasks will create an archive that will be used on the GitHub Releases section
  94. # The archives are created using different compression programs depending on the target OS
  95. # The archive will be composed of all files that are located in the /Release/AppFlowy directory
  96. [tasks.create-release-archive]
  97. mac_alias = "create-release-archive-macos"
  98. windows_alias = "create-release-archive-windows"
  99. linux_alias = "create-release-archive-linux"
  100. [tasks.create-release-archive-linux]
  101. script = [
  102. "cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/product/${APP_VERSION}/${TARGET_OS}/Release",
  103. "tar -czf ${PRODUCT_NAME}-${TARGET_OS}-x86.tar.gz *"
  104. ]
  105. [tasks.create-release-archive-windows]
  106. script = [
  107. # TODO
  108. # "cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/product/${VERSION}/${TARGET_OS}/Release/${PRODUCT_NAME}",
  109. # "tar -czf ${PRODUCT_NAME}-${TARGET_OS}-x86.tar.gz *"
  110. ]
  111. [tasks.create-release-archive-macos]
  112. script = [
  113. # TODO
  114. # "cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/product/${VERSION}/${TARGET_OS}/Release/${PRODUCT_NAME}",
  115. # "tar -czf ${PRODUCT_NAME}-${TARGET_OS}-x86.tar.gz *"
  116. ]
  117. [tasks.flutter-build]
  118. script = [
  119. """
  120. cd app_flowy/
  121. flutter clean
  122. flutter pub get
  123. flutter build ${TARGET_OS} --${BUILD_FLAG} --build-name=${APP_VERSION}
  124. """,
  125. ]
  126. script_runner = "@shell"
  127. [tasks.flutter-build.linux]
  128. script = [
  129. """
  130. cd app_flowy/
  131. flutter clean
  132. flutter pub get
  133. flutter build ${TARGET_OS} --${BUILD_FLAG}
  134. """,
  135. ]
  136. script_runner = "@shell"
  137. [tasks.flutter-build.windows]
  138. script = [
  139. """
  140. cd app_flowy
  141. exec cmd.exe /c flutter clean
  142. exec cmd.exe /c flutter pub get
  143. exec cmd.exe /c flutter build ${TARGET_OS} --${BUILD_FLAG}
  144. """,
  145. ]
  146. script_runner = "@duckscript"
  147. [tasks.code_generation]
  148. script_runner = "@shell"
  149. script = [
  150. """
  151. cd app_flowy
  152. flutter clean
  153. flutter packages pub get
  154. flutter packages pub run easy_localization:generate -S assets/translations/ -f keys -o locale_keys.g.dart -S assets/translations -s en.json
  155. flutter packages pub run build_runner build --delete-conflicting-outputs
  156. """
  157. ]
  158. [tasks.code_generation.windows]
  159. script_runner = "@duckscript"
  160. script = [
  161. """
  162. cd ./app_flowy/
  163. exec cmd.exe /c flutter clean
  164. exec cmd.exe /c flutter packages pub get
  165. 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
  166. exec cmd.exe /c flutter packages pub run build_runner build --delete-conflicting-outputs
  167. """
  168. ]