pub const SCRIPT_TEST_ENTRY_SOURCE: &str = "script-tests";
pub fn push_script_entry_patterns(
entry_patterns: &mut Vec<(crate::plugins::PathRule, String)>,
prefix: &str,
entry_files: &[String],
test_entry_files: &[String],
ci_sources: Option<&rustc_hash::FxHashMap<String, String>>,
) {
let source_of = |entry: &String| {
ci_sources
.and_then(|sources| sources.get(entry))
.map_or("scripts", String::as_str)
};
let sources = entry_files
.iter()
.map(|entry| (entry, source_of(entry)))
.chain(
test_entry_files
.iter()
.map(|entry| (entry, SCRIPT_TEST_ENTRY_SOURCE)),
);
for (entry, source) in sources {
if let Some(pat) = crate::scripts::normalize_script_entry_pattern(prefix, entry) {
entry_patterns.push((crate::plugins::PathRule::new(pat), source.to_string()));
}
}
}