Skip to content

Commit 876ed93

Browse files
authored
Add helper for custom checks (#7)
1 parent ba96b4b commit 876ed93

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

crates/tracel-xtask/src/utils/helpers.rs

+26
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,32 @@ pub fn custom_crates_build(
3030
})
3131
}
3232

33+
/// Allow to check additional crates outside the common check commands
34+
pub fn custom_crates_check(
35+
crates: Vec<&str>,
36+
args: Vec<&str>,
37+
envs: Option<HashMap<&str, &str>>,
38+
path: Option<&Path>,
39+
group_msg: &str,
40+
) -> anyhow::Result<()> {
41+
let mut base_args = vec!["check", "--color", "always"];
42+
base_args.extend(args);
43+
crates.iter().try_for_each(|c| {
44+
group!("Custom Check: {} ({})", *c, group_msg);
45+
let mut args = base_args.clone();
46+
args.extend(vec!["-p", *c]);
47+
run_process(
48+
"cargo",
49+
&args,
50+
envs.clone(),
51+
path,
52+
&format!("Custom check failed for {}", *c),
53+
)?;
54+
endgroup!();
55+
Ok(())
56+
})
57+
}
58+
3359
/// Allow to test additional crates with specific flags and config
3460
pub fn custom_crates_tests(
3561
crates: Vec<&str>,

0 commit comments

Comments
 (0)