I have a list of files and want to run some program for every file, but only if it was changed. So I put all the files in the vector and iterated, like this:
// build.rs
let files = vec![
"fileA",
"fileB",
];
for file in files{
println!("cargo:rerun-if-changed={}", file);
let output = Command::new("glslangValidator")
.args(&["-V", file, "-o", file])
.output()
.expect("failed to run glslangValidator");
}
This works, but the build process runs for every file even if only one from the list was changed. Instead, I want glslangValidator to be called only for the files that were changed between builds.