Jiahao XU
16b16c482c
Optimize GhCrateMeta::find
: use FuturesUnordered
( #321 )
...
* Optimize `GhCrateMeta::find` using `FuturesUnordered`
* Optimize `MultiFetcher`: Impl `with_capacity` use it in `resolve_inner` to avoid over-reservation
* Enable feature "std" of dep futures-util
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-27 21:56:43 +12:00
Jiahao XU
4def4d08fd
Add new feature trust-dns
to lib & bin ( #318 )
...
* Add new feature `trust-dns` to lib & bin
* Enable `trust-dns` feature by default
Because the `getaddrinfo` is a poorly designed API.
* USe default feature set on windows CI
because wintls on the CI does not support TLS 1.3 and trust-dns only
support dns over https if rustls is used.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-25 12:01:22 +12:00
Jiahao XU
846e7ead91
Support other git hosting services ( #312 )
...
* Impl new mod `hosting` for detecting git hosting services
* Refactor: Make `guess_git_hosting_services` associated fn of `GitHostingService`
* Set default value of `PkgMeta::pkg_url` to `None`
* Impl new method `get_redirected_final_url`
* Use `get_redirected_final_url` in `GhCrateMeta::find` to make `guess_git_hosting_services` more accurate.
* Use redirected `repo` in `GhCrateMeta::launch_baseline_find_tasks`
* Refactor `<GhCrateMeta as Fetcher>::find`
* Mod `get_default_pkg_url_template` to ret `&[&str]`
* Add more default `pkg-url` templates
* Rm `pkg-url` in `bin/Cargo.toml`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-24 07:16:26 +00:00
Jiahao XU
6b5e8f6875
Auto detect pkg_fmt
( #310 )
...
* Refactor: Extract `GhCrateMeta::find_baseline`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Update `Cargo.lock`: Update dep `compact_str`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Fix use of `fetchers`: Set `meta.pkg_fmt` using `fetcher.pkg_fmt()`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Derive `strum_macors::{Display, EnumIter}` for `PkgFmt`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Set typeof field `PkgMeta::pkg_fmt` to be `Option<PkgFmt>`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Optimize `Fetcher::new` to take `&Arc<Data>` instead of `&Data`
To avoid unnecessary `Data::clone` call in `GhCrateMeta`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Optimize `GhCrateMeta::find_baseline`: Avoid unnecessary spawning
for `let Err(_) = url`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Optimize spawning in `GhCrateMeta::find_baseline`
Ret `Option<Url>` instead of `(Url, bool)`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Add new method `target_meta` to trait `Fetcher`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Simplify `resolve_inner` using `Fetcher::target_meta`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Optimize loop in `resolve_inner`: Avoid cloning `PkgOverride`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Impl `PkgMeta::clone_without_overrides`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Optimize `resolve_inner` loop: Use `PkgMeta::clone_without_overrides`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Refactor: Simplify `Context::from_data` impl
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Refactor: Extract `launch_baseline_find_tasks`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Refactor: Simplify `<GhCrateMeta as Fetcher>::find`
Instead of launching tasks in an opaque manner in `Self::find_baseline`,
the new design returns an iterator which launches the tasks and thus
have a unified `.await` point for all these tasks.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Add `warn!`ing to report failure of `Context::render_url`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-22 12:28:36 +00:00
dependabot[bot]
b5ea9a2293
Update compact_str requirement from 0.5.2 to 0.6.0 in /crates/lib ( #308 )
...
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-22 15:15:01 +12:00
Jiahao XU
62f9450d2d
Refactor: Extract new crate detect-targets
and improve code quality ( #307 )
...
* Refactor: Extract new crate `detect-targets`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Refactor: Extract new mod `detect` for `detect-targets`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Refactor: Extract `desired_targets` in crate `detect-targets`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Refactor: Extract `detect::linux` in crate `detect-targets`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Refactor: Extract `detect::macos` in crate `detect-targets`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Refactor: Extract `detect::windows` in crate `detect-targets`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Add new dep cfg-if v1.0.0 for `detect-targets`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Refactor: Simplify mod declaration in `detect` using `cfg_if!`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Refactor: Simplify `detect_targets` using `cfg_if!`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Add crate doc for `detect-targets`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Enable feature "macros" of tokio in `detect-targets`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Enable feature "io-util" of dep tokio
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Rm unused feature "io-util" & "macros" of dep tokio
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Set stdin & stderr to null in `get_target_from_rustc`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Improve doc of `get_desired_targets`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Improve `detect_targets_linux`: Run `ldd` with stdin set to null
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Fix potential panic in `windows::detect_alternative_targets`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* FIx fmt of `detect_targets_linux`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Do not re-export dep `detect-targets` in `crates/lib`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Fix typo in crate doc for `detect-targets`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Enable feature "macros" of tokio in dev mode
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Add example to crate doc of `detect-targets`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Improve API `get_desired_targets`: Take `Option<&str>`
instead of `&Option<String>`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-21 22:21:33 +10:00
Jiahao XU
1102284684
Fix clippy
warnings and add new workflow clippy ( #306 )
...
* Derive `Eq` for `PkgFmt`, `PkgFmtDecomposed` & `TarBasedFmt`
* Derive `Eq` for `PkgMeta`, `PkgOverride` & `BinMeta`
* Rm unnecessary reborrow in `install_from_source`
* Rm unnecessary `into()` in `args::parse`
* Fix `clippy` warning in `CratesToml::append_to_path`
* Fix clippy warning in `cratesio_url`
* Fix clippy warning in `detect_targets_linux`
* Add `clippy` and `rustfmt` to workflow `unit-test`
Because `clippy` would not check inactive code disabled by `cfg`, so we
have to also run `clippy` on multiple targets.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-21 02:40:50 +12:00
dependabot[bot]
4812456357
Bump futures-util from 0.3.21 to 0.3.23 ( #298 )
...
Bumps [futures-util](https://github.com/rust-lang/futures-rs ) from 0.3.21 to 0.3.23.
- [Release notes](https://github.com/rust-lang/futures-rs/releases )
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md )
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.21...0.3.23 )
---
updated-dependencies:
- dependency-name: futures-util
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-20 12:39:37 +00:00
dependabot[bot]
3e2d272bfd
Bump serde from 1.0.142 to 1.0.143 ( #297 )
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.142 to 1.0.143.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.142...v1.0.143 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-20 12:26:50 +00:00
dependabot[bot]
d9c7bdab55
Bump miette from 5.2.0 to 5.3.0 ( #300 )
...
Bumps [miette](https://github.com/zkat/miette ) from 5.2.0 to 5.3.0.
- [Release notes](https://github.com/zkat/miette/releases )
- [Changelog](https://github.com/zkat/miette/blob/main/CHANGELOG.md )
- [Commits](https://github.com/zkat/miette/compare/miette-derive-v5.2.0...miette-derive-v5.3.0 )
---
updated-dependencies:
- dependency-name: miette
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-20 12:16:48 +00:00
dependabot[bot]
af59a59085
Bump clap from 3.2.16 to 3.2.17 ( #299 )
...
Bumps [clap](https://github.com/clap-rs/clap ) from 3.2.16 to 3.2.17.
- [Release notes](https://github.com/clap-rs/clap/releases )
- [Changelog](https://github.com/clap-rs/clap/blob/v3.2.17/CHANGELOG.md )
- [Commits](https://github.com/clap-rs/clap/compare/v3.2.16...v3.2.17 )
---
updated-dependencies:
- dependency-name: clap
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-20 12:04:12 +00:00
dependabot[bot]
88ddcf3599
Bump softprops/action-gh-release ( #302 )
...
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-20 11:56:29 +00:00
dependabot[bot]
df3a8e21c7
Bump actions/checkout from 2 to 3 ( #303 )
...
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-20 11:44:52 +00:00
Félix Saparelli
4b00f5f143
Split crates and clean up structure of codebase ( #294 )
...
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-20 11:24:12 +00:00
Jiahao XU
bf700f9012
Improve err msg when source is missing in BinFile::install_bin
( #301 )
...
* Improve err msg in `helpers::atomic_install`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Check for missing `source` in `install_bin`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Fix `install_bin`: Use `try_exists` instead of `exists`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* Do not test `cargo-deb` in `ci-scripts/tests.sh`
Due to the fact that it uses gnu sparse extension which is not supported
by crate `tar`.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-20 00:25:51 +10:00
Félix Saparelli
763d4610e5
Don't prompt if there's nothing to do ( #293 )
...
Fixes #291
2022-08-09 09:09:21 +00:00
github-actions[bot]
4500e4af63
release: v0.12.0 ( #253 )
...
Co-authored-by: github-actions <github-actions@github.com>
2022-08-08 23:28:49 +12:00
Jiahao XU
9034f78df4
Merge pull request #282 from cargo-bins/skip-if-already-installed
...
Skip if already installed and add new cmdline option `--force`
2022-08-08 19:52:52 +10:00
Jiahao XU
a271e695a5
Ignore if package already up-to-date
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 19:18:30 +10:00
Jiahao XU
b69d7e7c06
Test When 0.11.0 is installed but can be upgraded in tests.sh
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:06:36 +10:00
Jiahao XU
36926518cf
Use VersionReqExt::is_latest_compatible
in entry:367
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:06:36 +10:00
Jiahao XU
b94dc979ac
Add new trait VersionReqExt
and impl it for VersionReq
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:06:34 +10:00
Jiahao XU
d932f1c262
Fix testing skip if installed in ci-scripts/tests.sh
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:59 +10:00
Jiahao XU
4a17460252
Test skip when installed in ci-scripts/tests.sh
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:59 +10:00
Jiahao XU
7f4edfd9f2
log::info!
if a crate is skipped due to already installed
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:59 +10:00
Jiahao XU
2c2b3c070f
Skip only if version_req
is satisfied
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:59 +10:00
Jiahao XU
431992dab0
Test --version
and $crate_name@$version
in tests.sh
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:59 +10:00
Jiahao XU
065f62a625
Use VersionReq
for Options::version_req
and update usage of
...
`CrateName` in `binstall::install`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:59 +10:00
Jiahao XU
686cae6ae8
Use &VersionReq
for param version_req
of fetch_crate_cratesio
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:59 +10:00
Jiahao XU
497ef80b27
Take &VersionReq
for 1st param of find_version
...
instead of `&str`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:58 +10:00
Jiahao XU
dd8e6a400d
Rename CrateName::version
to version_req
and change its type to
...
`Option<VersionReq>`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:58 +10:00
Jiahao XU
51d6b3039b
Impl new fn helpers::parse_version
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:58 +10:00
Jiahao XU
20c7b61e7a
FIx ci-scripts/tests.sh
: Use --force
to force installation.
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:58 +10:00
Jiahao XU
34f714c64f
Pass --force
to cargo-install
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:58 +10:00
Jiahao XU
4b79abeedc
Refactor: Run TempDir
creation in block_in_place
...
Since it could also issues blocking operations.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:58 +10:00
Jiahao XU
b8c44839c1
Detect install_path & load metadata in block_in_place
...
since they involves blocking fs io.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:58 +10:00
Jiahao XU
b4c6db7cda
Refactor & Optimize: Launch target detection as soon as possible
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:58 +10:00
Jiahao XU
4dae214af3
Use block_in_place
for loading metadata
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:57 +10:00
Jiahao XU
6716d75607
Minor Refactor: Gather code related to crate_names
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:57 +10:00
Jiahao XU
ac085533cc
Skip crates that are already installed.
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:57 +10:00
Jiahao XU
04fee49c22
Add new option Options::force
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:57 +10:00
Ryan
0bbeecce86
Merge pull request #284 from cargo-bins/split-docs
...
split docs, first step towards simplifying support instructions
2022-08-08 14:50:21 +12:00
Jiahao XU
1bb2602c86
Merge pull request #287 from cargo-bins/dependabot/cargo/semver-1.0.13
...
Bump semver from 1.0.12 to 1.0.13
2022-08-08 12:01:47 +10:00
Jiahao XU
cf7c3aec27
Merge pull request #286 from cargo-bins/dependabot/cargo/strum_macros-0.24.3
...
Bump strum_macros from 0.24.2 to 0.24.3
2022-08-08 12:01:18 +10:00
dependabot[bot]
5b35beb68b
Bump semver from 1.0.12 to 1.0.13
...
Bumps [semver](https://github.com/dtolnay/semver ) from 1.0.12 to 1.0.13.
- [Release notes](https://github.com/dtolnay/semver/releases )
- [Commits](https://github.com/dtolnay/semver/compare/1.0.12...1.0.13 )
---
updated-dependencies:
- dependency-name: semver
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-08-08 01:44:57 +00:00
dependabot[bot]
03291c895a
Bump strum_macros from 0.24.2 to 0.24.3
...
Bumps [strum_macros](https://github.com/Peternator7/strum ) from 0.24.2 to 0.24.3.
- [Release notes](https://github.com/Peternator7/strum/releases )
- [Changelog](https://github.com/Peternator7/strum/blob/master/CHANGELOG.md )
- [Commits](https://github.com/Peternator7/strum/commits )
---
updated-dependencies:
- dependency-name: strum_macros
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-08-08 01:44:44 +00:00
ryan kurte
5c703f30ca
add note about quickinstall / cargo install fallback
2022-08-08 11:42:06 +12:00
Jiahao XU
132c5dfaa9
Merge pull request #280 from cargo-bins/signal-handling
...
Add Signal handling
2022-08-06 20:13:03 +10:00
Félix Saparelli
68d3ab56f7
Enable sparse registry in CI ( #285 )
2022-08-06 22:07:24 +12:00
ryan kurte
b3f6eb64ea
split docs, first step towards simplifying support instructions
2022-08-06 09:44:17 +12:00