| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 | 
							- [tasks.flowy_dev]
 
- run_task = { name = ["install_prerequests","install_diesel", "install_protobuf"] }
 
- [tasks.install_windows_deps.windows]
 
- dependencies=["check_duckscript_installation", "check_visual_studio_installation", "check_vcpkg", "install_vcpkg_sqlite", "install_rust_vcpkg_cli"]
 
- [tasks.check_visual_studio_installation.windows]
 
- script = """
 
- output = exec powershell -Command "Get-CimInstance MSFT_VSInstance | select -ExpandProperty Version"
 
- stdout = set ${output.stdout}
 
- versions = split ${stdout} "\\n"
 
- for version in ${versions}
 
-     pos = last_indexof ${version} .
 
-     new_str = substring ${version} 0 ${pos}
 
-     newer = semver_is_newer ${new_str} 16.11.0
 
-     if newer
 
-         goto :ok
 
-     end
 
- end
 
- echo "Visual studio 2019 is not installed or version is lower than 16.11.0"
 
- exit -1
 
- :ok
 
- """
 
- script_runner = "@duckscript"
 
- [tasks.check_duckscript_installation.windows]
 
- script = """
 
- @echo off
 
- @duck -h > nul
 
- if %errorlevel% GTR 0 (
 
-   echo Please install duckscript at first: cargo install --force duckscript_cli
 
-   exit -1
 
- )
 
- """
 
- [tasks.check_vcpkg.windows]
 
- script = """
 
- ret = which vcpkg
 
- if is_empty ${ret}
 
-     echo "Please install vcpkg on windows at first. Make sure to put it into PATH env var"
 
-     echo "See: https://github.com/microsoft/vcpkg#quick-start-windows"
 
-     exit -1
 
- end
 
- """
 
- script_runner = "@duckscript"
 
- [tasks.install_vcpkg_sqlite.windows]
 
- script = """
 
- vcpkg install sqlite3:x64-windows-static-md
 
- """
 
- [tasks.install_rust_vcpkg_cli.windows]
 
- script = """
 
- exec cargo install vcpkg_cli
 
- output = exec vcpkg_cli probe sqlite3
 
- stdout = set ${output.stdout}
 
- stderr = set ${output.stderr}
 
- ret = indexof ${stdout} "Failed:"
 
- assert_eq ${ret} "" ${stdout}
 
- """
 
- script_runner = "@duckscript"
 
- [tasks.install_diesel]
 
- script = """
 
- cargo install diesel_cli --no-default-features --features sqlite
 
- """
 
- [tasks.install_diesel.windows]
 
- script = """
 
- cargo install diesel_cli --no-default-features --features sqlite
 
- """
 
- dependencies = ["check_vcpkg"]
 
- [tasks.install_targets.mac]
 
- script = """
 
- rustup target add x86_64-apple-ios
 
- rustup target add x86_64-apple-darwin
 
- rustup target add aarch64-apple-ios
 
- rustup target add aarch64-apple-darwin
 
- """
 
- [tasks.install_targets.windows]
 
- script = """
 
- rustup target add x86_64-pc-windows-msvc
 
- """
 
- [tasks.install_targets.linux]
 
- script = """
 
- rustup target add x86_64-unknown-linux-gnu
 
- """
 
- [tasks.install_prerequests]
 
- dependencies=["install_targets"]
 
- [tasks.install_prerequests.windows]
 
- dependencies=["install_targets", "install_windows_deps"]
 
- [tasks.install_tools]
 
- script = """
 
- rustup component add rustfmt
 
- cargo install cargo-expand
 
- cargo install cargo-watch
 
- cargo install cargo-cache
 
- cargo install bunyan
 
- """
 
- [tasks.install_cocoapods]
 
- script = """
 
- # execute "xcode-select --install" before if "extconf.rb failed" error occurs
 
- sudo gem install cocoapods
 
- """
 
- [tasks.install_rbenv]
 
- script = """
 
- brew install rbenv
 
- rbenv init
 
- rbenv install 2.7.1
 
- rbenv global 2.7.1
 
- # https://github.com/rbenv/rbenv
 
- curl -fsSL https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-doctor | bash
 
- """
 
- [tasks.install_flutter]
 
- script = """
 
- ret = which flutter
 
- if is_empty ${ret}
 
-     echo "[❤️] Follow the https://flutter.dev/docs/get-started/install instructions to install the flutter, skip if you already installed."
 
-     echo "Switch to dev channel with command: flutter channel stable"
 
-     exit -1
 
- end
 
- """
 
- script_runner = "@duckscript"
 
- [tasks.enable_git_hook]
 
- dependencies=["download_gitlint"]
 
- script = """
 
- git config core.hooksPath .githooks
 
- """
 
- script_runner = "@duckscript"
 
- [tasks.download_gitlint]
 
- script = """
 
- GOLINT_FILENAME="go-gitlint_1.1.0_osx_x86_64.tar.gz"
 
- curl -L https://github.com/llorllale/go-gitlint/releases/download/1.1.0/${GOLINT_FILENAME} --output ${GOLINT_FILENAME}
 
- tar -zxv --directory ../.githooks/. -f ${GOLINT_FILENAME} gitlint 
 
- rm ${GOLINT_FILENAME}
 
- """
 
- [tasks.download_gitlint.linux]
 
- script = """
 
- GOLINT_FILENAME="go-gitlint_1.1.0_linux_x86_64.tar.gz"
 
- wget https://github.com/llorllale/go-gitlint/releases/download/1.1.0/${GOLINT_FILENAME}
 
- tar -zxv --directory ../.githooks/. -f ${GOLINT_FILENAME} gitlint 
 
- rm ${GOLINT_FILENAME}
 
- """
 
- [tasks.download_gitlint.windows]
 
- script = """
 
- 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
 
-  echo "Failed to install go-gitlint"
 
- fi
 
- """
 
 
  |