env.toml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. [tasks.appflowy-flutter-deps-tools]
  2. run_task = { name = ["install_flutter_prerequests"] }
  3. [tasks.appflowy-tauri-deps-tools]
  4. run_task = { name = ["install_tauri_prerequests"] }
  5. [tasks.appflowy-flutter-dev-tools]
  6. run_task = { name = ["appflowy-flutter-deps-tools","install_diesel"] }
  7. [tasks.appflowy-tauri-dev-tools]
  8. run_task = { name = ["appflowy-tauri-deps-tools","install_diesel"] }
  9. [tasks.install_windows_deps.windows]
  10. dependencies=["check_duckscript_installation", "check_visual_studio_installation", "check_vcpkg", "install_vcpkg_sqlite", "install_rust_vcpkg_cli"]
  11. [tasks.check_visual_studio_installation.windows]
  12. script = """
  13. output = exec powershell -Command "Get-CimInstance MSFT_VSInstance | select -ExpandProperty Version"
  14. stdout = set ${output.stdout}
  15. versions = split ${stdout} "\\n"
  16. for version in ${versions}
  17. pos = last_indexof ${version} .
  18. new_str = substring ${version} 0 ${pos}
  19. newer = semver_is_newer ${new_str} 16.11.0
  20. if newer
  21. goto :ok
  22. end
  23. end
  24. echo "Visual studio 2019 is not installed or version is lower than 16.11.0"
  25. exit -1
  26. :ok
  27. """
  28. script_runner = "@duckscript"
  29. [tasks.check_duckscript_installation.windows]
  30. script = """
  31. @echo off
  32. @duck -h > nul
  33. if %errorlevel% GTR 0 (
  34. echo Please install duckscript at first: cargo install --force duckscript_cli
  35. exit -1
  36. )
  37. """
  38. [tasks.check_vcpkg.windows]
  39. script = """
  40. ret = which vcpkg
  41. if is_empty ${ret}
  42. echo "Please install vcpkg on windows at first. Make sure to put it into PATH env var"
  43. echo "See: https://github.com/microsoft/vcpkg#quick-start-windows"
  44. exit -1
  45. end
  46. """
  47. script_runner = "@duckscript"
  48. [tasks.install_vcpkg_sqlite.windows]
  49. script = """
  50. vcpkg install sqlite3:x64-windows-static-md
  51. """
  52. [tasks.install_rust_vcpkg_cli.windows]
  53. script = """
  54. exec cargo install vcpkg_cli
  55. output = exec vcpkg_cli probe sqlite3
  56. stdout = set ${output.stdout}
  57. stderr = set ${output.stderr}
  58. ret = indexof ${stdout} "Failed:"
  59. assert_eq ${ret} "" ${stdout}
  60. """
  61. script_runner = "@duckscript"
  62. [tasks.install_diesel]
  63. script = """
  64. cargo install diesel_cli --no-default-features --features sqlite
  65. """
  66. [tasks.install_diesel.windows]
  67. script = """
  68. #https://duredhelfinceleb.github.io/diesel_windows_install_doc/
  69. cargo install diesel_cli --no-default-features --features "sqlite-bundled"
  70. """
  71. dependencies = ["check_vcpkg"]
  72. [tasks.install_targets.mac]
  73. script = """
  74. #rustup target add x86_64-apple-ios
  75. #rustup target add x86_64-apple-darwin
  76. #rustup target add aarch64-apple-ios
  77. rustup target add aarch64-apple-darwin
  78. """
  79. [tasks.install_targets.windows]
  80. script = """
  81. rustup target add x86_64-pc-windows-msvc
  82. """
  83. [tasks.install_targets.linux]
  84. script = """
  85. rustup target add x86_64-unknown-linux-gnu
  86. """
  87. [tasks.install_tauri_prerequests]
  88. dependencies=["install_targets", "install_tauri_protobuf"]
  89. [tasks.install_flutter_prerequests]
  90. dependencies=["install_targets", "install_flutter_protobuf"]
  91. [tasks.install_flutter_prerequests.windows]
  92. dependencies=["install_targets", "install_windows_deps"]
  93. [tasks.install_tools]
  94. script = """
  95. rustup component add rustfmt
  96. cargo install cargo-expand
  97. cargo install cargo-watch
  98. cargo install cargo-cache
  99. cargo install bunyan
  100. """
  101. [tasks.install_cocoapods]
  102. script = """
  103. # execute "xcode-select --install" before if "extconf.rb failed" error occurs
  104. sudo gem install cocoapods
  105. """
  106. [tasks.install_rbenv]
  107. script = """
  108. brew install rbenv
  109. rbenv init
  110. rbenv install 2.7.1
  111. rbenv global 2.7.1
  112. # https://github.com/rbenv/rbenv
  113. curl -fsSL https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-doctor | bash
  114. """
  115. [tasks.install_flutter]
  116. script = """
  117. ret = which flutter
  118. if is_empty ${ret}
  119. echo "[❤️] Follow the https://flutter.dev/docs/get-started/install instructions to install the flutter, skip if you already installed."
  120. echo "Switch to dev channel with command: flutter channel stable"
  121. exit -1
  122. end
  123. """
  124. script_runner = "@duckscript"
  125. [tasks.enable_git_hook]
  126. dependencies=["download_gitlint"]
  127. script = """
  128. git config core.hooksPath .githooks
  129. """
  130. script_runner = "@duckscript"
  131. [tasks.download_gitlint]
  132. script = """
  133. GOLINT_FILENAME="go-gitlint_1.1.0_osx_x86_64.tar.gz"
  134. curl -L https://github.com/llorllale/go-gitlint/releases/download/1.1.0/${GOLINT_FILENAME} --output ${GOLINT_FILENAME}
  135. tar -zxv --directory ../.githooks/. -f ${GOLINT_FILENAME} gitlint
  136. rm ${GOLINT_FILENAME}
  137. """
  138. [tasks.download_gitlint.linux]
  139. script = """
  140. GOLINT_FILENAME="go-gitlint_1.1.0_linux_x86_64.tar.gz"
  141. wget https://github.com/llorllale/go-gitlint/releases/download/1.1.0/${GOLINT_FILENAME}
  142. tar -zxv --directory ../.githooks/. -f ${GOLINT_FILENAME} gitlint
  143. rm ${GOLINT_FILENAME}
  144. """
  145. [tasks.download_gitlint.windows]
  146. script = """
  147. GOLINT_FILENAME="go-gitlint_1.1.0_windows_x86_64.tar.gz"
  148. if curl --proto '=https' --tlsv1.2 -sSfL https://github.com/llorllale/go-gitlint/releases/download/1.1.0/${GOLINT_FILENAME} -o ${GOLINT_FILENAME}; then
  149. tar -zxv --directory ../.githooks/. -f ${GOLINT_FILENAME} gitlint.exe
  150. rm ${GOLINT_FILENAME}
  151. else
  152. echo "Failed to install go-gitlint"
  153. fi
  154. """