env.toml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. [tasks.flowy_dev]
  2. run_task = { name = ["install_prerequests","install_diesel"] }
  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_protobuf]
  85. script = """
  86. # Custom dart:
  87. #brew tap dart-lang/dart
  88. #brew install dart
  89. #pub global activate protoc_plugin
  90. #https://pub.dev/packages/protoc_plugin
  91. dart pub global activate protoc_plugin
  92. cargo install --version 2.22.1 protobuf-codegen
  93. """
  94. [tasks.install_protobuf.windows]
  95. script = """
  96. ret = which dart
  97. if is_empty ${ret}
  98. echo Please make sure flutter/dart is properly installed and in PATH env var
  99. exit -1
  100. end
  101. ret = which protoc-gen-dart
  102. if is_empty ${ret}
  103. exec cmd.exe /c dart pub global activate protoc_plugin
  104. home_dir = get_home_dir
  105. echo Please add '${home_dir}\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\bin' into PATH env var
  106. exit -1
  107. end
  108. exec cargo install --version 2.22.1 protobuf-codegen
  109. """
  110. script_runner = "@duckscript"
  111. [tasks.install_tools]
  112. script = """
  113. rustup component add rustfmt
  114. cargo install cargo-expand
  115. cargo install cargo-watch
  116. cargo install cargo-cache
  117. cargo install bunyan
  118. """
  119. [tasks.install_cocoapods]
  120. script = """
  121. # execute "xcode-select --install" before if "extconf.rb failed" error occurs
  122. sudo gem install cocoapods
  123. """
  124. [tasks.install_rbenv]
  125. script = """
  126. brew install rbenv
  127. rbenv init
  128. rbenv install 2.7.1
  129. rbenv global 2.7.1
  130. # https://github.com/rbenv/rbenv
  131. curl -fsSL https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-doctor | bash
  132. """
  133. [tasks.install_fish]
  134. script = """
  135. brew install fish
  136. # https://stackoverflow.com/questions/26208231/modifying-path-with-fish-shell
  137. # Export the PATH using the command:
  138. # set -Ua fish_user_paths the_path_you_want_to_export
  139. """
  140. [tasks.install_flutter]
  141. script = """
  142. ret = which flutter
  143. if is_empty ${ret}
  144. echo "[❤️] Follow the https://flutter.dev/docs/get-started/install instructions to install the flutter, skip if you already installed."
  145. echo "Switch to dev channel with command: flutter channel stable"
  146. exit -1
  147. end
  148. """
  149. script_runner = "@duckscript"