env.toml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. [tasks.flowy_dev]
  2. run_task = { name = ["install_prerequests","install_diesel", "install_protobuf"] }
  3. [tasks.install_windows_deps.windows]
  4. dependencies=["check_duckscript_installation", "check_visual_studio_installation", "check_vcpkg", "install_vcpkg_sqlite", "install_rust_vcpkg_cli"]
  5. [tasks.check_visual_studio_installation.windows]
  6. script = """
  7. output = exec powershell -Command "Get-CimInstance MSFT_VSInstance | select -ExpandProperty Version"
  8. stdout = set ${output.stdout}
  9. versions = split ${stdout} "\\n"
  10. for version in ${versions}
  11. pos = last_indexof ${version} .
  12. new_str = substring ${version} 0 ${pos}
  13. newer = semver_is_newer ${new_str} 16.11.0
  14. if newer
  15. goto :ok
  16. end
  17. end
  18. echo "Visual studio 2019 is not installed or version is lower than 16.11.0"
  19. exit -1
  20. :ok
  21. """
  22. script_runner = "@duckscript"
  23. [tasks.check_duckscript_installation.windows]
  24. script = """
  25. @echo off
  26. @duck -h > nul
  27. if %errorlevel% GTR 0 (
  28. echo Please install duckscript at first: cargo install --force duckscript_cli
  29. exit -1
  30. )
  31. """
  32. [tasks.check_vcpkg.windows]
  33. script = """
  34. ret = which vcpkg
  35. if is_empty ${ret}
  36. echo "Please install vcpkg on windows at first. Make sure to put it into PATH env var"
  37. echo "See: https://github.com/microsoft/vcpkg#quick-start-windows"
  38. exit -1
  39. end
  40. """
  41. script_runner = "@duckscript"
  42. [tasks.install_vcpkg_sqlite.windows]
  43. script = """
  44. vcpkg install sqlite3:x64-windows-static-md
  45. """
  46. [tasks.install_rust_vcpkg_cli.windows]
  47. script = """
  48. exec cargo install vcpkg_cli
  49. output = exec vcpkg_cli probe sqlite3
  50. stdout = set ${output.stdout}
  51. stderr = set ${output.stderr}
  52. ret = indexof ${stdout} "Failed:"
  53. assert_eq ${ret} "" ${stdout}
  54. """
  55. script_runner = "@duckscript"
  56. [tasks.install_diesel]
  57. script = """
  58. cargo install diesel_cli --no-default-features --features sqlite
  59. """
  60. [tasks.install_diesel.windows]
  61. script = """
  62. cargo install diesel_cli --no-default-features --features sqlite
  63. """
  64. dependencies = ["check_vcpkg"]
  65. [tasks.install_targets.mac]
  66. script = """
  67. rustup target add x86_64-apple-ios
  68. rustup target add x86_64-apple-darwin
  69. rustup target add aarch64-apple-ios
  70. rustup target add aarch64-apple-darwin
  71. """
  72. [tasks.install_targets.windows]
  73. script = """
  74. rustup target add x86_64-pc-windows-msvc
  75. """
  76. [tasks.install_targets.linux]
  77. script = """
  78. rustup target add x86_64-unknown-linux-gnu
  79. """
  80. [tasks.install_prerequests]
  81. dependencies=["install_targets"]
  82. [tasks.install_prerequests.windows]
  83. dependencies=["install_targets", "install_windows_deps"]
  84. [tasks.install_tools]
  85. script = """
  86. rustup component add rustfmt
  87. cargo install cargo-expand
  88. cargo install cargo-watch
  89. cargo install cargo-cache
  90. cargo install bunyan
  91. """
  92. [tasks.install_cocoapods]
  93. script = """
  94. # execute "xcode-select --install" before if "extconf.rb failed" error occurs
  95. sudo gem install cocoapods
  96. """
  97. [tasks.install_rbenv]
  98. script = """
  99. brew install rbenv
  100. rbenv init
  101. rbenv install 2.7.1
  102. rbenv global 2.7.1
  103. # https://github.com/rbenv/rbenv
  104. curl -fsSL https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-doctor | bash
  105. """
  106. [tasks.install_flutter]
  107. script = """
  108. ret = which flutter
  109. if is_empty ${ret}
  110. echo "[❤️] Follow the https://flutter.dev/docs/get-started/install instructions to install the flutter, skip if you already installed."
  111. echo "Switch to dev channel with command: flutter channel stable"
  112. exit -1
  113. end
  114. """
  115. script_runner = "@duckscript"
  116. [tasks.enable_git_hook]
  117. dependencies=["download_gitlint"]
  118. script = """
  119. git config core.hooksPath .githooks
  120. """
  121. script_runner = "@duckscript"
  122. [tasks.download_gitlint]
  123. script = """
  124. GOLINT_FILENAME="go-gitlint_1.1.0_osx_x86_64.tar.gz"
  125. curl -L https://github.com/llorllale/go-gitlint/releases/download/1.1.0/${GOLINT_FILENAME} --output ${GOLINT_FILENAME}
  126. tar -zxv --directory ../.githooks/. -f ${GOLINT_FILENAME} gitlint
  127. rm ${GOLINT_FILENAME}
  128. """
  129. [tasks.download_gitlint.linux]
  130. script = """
  131. GOLINT_FILENAME="go-gitlint_1.1.0_linux_x86_64.tar.gz"
  132. wget https://github.com/llorllale/go-gitlint/releases/download/1.1.0/${GOLINT_FILENAME}
  133. tar -zxv --directory ../.githooks/. -f ${GOLINT_FILENAME} gitlint
  134. rm ${GOLINT_FILENAME}
  135. """
  136. [tasks.download_gitlint.windows]
  137. script = """
  138. GOLINT_FILENAME="go-gitlint_1.1.0_windows_x86_64.tar.gz"
  139. if curl --proto '=https' --tlsv1.2 -sSfL https://github.com/llorllale/go-gitlint/releases/download/1.1.0/${GOLINT_FILENAME} -o ${GOLINT_FILENAME}; then
  140. tar -zxv --directory ../.githooks/. -f ${GOLINT_FILENAME} gitlint.exe
  141. rm ${GOLINT_FILENAME}
  142. else
  143. echo "Failed to install go-gitlint"
  144. fi
  145. """