env.toml 4.7 KB

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