Jiahao XU
4a9e04967c
Refactor: Mv confirmation from install_from_source
to entry
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-11 22:21:11 +10:00
Jiahao XU
8bbc6d0171
Rm unused lint allow(clippy::too_many_arguments)
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-11 22:19:21 +10:00
Jiahao XU
2d0c4a8c4e
Refactor: Extract fn collect_bin_files
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-11 22:18:45 +10:00
Jiahao XU
7a85cae859
Refactor: Mv confirm into entry
and remove unncessary confirm
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-11 21:49:28 +10:00
Jiahao XU
fa63dbe5cf
Refactor: Rm global var helpers::CLIENT
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-10 18:07:07 +10:00
Félix Saparelli
63afa5b791
Just hide mimalloc behind a feature, available for all platforms
2022-07-06 23:33:51 +12:00
Félix Saparelli
e66dc60867
Also use mimalloc on musl
2022-07-06 23:31:24 +12:00
Félix Saparelli
fe724585ae
Use mimalloc on windows
2022-07-05 23:10:57 +12:00
Jiahao XU
6582eefd25
Refactor: Replace REQWESTCONFIG
with initialize_reqwest_client
...
so that we don't need two `OnceCell`s.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-05 19:57:54 +10:00
Félix Saparelli
68ba9b06f5
Create meta files if not present
2022-07-05 21:46:58 +12:00
Félix Saparelli
17cf6f5dc5
Write to .crates2.json
2022-07-05 21:17:59 +12:00
Félix Saparelli
1c2d005fd4
Write to .crates.toml
2022-07-04 23:53:47 +12:00
Félix Saparelli
66a14d0c7c
Polish up new secure options
2022-06-28 03:19:04 +12:00
Jiahao XU
a35db557ea
Run "Install binaries" step in block_in_place
mode
...
Since they execute a lot of blocking fs operations.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 19:48:03 +10:00
Félix Saparelli
cc8144e06d
Merge pull request #192 from NobodyXu/optimize/parallelize-target-detection
...
Optimize/parallelize target detection
2022-06-23 21:41:15 +12:00
Jiahao XU
68d111f946
Use get_desired_targets
in entry
...
instead of `detect_targets`, so that if `opts.targets` is
`None`, the future returned by `detect_targets` can be run
in parallel by using `tokio::spawn` with other async code
in `entry`, such as `fetch_crate_cratesio`.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 14:47:59 +10:00
Jiahao XU
691bc18dd0
Set min TLS ver to 1.2 for https only mode
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 13:03:50 +10:00
Jiahao XU
087d544331
Initialize REQWESTGLOBALCONFIG
in main::entry
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 13:01:22 +10:00
Jiahao XU
64f468acd6
Add new opt https_only_mode
& min_tls_version
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 13:00:52 +10:00
Jiahao XU
c5a2a89361
Rm the duplicate debug!
in main.rs:214
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-21 13:52:27 +10:00
Jiahao XU
24b1941c1a
Simplify fetch_crate_cratesio
: Rm unused param temp_dir
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 17:09:17 +10:00
Jiahao XU
5bb5d12949
Optimize fetch_crate_cratesio
using ManifestVisitor
...
and `download_tar_based_and_visit`.
By using these two items, we avoid any I/O altogether.
Everything happens in memory, thus there will be no i/o related errors
or cost.
This commit does not regress anything because
`helpers::load_manifest_path` calls `Manifest::from_path_with_metadata`,
which read in the whole `Cargo.toml` file at once.
Thus this commit would not cause any OOM when the the original code
would not.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 16:37:53 +10:00
Jiahao XU
88c3f15b3f
Rename Confirmer
to UIThread
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 12:59:27 +10:00
Jiahao XU
47ed7ce27b
Use Confirmer
instead of confirm
in main.rs
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 12:59:26 +10:00
Jiahao XU
728d1fd6dd
Rm unused param pkg_path
in install_from_package
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 14:47:43 +10:00
Jiahao XU
c9b0d45a24
Use download_and_extract
in fetchers
...
to improve efficiency by avoiding disk io (except for `PkgFmt::Zip`
and `PkgFmt::Bin`) and run the compresser in parallel to the downloader.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 14:46:00 +10:00
Félix Saparelli
6333fb0bd3
Use newer format! syntax
2022-06-08 16:39:34 +12:00
Félix Saparelli
d0a292e173
Ignore rustls log output
2022-06-08 01:35:47 +12:00
Félix Saparelli
0abfcbd1fb
Simplify short help output
2022-06-08 01:04:46 +12:00
Félix Saparelli
235bcac300
Properly support multiple targets
2022-06-08 01:00:21 +12:00
Félix Saparelli
15d828b55b
Stop lying about url support
2022-06-08 00:54:30 +12:00
Félix Saparelli
f2582b9cf2
Expand help text
2022-06-08 00:11:39 +12:00
Félix Saparelli
d58ce3892a
Use clap3
2022-06-07 23:56:24 +12:00
Félix Saparelli
6877a0c3a9
Merge pull request #161 from NobodyXu/feature/bin-multi-targets
2022-06-07 23:55:05 +12:00
Jiahao XU
2ea341381d
Fix parsing in entry
: Use std::env::args_os
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 17:07:17 +10:00
Jiahao XU
6f7c8fa8ab
Merge branch 'main' into feature/bin-multi-targets
2022-06-07 16:38:14 +10:00
Jiahao XU
ad3e707aa3
Fix install_from_package
: Rm use of opts.target
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 16:37:04 +10:00
Jiahao XU
456e896483
Use code 17 for MainExit::JoinErr
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 16:22:01 +10:00
Jiahao XU
903c9f5591
Refactor: Use Result::map_or_else
in main
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 16:19:07 +10:00
Jiahao XU
b6245bcf4b
Spawn entry()
in main
to improve parallelism
...
Using `rt.block_on`, the future returned by `entry` can only be run on
the main thread.
Buf if we use `tokio::spawn`, then it can be run on any thread.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 16:13:38 +10:00
Jiahao XU
c393270899
Run fetchers in parallel in MultiFetcher.first_available
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 15:29:09 +10:00
Jiahao XU
603955b848
Support for checking multi-targets
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 15:11:04 +10:00
Félix Saparelli
ac74da4a27
Clippy suggestions
2022-06-01 01:11:26 +12:00
Félix Saparelli
529781a9a9
Format and link version mismatch warning
2022-06-01 00:29:18 +12:00
Félix Saparelli
7f0c818313
Don’t print "Fatal error" for UserAbort
2022-06-01 00:29:17 +12:00
Félix Saparelli
84ebc0039e
Pretty-print errors
2022-06-01 00:29:17 +12:00
Félix Saparelli
bd35c473a9
Use new Termination trait
2022-06-01 00:29:17 +12:00
Félix Saparelli
f56ed6fc4c
Add per-error exit codes
2022-06-01 00:29:17 +12:00
Félix Saparelli
c0eaffb05d
Refactor for rich errors, split user abort and genuine error
2022-06-01 00:29:14 +12:00
Lea Fairbanks
19d0616324
Add cli overrides
2022-05-31 18:00:07 +12:00