From 85850af541ae58ed5f7b18a92294dd7a339195fc Mon Sep 17 00:00:00 2001 From: Poly-Pixel <79737178+Poly-Pixel@users.noreply.github.com> Date: Tue, 26 Jul 2022 18:26:44 -0700 Subject: [PATCH 1/5] feat: add windows dev environment install script --- .gitignore | 1 + .../install_dev_env/install_windows.sh | 90 +++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 frontend/scripts/install_dev_env/install_windows.sh diff --git a/.gitignore b/.gitignore index b4bd54c6be..3d544c712e 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ pubspec.lock # ignore tool used for commit linting .githooks/gitlint +.githooks/gitlint.exe diff --git a/frontend/scripts/install_dev_env/install_windows.sh b/frontend/scripts/install_dev_env/install_windows.sh new file mode 100644 index 0000000000..1f65745e45 --- /dev/null +++ b/frontend/scripts/install_dev_env/install_windows.sh @@ -0,0 +1,90 @@ +#!/bin/bash + +YELLOW="\e[93m" +GREEN="\e[32m" +RED="\e[31m" +ENDCOLOR="\e[0m" + +printMessage() { + printf "${YELLOW}AppFlowy : $1${ENDCOLOR}\n" +} + +printSuccess() { + printf "${GREEN}AppFlowy : $1${ENDCOLOR}\n" +} + +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 +if ! rustc --version; then + + printMessage "The Rust programming language is required to compile AppFlowy." + printMessage "It has not been detected on your system." + + read -p "$(printSuccess "Do you want to install Rust? [y/N]") " installrust + + if [ ${installrust^^} == "Y" ]; then + printMessage "Installing Rust." + if ! curl --proto '=https' --tlsv1.2 -sSf https://win.rustup.rs/x86_64 -o rustup-init.exe; then + printError "Failed to download the Rust installer" + exit 1 + fi + start "Rust Installer" rustup-init.exe + read -p "$(printSuccess "Press enter when Rust installation is done") " isDone + rm rustup-init.exe + rustup toolchain install stable + rustup default stable + else + printMessage "Skipping Rust installation." + fi +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 + +# Enable linux desktop +flutter config --enable-windows-desktop + +# Fix any problems reported by flutter doctor +flutter doctor + +# Add the githooks directory to your git configuration +printMessage "Setting up githooks." +git config core.hooksPath .githooks + +# Change to the frontend directory +cd frontend + +# Install cargo make +printMessage "Installing cargo-make." +cargo install --force cargo-make + +# Install duckscript +printMessage "Installing duckscript." +cargo install --force duckscript_cli + +# Install go-gitlint +printMessage "Installing go-gitlint." +GOLINT_FILENAME="go-gitlint_1.1.0_windows_x86_64.tar.gz" +if curl --proto '=https' --tlsv1.2 -sSfL https://github.com/llorllale/go-gitlint/releases/download/1.1.0/${GOLINT_FILENAME} -o ${GOLINT_FILENAME}; then + tar -zxv --directory .githooks/. -f ${GOLINT_FILENAME} gitlint.exe + rm ${GOLINT_FILENAME} +else + printError "Failed to install go-gitlint" +fi + +# Enable vcpkg integration +# Note: Requires admin +vcpkg integrate install + +# Check prerequisites +printMessage "Checking prerequisites." +cargo make flowy_dev From 7eb7fad336bcaadaca3e4da9eab21383b3cd58ae Mon Sep 17 00:00:00 2001 From: Poly-Pixel <79737178+Poly-Pixel@users.noreply.github.com> Date: Wed, 27 Jul 2022 18:09:59 -0700 Subject: [PATCH 2/5] fix: fix most PATH-related issues --- .../install_dev_env/install_windows.sh | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/frontend/scripts/install_dev_env/install_windows.sh b/frontend/scripts/install_dev_env/install_windows.sh index 1f65745e45..69d5a64137 100644 --- a/frontend/scripts/install_dev_env/install_windows.sh +++ b/frontend/scripts/install_dev_env/install_windows.sh @@ -37,8 +37,8 @@ if ! rustc --version; then start "Rust Installer" rustup-init.exe read -p "$(printSuccess "Press enter when Rust installation is done") " isDone rm rustup-init.exe - rustup toolchain install stable - rustup default stable + $USERPROFILE/.cargo/bin/rustup toolchain install stable + $USERPROFILE/.cargo/bin/rustup default stable else printMessage "Skipping Rust installation." fi @@ -50,6 +50,9 @@ fi printMessage "Setting up Flutter" flutter channel stable +# Add pub cache to PATH +powershell '[Environment]::SetEnvironmentVariable("PATH", $Env:PATH + ";" + $Env:LOCALAPPDATA + "\Pub\Cache\Bin", [EnvironmentVariableTarget]::User)' + # Enable linux desktop flutter config --enable-windows-desktop @@ -60,17 +63,6 @@ flutter doctor printMessage "Setting up githooks." git config core.hooksPath .githooks -# Change to the frontend directory -cd frontend - -# Install cargo make -printMessage "Installing cargo-make." -cargo install --force cargo-make - -# Install duckscript -printMessage "Installing duckscript." -cargo install --force duckscript_cli - # Install go-gitlint printMessage "Installing go-gitlint." GOLINT_FILENAME="go-gitlint_1.1.0_windows_x86_64.tar.gz" @@ -81,10 +73,22 @@ else printError "Failed to install go-gitlint" fi +# Change to the frontend directory +cd frontend + +# Install cargo make +printMessage "Installing cargo-make." +#$USERPROFILE/.cargo/bin/cargo install --force cargo-make + +# Install duckscript +printMessage "Installing duckscript." +$USERPROFILE/.cargo/bin/cargo install --force duckscript_cli + # Enable vcpkg integration # Note: Requires admin +printMessage "Setting up vcpkg." vcpkg integrate install # Check prerequisites printMessage "Checking prerequisites." -cargo make flowy_dev +$USERPROFILE/.cargo/bin/cargo make flowy_dev From 89dc2f0370fb16adcbf09998c7d7ca2ee6e3ec16 Mon Sep 17 00:00:00 2001 From: Poly-Pixel <79737178+Poly-Pixel@users.noreply.github.com> Date: Sun, 24 Jul 2022 12:34:55 -0700 Subject: [PATCH 3/5] fix: forgot to uncomment a line! --- frontend/scripts/install_dev_env/install_windows.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/scripts/install_dev_env/install_windows.sh b/frontend/scripts/install_dev_env/install_windows.sh index 69d5a64137..bf6498b587 100644 --- a/frontend/scripts/install_dev_env/install_windows.sh +++ b/frontend/scripts/install_dev_env/install_windows.sh @@ -78,7 +78,7 @@ cd frontend # Install cargo make printMessage "Installing cargo-make." -#$USERPROFILE/.cargo/bin/cargo install --force cargo-make +$USERPROFILE/.cargo/bin/cargo install --force cargo-make # Install duckscript printMessage "Installing duckscript." From 3caa5656108f5f13e865e72096f2e8644f807a75 Mon Sep 17 00:00:00 2001 From: Poly-Pixel <79737178+Poly-Pixel@users.noreply.github.com> Date: Thu, 28 Jul 2022 20:04:46 -0700 Subject: [PATCH 4/5] fix: fix remaining PATH issues --- frontend/scripts/install_dev_env/install_windows.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/scripts/install_dev_env/install_windows.sh b/frontend/scripts/install_dev_env/install_windows.sh index bf6498b587..2e2392f300 100644 --- a/frontend/scripts/install_dev_env/install_windows.sh +++ b/frontend/scripts/install_dev_env/install_windows.sh @@ -50,8 +50,9 @@ fi printMessage "Setting up Flutter" flutter channel stable -# Add pub cache to PATH +# Add pub cache and cargo to PATH powershell '[Environment]::SetEnvironmentVariable("PATH", $Env:PATH + ";" + $Env:LOCALAPPDATA + "\Pub\Cache\Bin", [EnvironmentVariableTarget]::User)' +powershell '[Environment]::SetEnvironmentVariable("PATH", $Env:PATH + ";" + $Env:USERPROFILE + "\.cargo\bin", [EnvironmentVariableTarget]::User)' # Enable linux desktop flutter config --enable-windows-desktop @@ -91,4 +92,4 @@ vcpkg integrate install # Check prerequisites printMessage "Checking prerequisites." -$USERPROFILE/.cargo/bin/cargo make flowy_dev +PATH="$PATH;$LOCALAPPDATA/Pub/Cache/Bin" $USERPROFILE/.cargo/bin/cargo make flowy_dev From 86799bbb965e172d88d60e239e7e72de79fa9413 Mon Sep 17 00:00:00 2001 From: Poly-Pixel <79737178+Poly-Pixel@users.noreply.github.com> Date: Sun, 24 Jul 2022 13:18:56 -0700 Subject: [PATCH 5/5] fix: fix last command issue --- frontend/scripts/install_dev_env/install_windows.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/scripts/install_dev_env/install_windows.sh b/frontend/scripts/install_dev_env/install_windows.sh index 2e2392f300..bbba4cf2d5 100644 --- a/frontend/scripts/install_dev_env/install_windows.sh +++ b/frontend/scripts/install_dev_env/install_windows.sh @@ -92,4 +92,4 @@ vcpkg integrate install # Check prerequisites printMessage "Checking prerequisites." -PATH="$PATH;$LOCALAPPDATA/Pub/Cache/Bin" $USERPROFILE/.cargo/bin/cargo make flowy_dev +PATH="$PATH;$LOCALAPPDATA\Pub\Cache\bin" bash -c '$USERPROFILE/.cargo/bin/cargo make flowy_dev'