env.toml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. pos = last_indexof ${stdout} .
  10. new_str = substring ${stdout} 0 ${pos}
  11. # TODO: will raise error if there are more than 1 visual studio installation
  12. newer = semver_is_newer ${new_str} 16.11.0
  13. assert ${newer} "Visual studio 2019 is not installed or version is lower than 16.11.0"
  14. """
  15. script_runner = "@duckscript"
  16. [tasks.check_duckscript_installation.windows]
  17. script = """
  18. @echo off
  19. @duck -h > nul
  20. if %errorlevel% GTR 0 (
  21. echo Please install duckscript at first: cargo install --force duckscript_cli
  22. exit -1
  23. )
  24. """
  25. [tasks.check_vcpkg.windows]
  26. script = """
  27. ret = which vcpkg
  28. if is_empty ${ret}
  29. echo "Please install vcpkg on windows at first. Make sure to put it into PATH env var"
  30. echo "See: https://github.com/microsoft/vcpkg#quick-start-windows"
  31. exit -1
  32. end
  33. """
  34. script_runner = "@duckscript"
  35. [tasks.install_vcpkg_sqlite.windows]
  36. script = """
  37. vcpkg install sqlite3:x64-windows-static-md
  38. """
  39. [tasks.install_rust_vcpkg_cli.windows]
  40. script = """
  41. exec cargo install vcpkg_cli
  42. output = exec vcpkg_cli probe sqlite3
  43. stdout = set ${output.stdout}
  44. stderr = set ${output.stderr}
  45. ret = indexof ${stdout} "Failed:"
  46. assert_eq ${ret} "" ${stdout}
  47. """
  48. script_runner = "@duckscript"
  49. [tasks.install_diesel]
  50. script = """
  51. cargo install diesel_cli --no-default-features --features sqlite
  52. """
  53. [tasks.install_diesel.windows]
  54. script = """
  55. cargo install diesel_cli --no-default-features --features sqlite
  56. """
  57. dependencies = ["check_vcpkg"]
  58. [tasks.install_targets.mac]
  59. script = """
  60. rustup target add x86_64-apple-ios
  61. rustup target add x86_64-apple-darwin
  62. rustup target add aarch64-apple-ios
  63. rustup target add aarch64-apple-darwin
  64. """
  65. [tasks.install_targets.windows]
  66. script = """
  67. rustup target add x86_64-pc-windows-msvc
  68. """
  69. [tasks.install_targets.linux]
  70. script = """
  71. rustup target add x86_64-unknown-linux-gnu
  72. """
  73. [tasks.install_prerequests]
  74. dependencies=["install_targets"]
  75. [tasks.install_prerequests.windows]
  76. dependencies=["install_targets", "install_windows_deps"]
  77. [tasks.install_protobuf]
  78. script = """
  79. # Custom dart:
  80. #brew tap dart-lang/dart
  81. #brew install dart
  82. #pub global activate protoc_plugin
  83. #https://pub.dev/packages/protoc_plugin
  84. dart pub global activate protoc_plugin
  85. cargo install --version 2.22.1 protobuf-codegen
  86. """
  87. [tasks.install_protobuf.windows]
  88. script = """
  89. ret = which dart
  90. if is_empty ${ret}
  91. echo Please make sure flutter/dart is properly installed and in PATH env var
  92. exit -1
  93. end
  94. ret = which protoc-gen-dart
  95. if is_empty ${ret}
  96. exec cmd.exe /c dart pub global activate protoc_plugin
  97. home_dir = get_home_dir
  98. echo Please add '${home_dir}\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\bin' into PATH env var
  99. exit -1
  100. end
  101. exec cargo install --version 2.22.1 protobuf-codegen
  102. """
  103. script_runner = "@duckscript"
  104. [tasks.install_tools]
  105. script = """
  106. rustup component add rustfmt
  107. cargo install cargo-expand
  108. cargo install cargo-watch
  109. cargo install cargo-cache
  110. cargo install bunyan
  111. """
  112. [tasks.install_cocoapods]
  113. script = """
  114. # execute "xcode-select --install" before if "extconf.rb failed" error occurs
  115. sudo gem install cocoapods
  116. """
  117. [tasks.install_rbenv]
  118. script = """
  119. brew install rbenv
  120. rbenv init
  121. rbenv install 2.7.1
  122. rbenv global 2.7.1
  123. # https://github.com/rbenv/rbenv
  124. curl -fsSL https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-doctor | bash
  125. """
  126. [tasks.install_fish]
  127. script = """
  128. brew install fish
  129. # https://stackoverflow.com/questions/26208231/modifying-path-with-fish-shell
  130. # Export the PATH using the command:
  131. # set -Ua fish_user_paths the_path_you_want_to_export
  132. """
  133. [tasks.install_flutter]
  134. script = """
  135. ret = which flutter
  136. if is_empty ${ret}
  137. echo "[❤️] Follow the https://flutter.dev/docs/get-started/install instructions to install the flutter, skip if you already installed."
  138. echo "Switch to dev channel with command: flutter channel dev"
  139. exit -1
  140. end
  141. """
  142. script_runner = "@duckscript"