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