env.toml 4.0 KB

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