aboutsummaryrefslogtreecommitdiff
path: root/src/makefile/target.rs
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-03-31 12:51:11 -0600
committerMelody Horn <melody@boringcactus.com>2021-03-31 12:51:11 -0600
commite1a0584936b3aa5ce971e875dec750d2ae937d2e (patch)
treef1db896b9623e6480181df3ad4792107d9d87ecf /src/makefile/target.rs
parentd10ad4b37f726180e3da562a1fbb6cbbd106ef58 (diff)
downloadmakers-e1a0584936b3aa5ce971e875dec750d2ae937d2e.tar.gz
makers-e1a0584936b3aa5ce971e875dec750d2ae937d2e.zip
massively upgrade error handling
Diffstat (limited to 'src/makefile/target.rs')
-rw-r--r--src/makefile/target.rs18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/makefile/target.rs b/src/makefile/target.rs
index eb181cd..04603c9 100644
--- a/src/makefile/target.rs
+++ b/src/makefile/target.rs
@@ -42,26 +42,32 @@ impl Target {
}
let exists = metadata(&self.name).is_ok();
let newer_than_all_dependencies = self.prerequisites.iter().all(|t| {
- self.newer_than(&file.get_target(t).borrow())
+ file.get_target(t)
+ .ok()
+ .and_then(|t| self.newer_than(&t.borrow()))
.unwrap_or(false)
});
exists && newer_than_all_dependencies
}
- pub(crate) fn update(&self, file: &Makefile) {
+ pub(crate) fn update(&self, file: &Makefile) -> anyhow::Result<()> {
for prereq in &self.prerequisites {
- file.update_target(prereq);
+ file.update_target(prereq)?;
}
if !self.is_up_to_date(file) {
- self.execute_commands(file);
+ self.execute_commands(file)?;
}
self.already_updated.set(true);
+
+ Ok(())
}
- fn execute_commands(&self, file: &Makefile) {
+ fn execute_commands(&self, file: &Makefile) -> anyhow::Result<()> {
for command in &self.commands {
- command.execute(file, self);
+ command.execute(file, self)?;
}
+
+ Ok(())
}
}