mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-08 05:00:02 +00:00

* 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>
35 lines
794 B
Rust
35 lines
794 B
Rust
use std::time::Instant;
|
|
|
|
use binstall::helpers::jobserver_client::LazyJobserverClient;
|
|
use log::debug;
|
|
|
|
use cargo_binstall::{
|
|
args,
|
|
bin_util::{run_tokio_main, MainExit},
|
|
entry, ui,
|
|
};
|
|
|
|
#[cfg(feature = "mimalloc")]
|
|
#[global_allocator]
|
|
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
|
|
|
fn main() -> MainExit {
|
|
// This must be the very first thing to happen
|
|
let jobserver_client = LazyJobserverClient::new();
|
|
|
|
let args = match args::parse() {
|
|
Ok(args) => args,
|
|
Err(err) => return MainExit::Error(err),
|
|
};
|
|
|
|
ui::logging(&args);
|
|
|
|
let start = Instant::now();
|
|
|
|
let result = run_tokio_main(entry::install_crates(args, jobserver_client));
|
|
|
|
let done = start.elapsed();
|
|
debug!("run time: {done:?}");
|
|
|
|
MainExit::new(result, done)
|
|
}
|