mirror of
https://gitee.com/openharmony/third_party_rust_bindgen
synced 2024-12-04 05:22:20 +00:00
0296f9e86c
remove `clap` dependency 🎉
update the book installation instructions
21 lines
517 B
Rust
21 lines
517 B
Rust
/// Generating build depfiles from parsed bindings.
|
|
use std::{collections::BTreeSet, path::PathBuf};
|
|
|
|
#[derive(Clone, Debug)]
|
|
pub(crate) struct DepfileSpec {
|
|
pub output_module: String,
|
|
pub depfile_path: PathBuf,
|
|
}
|
|
|
|
impl DepfileSpec {
|
|
pub fn write(&self, deps: &BTreeSet<String>) -> std::io::Result<()> {
|
|
let mut buf = format!("{}:", self.output_module);
|
|
|
|
for file in deps {
|
|
buf = format!("{} {}", buf, file);
|
|
}
|
|
|
|
std::fs::write(&self.depfile_path, &buf)
|
|
}
|
|
}
|