Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions crates/cargo-codspeed/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ pub(crate) struct BenchTargetFilters {
const FEATURE_HELP: &str = "Feature Selection";
const COMPILATION_HELP: &str = "Compilation Options";
const TARGET_HELP: &str = "Target Selection";
const LOCKED_HELP: &str = "Assert the `Cargo.lock` file remains unchanged";

#[derive(Subcommand)]
enum Commands {
/// Build the benchmarks
Expand Down Expand Up @@ -72,6 +74,10 @@ enum Commands {
#[arg(long, default_value = "bench", help_heading = COMPILATION_HELP)]
profile: String,

/// Assert that `Cargo.lock` will remain unchanged
#[arg(long, help_heading = LOCKED_HELP)]
locked: bool,

#[command(flatten)]
bench_target_filters: BenchTargetFilters,
},
Expand Down Expand Up @@ -104,6 +110,7 @@ pub fn run(args: impl Iterator<Item = OsString>) -> Result<()> {
jobs,
no_default_features,
profile,
locked,
} => {
let passthrough_flags = {
let mut passthrough_flags = Vec::new();
Expand All @@ -116,6 +123,10 @@ pub fn run(args: impl Iterator<Item = OsString>) -> Result<()> {
passthrough_flags.push("--no-default-features".to_string());
}

if locked {
passthrough_flags.push("--locked".to_string());
}

if let Some(jobs) = jobs {
passthrough_flags.push(format!("--jobs={jobs}"));
}
Expand Down