Skip to content

Commit

Permalink
Add support for cargo --profile
Browse files Browse the repository at this point in the history
  • Loading branch information
madadam committed Nov 2, 2022
1 parent c1268f9 commit 171509d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/bin/cargo-flamegraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ struct Opt {
#[clap(long)]
dev: bool,

/// Build with the specified profile
#[clap(long)]
profile: Option<String>,

/// package with the binary to run
#[clap(short, long)]
package: Option<String>,
Expand Down Expand Up @@ -84,8 +88,10 @@ fn build(opt: &Opt, kind: impl IntoIterator<Item = String>) -> anyhow::Result<Ve
cmd.arg("build");
}

if let Some(profile) = &opt.profile {
cmd.arg("--profile").arg(profile);
// do not use `--release` when we are building for `bench`
if !opt.dev && opt.bench.is_none() {
} else if !opt.dev && opt.bench.is_none() {
cmd.arg("--release");
}

Expand Down

0 comments on commit 171509d

Please sign in to comment.