env.toml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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. cargo install diesel_cli --no-default-features --features sqlite
  65. """
  66. dependencies = ["check_vcpkg"]
  67. [tasks.install_targets.mac]
  68. script = """
  69. rustup target add x86_64-apple-ios
  70. rustup target add x86_64-apple-darwin
  71. rustup target add aarch64-apple-ios
  72. rustup target add aarch64-apple-darwin
  73. """
  74. [tasks.install_targets.windows]
  75. script = """
  76. rustup target add x86_64-pc-windows-msvc
  77. """
  78. [tasks.install_targets.linux]
  79. script = """
  80. rustup target add x86_64-unknown-linux-gnu
  81. """
  82. [tasks.install_tauri_prerequests]
  83. dependencies=["install_targets", "install_tauri_protobuf"]
  84. [tasks.install_flutter_prerequests]
  85. dependencies=["install_targets", "install_flutter_protobuf"]
  86. [tasks.install_flutter_prerequests.windows]
  87. dependencies=["install_targets", "install_windows_deps"]
  88. [tasks.install_tools]
  89. script = """
  90. rustup component add rustfmt
  91. cargo install cargo-expand
  92. cargo install cargo-watch
  93. cargo install cargo-cache
  94. cargo install bunyan
  95. """
  96. [tasks.install_cocoapods]
  97. script = """
  98. # execute "xcode-select --install" before if "extconf.rb failed" error occurs
  99. sudo gem install cocoapods
  100. """
  101. [tasks.install_rbenv]
  102. script = """
  103. brew install rbenv
  104. rbenv init
  105. rbenv install 2.7.1
  106. rbenv global 2.7.1
  107. # https://github.com/rbenv/rbenv
  108. curl -fsSL https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-doctor | bash
  109. """
  110. [tasks.install_flutter]
  111. script = """
  112. ret = which flutter
  113. if is_empty ${ret}
  114. echo "[❤️] Follow the https://flutter.dev/docs/get-started/install instructions to install the flutter, skip if you already installed."
  115. echo "Switch to dev channel with command: flutter channel stable"
  116. exit -1
  117. end
  118. """
  119. script_runner = "@duckscript"
  120. [tasks.enable_git_hook]
  121. dependencies=["download_gitlint"]
  122. script = """
  123. git config core.hooksPath .githooks
  124. """
  125. script_runner = "@duckscript"
  126. [tasks.download_gitlint]
  127. script = """
  128. GOLINT_FILENAME="go-gitlint_1.1.0_osx_x86_64.tar.gz"
  129. curl -L https://github.com/llorllale/go-gitlint/releases/download/1.1.0/${GOLINT_FILENAME} --output ${GOLINT_FILENAME}
  130. tar -zxv --directory ../.githooks/. -f ${GOLINT_FILENAME} gitlint
  131. rm ${GOLINT_FILENAME}
  132. """
  133. [tasks.download_gitlint.linux]
  134. script = """
  135. GOLINT_FILENAME="go-gitlint_1.1.0_linux_x86_64.tar.gz"
  136. wget https://github.com/llorllale/go-gitlint/releases/download/1.1.0/${GOLINT_FILENAME}
  137. tar -zxv --directory ../.githooks/. -f ${GOLINT_FILENAME} gitlint
  138. rm ${GOLINT_FILENAME}
  139. """
  140. [tasks.download_gitlint.windows]
  141. script = """
  142. GOLINT_FILENAME="go-gitlint_1.1.0_windows_x86_64.tar.gz"
  143. if curl --proto '=https' --tlsv1.2 -sSfL https://github.com/llorllale/go-gitlint/releases/download/1.1.0/${GOLINT_FILENAME} -o ${GOLINT_FILENAME}; then
  144. tar -zxv --directory ../.githooks/. -f ${GOLINT_FILENAME} gitlint.exe
  145. rm ${GOLINT_FILENAME}
  146. else
  147. echo "Failed to install go-gitlint"
  148. fi
  149. """