install_ios.sh 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. # Install Rust
  16. printMessage "The Rust programming language is required to compile AppFlowy."
  17. printMessage "We can install it now if you don't already have it on your system."
  18. read -p "$(printSuccess "Do you want to install Rust? [y/N]") " installrust
  19. if [[ "${installrust:-N}" == [Yy] ]]; then
  20. printMessage "Installing Rust."
  21. brew install rustup-init
  22. rustup-init -y --default-toolchain=stable
  23. source "$HOME/.cargo/env"
  24. else
  25. printMessage "Skipping Rust installation."
  26. fi
  27. rustup target add aarch64-apple-ios
  28. rustup target add aarch64-apple-ios-sim
  29. # Install sqllite
  30. printMessage "Installing sqlLite3."
  31. brew install sqlite3
  32. printMessage "Setting up Flutter"
  33. # Get the current Flutter version
  34. FLUTTER_VERSION=$(flutter --version | grep -oE 'Flutter [^ ]+' | grep -oE '[^ ]+$')
  35. # Check if the current version is 3.10.1
  36. if [ "$FLUTTER_VERSION" = "3.10.1" ]; then
  37. echo "Flutter version is already 3.10.1"
  38. else
  39. # Get the path to the Flutter SDK
  40. FLUTTER_PATH=$(which flutter)
  41. FLUTTER_PATH=${FLUTTER_PATH%/bin/flutter}
  42. current_dir=$(pwd)
  43. cd $FLUTTER_PATH
  44. # Use git to checkout version 3.10.1 of Flutter
  45. git checkout 3.10.1
  46. # Get back to current working directory
  47. cd "$current_dir"
  48. echo "Switched to Flutter version 3.10.1"
  49. fi
  50. # Enable linux desktop
  51. flutter config --enable-macos-desktop
  52. # Fix any problems reported by flutter doctor
  53. flutter doctor
  54. # Add the githooks directory to your git configuration
  55. printMessage "Setting up githooks."
  56. git config core.hooksPath .githooks
  57. # Install go-gitlint
  58. printMessage "Installing go-gitlint."
  59. GOLINT_FILENAME="go-gitlint_1.1.0_osx_x86_64.tar.gz"
  60. curl -L https://github.com/llorllale/go-gitlint/releases/download/1.1.0/${GOLINT_FILENAME} --output ${GOLINT_FILENAME}
  61. tar -zxv --directory .githooks/. -f ${GOLINT_FILENAME} gitlint
  62. rm ${GOLINT_FILENAME}
  63. # Change to the frontend directory
  64. cd frontend || exit 1
  65. # Install cargo make
  66. printMessage "Installing cargo-make."
  67. cargo install --force cargo-make
  68. # Install duckscript
  69. printMessage "Installing duckscript."
  70. cargo install --force duckscript_cli
  71. # Check prerequisites
  72. printMessage "Checking prerequisites."
  73. cargo make appflowy-flutter-deps-tools