mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-16 08:50:02 +00:00
Feature: SupportdDisable of strategies for crate using Cargo.toml
(#1828)
* Refactor: Move `Strategy` to `binstalk-types` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Add serialisation test for `Strategy` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Add support to disable strategies via crate `Cargo.toml` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Add e2e-test Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix `Cargo.toml` disabled strategy checking for compile strategy Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Optimize `resolve_inner`: Cache meta override Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Add compile-time length checking for `Strategy` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * More optimization Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix order of override: cli options alwayus takes precedence Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Add missing manifest for e2e-test Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> --------- Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
09d61d081d
commit
3f29fbe83a
11 changed files with 206 additions and 57 deletions
crates/bin/src
|
@ -21,7 +21,9 @@ use binstalk::{
|
|||
},
|
||||
};
|
||||
use binstalk_manifests::{
|
||||
cargo_config::Config, cargo_toml_binstall::PkgOverride, crates_manifests::Manifests,
|
||||
cargo_config::Config,
|
||||
cargo_toml_binstall::{PkgOverride, Strategy},
|
||||
crates_manifests::Manifests,
|
||||
};
|
||||
use file_format::FileFormat;
|
||||
use home::cargo_home;
|
||||
|
@ -30,11 +32,7 @@ use miette::{miette, Report, Result, WrapErr};
|
|||
use tokio::task::block_in_place;
|
||||
use tracing::{debug, error, info, warn};
|
||||
|
||||
use crate::{
|
||||
args::{Args, Strategy},
|
||||
gh_token, git_credentials, install_path,
|
||||
ui::confirm,
|
||||
};
|
||||
use crate::{args::Args, gh_token, git_credentials, install_path, ui::confirm};
|
||||
|
||||
pub fn install_crates(
|
||||
args: Args,
|
||||
|
@ -46,7 +44,7 @@ pub fn install_crates(
|
|||
let resolvers: Vec<_> = args
|
||||
.strategies
|
||||
.into_iter()
|
||||
.filter_map(|strategy| match strategy {
|
||||
.filter_map(|strategy| match strategy.0 {
|
||||
Strategy::CrateMetaData => Some(GhCrateMeta::new as Resolver),
|
||||
Strategy::QuickInstall => Some(QuickInstall::new as Resolver),
|
||||
Strategy::Compile => {
|
||||
|
@ -87,6 +85,7 @@ pub fn install_crates(
|
|||
pkg_url: args.pkg_url,
|
||||
pkg_fmt: args.pkg_fmt,
|
||||
bin_dir: args.bin_dir,
|
||||
disabled_strategies: None,
|
||||
signing: None,
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue