From e5593a1a1040c1ea04c88660844dd16481998167 Mon Sep 17 00:00:00 2001 From: Etienne Tremel <995474+etiennetremel@users.noreply.github.com> Date: Thu, 13 Jun 2024 21:34:34 +0200 Subject: [PATCH 1/3] feat: add --no-default-features flag --- cargo-espflash/src/main.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cargo-espflash/src/main.rs b/cargo-espflash/src/main.rs index 48cdd421..f01d1710 100644 --- a/cargo-espflash/src/main.rs +++ b/cargo-espflash/src/main.rs @@ -128,6 +128,9 @@ struct BuildArgs { /// Comma delimited list of build features #[arg(long, use_value_delimiter = true)] pub features: Option>, + /// Do not activate the `default` feature + #[arg(long)] + pub no_default_features: bool, /// Require Cargo.lock and cache are up to date #[arg(long)] pub frozen: bool, @@ -373,6 +376,9 @@ fn build( .ok_or_else(|| NoTargetError::new(Some(chip)))?; let mut metadata_cmd = MetadataCommand::new(); + if build_options.no_default_features { + metadata_cmd.features(cargo_metadata::CargoOpt::NoDefaultFeatures); + } if let Some(features) = &build_options.features { metadata_cmd.features(cargo_metadata::CargoOpt::SomeFeatures(features.clone())); } @@ -435,6 +441,10 @@ fn build( args.push(package.to_string()); } + if build_options.no_default_features { + args.push("--no-default-features".to_string()); + } + if let Some(features) = &build_options.features { args.push("--features".to_string()); args.push(features.join(",")); From 5ac82dc4b722238be97f36f11fd709f89aaa6707 Mon Sep 17 00:00:00 2001 From: Etienne Tremel <995474+etiennetremel@users.noreply.github.com> Date: Thu, 13 Jun 2024 21:44:13 +0200 Subject: [PATCH 2/3] fix: update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6f3314d..448b4e58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added - Add `hold-in-reset` and `reset` subcommands +- Add `--no-default-features` flag to mirror cargo features behavior ## [3.1.0] - 2024-05-24 From fc0e81c72e48d3d272fe4bc4f2155da0e1dff865 Mon Sep 17 00:00:00 2001 From: Etienne <995474+etiennetremel@users.noreply.github.com> Date: Mon, 17 Jun 2024 15:53:18 +0200 Subject: [PATCH 3/3] Update CHANGELOG.md Co-authored-by: Sergio Gasquez Arcos --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 448b4e58..c0afb5e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Add `hold-in-reset` and `reset` subcommands -- Add `--no-default-features` flag to mirror cargo features behavior +- [cargo-espflash]: Add `--no-default-features` flag to mirror cargo features behavior ## [3.1.0] - 2024-05-24