in src/producer.rs [398:448]
fn llvm_format_producer(
tmp_dir: &Path,
profiles: &FxHashMap<String, Vec<&Archive>>,
item_format: ItemFormat,
sender: &JobSender,
) {
let ext = match item_format {
ItemFormat::Profdata => "profdata",
ItemFormat::Profraw => "profraw",
_ => panic!("function is specific to profdata and profraw files"),
};
if profiles.is_empty() {
return;
}
let mut profile_paths = Vec::new();
for (name, archives) in profiles {
let path = PathBuf::from(name);
let stem = clean_path(&path.with_extension(""));
// TODO: If there is only one archive and it is not a zip, we don't need to "extract".
for (num, &archive) in archives.iter().enumerate() {
let profile_path = if let ArchiveType::Plain(_) = *archive.item.borrow() {
Some(path.clone())
} else {
None
};
let profile_path = if let Some(profile_path) = profile_path {
profile_path
} else {
let tmp_path = tmp_dir.join(format!("{}_{}.{}", stem, num + 1, ext));
archive.extract(name, &tmp_path);
tmp_path
};
profile_paths.push(profile_path);
}
}
sender
.send(Some(WorkItem {
format: item_format,
item: ItemType::Paths(profile_paths),
name: ext.to_string(),
}))
.unwrap()
}