mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-21 13:08:42 +00:00

that provides more information: ``` cargo-binstall: 1.0.0 build-date: 2023-07-18 build-target: aarch64-apple-darwin build-features: default,fancy_no_backtrace,git,rustls,static,trust_dns,zstd_thin build-commit-hash: 39d8cfc07f2253080ce997e620406c2994dced25 build-commit-date: 2023-07-18 rustc-version: 1.71.0 rustc-commit-hash: 8ede3aae28fe6e4d52b38157d7bfe0d3bceef225 rustc-llvm-version: 16.0 ``` Fixed #627 Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
68 lines
1.9 KiB
Rust
68 lines
1.9 KiB
Rust
use std::time::Instant;
|
|
|
|
use binstalk::{helpers::jobserver_client::LazyJobserverClient, TARGET};
|
|
use log::LevelFilter;
|
|
use tracing::debug;
|
|
|
|
use cargo_binstall::{
|
|
args,
|
|
bin_util::{run_tokio_main, MainExit},
|
|
entry,
|
|
logging::logging,
|
|
};
|
|
|
|
#[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 = args::parse();
|
|
|
|
if args.version {
|
|
let cargo_binstall_version = env!("CARGO_PKG_VERSION");
|
|
if args.verbose {
|
|
let build_date = env!("VERGEN_BUILD_DATE");
|
|
|
|
let features = env!("VERGEN_CARGO_FEATURES");
|
|
|
|
let git_sha = option_env!("VERGEN_GIT_SHA").unwrap_or("UNKNOWN");
|
|
let git_commit_date = option_env!("VERGEN_GIT_COMMIT_DATE").unwrap_or("UNKNOWN");
|
|
|
|
let rustc_semver = env!("VERGEN_RUSTC_SEMVER");
|
|
let rustc_commit_hash = env!("VERGEN_RUSTC_COMMIT_HASH");
|
|
let rustc_llvm_version = env!("VERGEN_RUSTC_LLVM_VERSION");
|
|
|
|
println!(
|
|
r#"cargo-binstall: {cargo_binstall_version}
|
|
build-date: {build_date}
|
|
build-target: {TARGET}
|
|
build-features: {features}
|
|
build-commit-hash: {git_sha}
|
|
build-commit-date: {git_commit_date}
|
|
rustc-version: {rustc_semver}
|
|
rustc-commit-hash: {rustc_commit_hash}
|
|
rustc-llvm-version: {rustc_llvm_version}"#
|
|
);
|
|
} else {
|
|
println!("{cargo_binstall_version}");
|
|
}
|
|
MainExit::Success(None)
|
|
} else {
|
|
logging(
|
|
args.log_level.unwrap_or(LevelFilter::Info),
|
|
args.json_output,
|
|
);
|
|
|
|
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)
|
|
}
|
|
}
|