Skip to content

Commit

Permalink
Add helper for custom checks
Browse files Browse the repository at this point in the history
  • Loading branch information
wingertge committed Oct 30, 2024
1 parent ba96b4b commit b676fbc
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions crates/tracel-xtask/src/utils/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,32 @@ pub fn custom_crates_build(
})
}

/// Allow to check additional crates outside the common check commands
pub fn custom_crates_check(
crates: Vec<&str>,
args: Vec<&str>,
envs: Option<HashMap<&str, &str>>,
path: Option<&Path>,
group_msg: &str,
) -> anyhow::Result<()> {
let mut base_args = vec!["check", "--color", "always"];
base_args.extend(args);
crates.iter().try_for_each(|c| {
group!("Custom Check: {} ({})", *c, group_msg);
let mut args = base_args.clone();
args.extend(vec!["-p", *c]);
run_process(
"cargo",
&args,
envs.clone(),
path,
&format!("Custom check failed for {}", *c),
)?;
endgroup!();
Ok(())
})
}

/// Allow to test additional crates with specific flags and config
pub fn custom_crates_tests(
crates: Vec<&str>,
Expand Down

0 comments on commit b676fbc

Please sign in to comment.