1/// Generating build depfiles from parsed bindings.
2use std::{collections::BTreeSet, path::PathBuf};
3
4#[derive(Clone, Debug)]
5pub(crate) struct DepfileSpec {
6 pub output_module: String,
7 pub depfile_path: PathBuf,
8}
9
10impl DepfileSpec {
11 pub fn write(&self, deps: &BTreeSet<String>) -> std::io::Result<()> {
12 let mut buf: String = format!("{}:", self.output_module);
13
14 for file: &String in deps {
15 buf = format!("{} {}", buf, file);
16 }
17
18 std::fs::write(&self.depfile_path, &buf)
19 }
20}
21