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

* Fix cli override in entry.rs Forward `args.disabled_strategies` Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Fix `args::parse`: Do not free disabled_strategies Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Fix passing of cli_overrides Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Create strategies-test-override-Cargo.toml Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Add e2e-tests for cli-overrides Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Fix entry.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * fix entry.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Fix entry.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Update strategies.sh Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Compute cli_overrides in args::parse Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * fix use of args::parse main_impl.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Update entry.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Fix args::parse Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Fix typo in args.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Fix args.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Fix fmt in args.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * fix fmt in main_impl.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * update e2e-test-strategies Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Update e2e-tests/strategies.sh Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Update e2e-tests/strategies.sh Make sure both --strategies and --disable-strategies is tested Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Update strategies.sh Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> --------- Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
65 lines
1.9 KiB
Rust
65 lines
1.9 KiB
Rust
use std::{process::Termination, time::Instant};
|
|
|
|
use binstalk::{helpers::jobserver_client::LazyJobserverClient, TARGET};
|
|
use log::LevelFilter;
|
|
use tracing::debug;
|
|
|
|
use crate::{
|
|
args,
|
|
bin_util::{run_tokio_main, MainExit},
|
|
entry,
|
|
logging::logging,
|
|
};
|
|
|
|
pub fn do_main() -> impl Termination {
|
|
// This must be the very first thing to happen
|
|
let jobserver_client = LazyJobserverClient::new();
|
|
|
|
let (args, cli_overrides) = 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, cli_overrides, jobserver_client));
|
|
|
|
let done = start.elapsed();
|
|
debug!("run time: {done:?}");
|
|
|
|
MainExit::new(result, done)
|
|
}
|
|
}
|