desktop.toml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. [tasks.desktop]
  2. category = "Build"
  3. dependencies = ["desktop-debug", "desktop-release", "post-desktop"]
  4. description = "Build desktop targets"
  5. [tasks.desktop-debug]
  6. condition = { env_true = ["DEV"] }
  7. env = { DESKTOP_TARGET = "x86_64-apple-darwin" }
  8. private = true
  9. run_task = { name = ["desktop-build", "post-desktop-dylib-to-system"] }
  10. [tasks.desktop-release]
  11. condition = { env_true = ["RELEASE"] }
  12. env = { DESKTOP_TARGET = "x86_64-apple-darwin" }
  13. private = true
  14. run_task = "desktop-build"
  15. [tasks.desktop-build]
  16. category = "Build"
  17. condition = { platforms = ["mac"], env_true = ["DEV"] }
  18. dependencies = ["export-env", "setup-crate-type-macos"]
  19. description = "Build desktop targets."
  20. script = [
  21. """
  22. cd rust-lib/
  23. cargo build --package=dart-ffi --target ${DESKTOP_TARGET}
  24. cd ../
  25. """,
  26. ]
  27. [tasks.post-desktop]
  28. condition = { platforms = ["mac"] }
  29. dependencies = ["restore-crate-type"]
  30. script = [
  31. """
  32. echo ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}
  33. cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/target/x86_64-apple-darwin/${LIB_OUT_DIR}/lib${CARGO_MAKE_CRATE_FS_NAME}.dylib \
  34. ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/packages/flowy_sdk/macos/lib${CARGO_MAKE_CRATE_FS_NAME}.dylib
  35. """,
  36. """
  37. cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/binding.h \
  38. ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/packages/flowy_sdk/macos/Classes/binding.h
  39. """,
  40. ]
  41. script_runner = "@duckscript"
  42. [tasks.setup-crate-type-macos]
  43. env = { TARGET_OS = "macos" }
  44. private = true
  45. run_task = "setup-crate-type"
  46. [tasks.export-env]
  47. script = [
  48. """
  49. export MACOSX_DEPLOYMENT_TARGET=10.11
  50. """,
  51. ]
  52. script_runner = "@shell"
  53. [tasks.post-desktop-dylib-to-system]
  54. condition = { platforms = ["mac"] }
  55. script = [
  56. """
  57. target_path = set ${TMPDIR}/appflowy_client/lib${CARGO_MAKE_CRATE_FS_NAME}.dylib
  58. echo "remove old dylib"
  59. rm ${target_path}
  60. echo "copy new dylib to system"
  61. cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/target/x86_64-apple-darwin/${LIB_OUT_DIR}/lib${CARGO_MAKE_CRATE_FS_NAME}.dylib ${target_path}
  62. """,
  63. ]
  64. script_runner = "@duckscript"
  65. [tasks.clean-flowy-sdk]
  66. condition = { platforms = ["mac"] }
  67. script = [
  68. """
  69. cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/flutter-lib/packages/flowy_sdk
  70. flutter clean
  71. """,
  72. ]
  73. script_runner = "@shell"