install_windows.sh 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. $USERPROFILE/.cargo/bin/rustup toolchain install stable
  31. $USERPROFILE/.cargo/bin/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. # Add pub cache to PATH
  42. powershell '[Environment]::SetEnvironmentVariable("PATH", $Env:PATH + ";" + $Env:LOCALAPPDATA + "\Pub\Cache\Bin", [EnvironmentVariableTarget]::User)'
  43. # Enable linux desktop
  44. flutter config --enable-windows-desktop
  45. # Fix any problems reported by flutter doctor
  46. flutter doctor
  47. # Add the githooks directory to your git configuration
  48. printMessage "Setting up githooks."
  49. git config core.hooksPath .githooks
  50. # Install go-gitlint
  51. printMessage "Installing go-gitlint."
  52. GOLINT_FILENAME="go-gitlint_1.1.0_windows_x86_64.tar.gz"
  53. if curl --proto '=https' --tlsv1.2 -sSfL https://github.com/llorllale/go-gitlint/releases/download/1.1.0/${GOLINT_FILENAME} -o ${GOLINT_FILENAME}; then
  54. tar -zxv --directory .githooks/. -f ${GOLINT_FILENAME} gitlint.exe
  55. rm ${GOLINT_FILENAME}
  56. else
  57. printError "Failed to install go-gitlint"
  58. fi
  59. # Change to the frontend directory
  60. cd frontend
  61. # Install cargo make
  62. printMessage "Installing cargo-make."
  63. #$USERPROFILE/.cargo/bin/cargo install --force cargo-make
  64. # Install duckscript
  65. printMessage "Installing duckscript."
  66. $USERPROFILE/.cargo/bin/cargo install --force duckscript_cli
  67. # Enable vcpkg integration
  68. # Note: Requires admin
  69. printMessage "Setting up vcpkg."
  70. vcpkg integrate install
  71. # Check prerequisites
  72. printMessage "Checking prerequisites."
  73. $USERPROFILE/.cargo/bin/cargo make flowy_dev