Commit graph

209 commits

Author SHA1 Message Date
Jiahao XU
f38c1e73c3
Ignore trust_dns log output (#323)
* Ignore all log except `binstall` & `cargo_binstall` unless `level` is set to `Trace`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-27 11:39:12 +00:00
Jiahao XU
305cda3336
Optimize compilation time (#320)
* Print `rerun-if-changed=build.rs` in `build.rs`
* Optimize compile-time: Extract `bin/src/lib.rs`
   
   so that `cargo-binstall (lib)` can be compiled in parallel to other
   deps.
* Refactor: Extract new mod `bin/src/bin_utils.rs`
* Extract new fn `MainExit::new`
* Refactor: Extract new fn `run_tokio_main`
* Handle `Runtime::new` err gracefully in `run_tokio_main`
   instead of `panic!`ing, return the error as `BinstallError`
* Avoid mixing `eprintln` and `error` in `MainExit::report`
* Set profile for `build-override`
   to speedup building of `build.rs` and proc macros.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-27 23:27:39 +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
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]
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
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