install_windows.sh 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #!/bin/bash
  2. YELLOW="\e[93m"
  3. GREEN="\e[32m"
  4. RED="\e[31m"
  5. ENDCOLOR="\e[0m"
  6. printMessage() {
  7. printf "${YELLOW}AppFlowy : $1${ENDCOLOR}\n"
  8. }
  9. printSuccess() {
  10. printf "${GREEN}AppFlowy : $1${ENDCOLOR}\n"
  11. }
  12. printError() {
  13. printf "${RED}AppFlowy : $1${ENDCOLOR}\n"
  14. }
  15. # Note: This script does not install applications which are installed by the package manager. There are too many package managers out there.
  16. # Install Rust
  17. if ! rustc --version; then
  18. printMessage "The Rust programming language is required to compile AppFlowy."
  19. printMessage "It has not been detected on your system."
  20. read -p "$(printSuccess "Do you want to install Rust? [y/N]") " installrust
  21. if [ ${installrust^^} == "Y" ]; then
  22. printMessage "Installing Rust."
  23. if ! curl --proto '=https' --tlsv1.2 -sSf https://win.rustup.rs/x86_64 -o rustup-init.exe; then
  24. printError "Failed to download the Rust installer"
  25. exit 1
  26. fi
  27. start "Rust Installer" rustup-init.exe
  28. read -p "$(printSuccess "Press enter when Rust installation is done") " isDone
  29. rm rustup-init.exe
  30. rustup toolchain install stable
  31. rustup default stable
  32. else
  33. printMessage "Skipping Rust installation."
  34. fi
  35. else
  36. printSuccess "Rust has been detected on your system, so Rust installation has been skipped"
  37. fi
  38. # Enable the flutter stable channel
  39. printMessage "Setting up Flutter"
  40. flutter channel stable
  41. # Enable linux desktop
  42. flutter config --enable-windows-desktop
  43. # Fix any problems reported by flutter doctor
  44. flutter doctor
  45. # Add the githooks directory to your git configuration
  46. printMessage "Setting up githooks."
  47. git config core.hooksPath .githooks
  48. # Change to the frontend directory
  49. cd frontend
  50. # Install cargo make
  51. printMessage "Installing cargo-make."
  52. cargo install --force cargo-make
  53. # Install duckscript
  54. printMessage "Installing duckscript."
  55. cargo install --force duckscript_cli
  56. # Install go-gitlint
  57. printMessage "Installing go-gitlint."
  58. GOLINT_FILENAME="go-gitlint_1.1.0_windows_x86_64.tar.gz"
  59. if curl --proto '=https' --tlsv1.2 -sSfL https://github.com/llorllale/go-gitlint/releases/download/1.1.0/${GOLINT_FILENAME} -o ${GOLINT_FILENAME}; then
  60. tar -zxv --directory .githooks/. -f ${GOLINT_FILENAME} gitlint.exe
  61. rm ${GOLINT_FILENAME}
  62. else
  63. printError "Failed to install go-gitlint"
  64. fi
  65. # Enable vcpkg integration
  66. # Note: Requires admin
  67. vcpkg integrate install
  68. # Check prerequisites
  69. printMessage "Checking prerequisites."
  70. cargo make flowy_dev