xtask/
utils.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use cargo_metadata::Metadata;

pub fn get_exclude_for_backend<'a>(backend: &str, metadata: &'a Metadata) -> Vec<&'a str> {
    let examples = metadata.workspace_root.join("examples");
    let backend_examples = examples.join(backend);
    metadata
        .workspace_packages()
        .into_iter()
        .filter_map(move |p| {
            if p.manifest_path.starts_with(&examples)
                && !p.manifest_path.starts_with(&backend_examples)
            {
                Some(["--exclude", &p.name])
            } else {
                None
            }
        })
        .flatten()
        .collect()
}