fix(appflowy_flutter): Flutter Version Reset Error (#1923)

* fix(appflowy_flutter): Version Reset Error

- `flutter channel stable` was causing the FlutterSDK to upgrade to it's
latest version.
- Added code to fix this behaviour.
- Tested on Windows and Linux.

* fix(app_flowy): Error in MacOS script

- Replace `-P` with `-E` which should now work as expected in Mac devices.

* fix(app_flowy): Commit Structure

- Fixed Commit Structure

* fix: path reset

Now we move back to cwd after making changes

* chore: change to LF from CTLF

---------

Co-authored-by: Lucas.Xu <lucas.xu@appflowy.io>
This commit is contained in:
Aman Negi 2023-03-16 07:11:14 +05:30 committed by GitHub
parent 230756d242
commit caffb9fdcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 82 additions and 30 deletions

View File

@ -17,7 +17,6 @@ printError() {
printf "${RED}AppFlowy : $1${ENDCOLOR}\n"
}
# Note: This script does not install applications which are installed by the package manager. There are too many package managers out there.
# Install Rust
@ -36,9 +35,27 @@ else
printMessage "Skipping Rust installation."
fi
# Enable the flutter stable channel
printMessage "Setting up Flutter"
flutter channel stable
# Get the current Flutter version
FLUTTER_VERSION=$(flutter --version | grep -oP 'Flutter \K\S+')
# Check if the current version is 3.3.10
if [ "$FLUTTER_VERSION" = "3.3.10" ]; then
echo "Flutter version is already 3.3.10"
else
# Get the path to the Flutter SDK
FLUTTER_PATH=$(which flutter)
FLUTTER_PATH=${FLUTTER_PATH%/bin/flutter}
current_dir=$(pwd)
cd $FLUTTER_PATH
# Use git to checkout version 3.3.10 of Flutter
git checkout 3.3.10
# Get back to current working directory
cd "$current_dir"
echo "Switched to Flutter version 3.3.10"
fi
# Enable linux desktop
flutter config --enable-linux-desktop
@ -47,9 +64,9 @@ flutter config --enable-linux-desktop
flutter doctor
printMessage "Installing keybinder-3.0"
if command apt-get &> /dev/null; then
if command apt-get &>/dev/null; then
sudo apt-get install keybinder-3.0-dev
elif command dnf &> /dev/null; then
elif command dnf &>/dev/null; then
sudo dnf install keybinder3-devel
else
echo 'Your system is not supported, please install keybinder3 manually.'

View File

@ -17,7 +17,6 @@ printError() {
printf "${RED}AppFlowy : $1${ENDCOLOR}\n"
}
# Install Rust
printMessage "The Rust programming language is required to compile AppFlowy."
printMessage "We can install it now if you don't already have it on your system."
@ -38,9 +37,28 @@ fi
printMessage "Installing sqlLite3."
brew install sqlite3
# Enable the flutter stable channel
printMessage "Setting up Flutter"
flutter channel stable
# Get the current Flutter version
FLUTTER_VERSION=$(flutter --version | grep -oE 'Flutter [^ ]+' | grep -oE '[^ ]+$')
# Check if the current version is 3.3.10
if [ "$FLUTTER_VERSION" = "3.3.10" ]; then
echo "Flutter version is already 3.3.10"
else
# Get the path to the Flutter SDK
FLUTTER_PATH=$(which flutter)
FLUTTER_PATH=${FLUTTER_PATH%/bin/flutter}
current_dir=$(pwd)
cd $FLUTTER_PATH
# Use git to checkout version 3.3.10 of Flutter
git checkout 3.3.10
# Get back to current working directory
cd "$current_dir"
echo "Switched to Flutter version 3.3.10"
fi
# Enable linux desktop
flutter config --enable-macos-desktop

View File

@ -17,7 +17,6 @@ printError() {
printf "${RED}AppFlowy : $1${ENDCOLOR}\n"
}
# Note: This script does not install applications which are installed by the package manager. There are too many package managers out there.
# Install Rust
@ -46,9 +45,27 @@ else
printSuccess "Rust has been detected on your system, so Rust installation has been skipped"
fi
# Enable the flutter stable channel
printMessage "Setting up Flutter"
flutter channel stable
# Get the current Flutter version
FLUTTER_VERSION=$(flutter --version | grep -oP 'Flutter \K\S+')
# Check if the current version is 3.3.10
if [ "$FLUTTER_VERSION" = "3.3.10" ]; then
echo "Flutter version is already 3.3.10"
else
# Get the path to the Flutter SDK
FLUTTER_PATH=$(which flutter)
FLUTTER_PATH=${FLUTTER_PATH%/bin/flutter}
current_dir=$(pwd)
cd $FLUTTER_PATH
# Use git to checkout version 3.3.10 of Flutter
git checkout 3.3.10
# Get back to current working directory
cd "$current_dir"
echo "Switched to Flutter version 3.3.10"
fi
# Add pub cache and cargo to PATH
powershell '[Environment]::SetEnvironmentVariable("PATH", $Env:PATH + ";" + $Env:LOCALAPPDATA + "\Pub\Cache\Bin", [EnvironmentVariableTarget]::User)'