Skip to content

Commit 32ca6b7

Browse files
committed
feat: More verbose explanation of why builds don't work
1 parent 2cb2af6 commit 32ca6b7

1 file changed

Lines changed: 26 additions & 14 deletions

File tree

src/work.rs

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -493,21 +493,31 @@ impl<'a> Work<'a> {
493493
return Ok(());
494494
}
495495

496-
if !self.options.dirty_on_output {
497-
// Original behavir
498-
let build = &self.graph.builds[id];
499-
let hash = hash::hash_build(&self.graph.files, &self.file_state, build);
500-
self.db.write_build(&self.graph, id, hash)?;
496+
// Our behavior
497+
let build = &self.graph.builds[id];
498+
if self.options.dirty_on_output && !result.output.is_empty() && build.can_dirty_on_output {
499+
if self.options.explain {
500+
self.progress.log(&format!(
501+
"explain: {}: output produced, marking dirty",
502+
build.location
503+
));
504+
}
505+
self.db.write_build(&self.graph, id, BuildHash(0))?;
501506
} else {
502-
// Our behavior
503507
let build = &self.graph.builds[id];
504-
if !result.output.is_empty() && build.can_dirty_on_output {
505-
self.db.write_build(&self.graph, id, BuildHash(0))?;
506-
} else {
507-
let build = &self.graph.builds[id];
508-
let hash = hash::hash_build(&self.graph.files, &self.file_state, build);
509-
self.db.write_build(&self.graph, id, hash)?;
508+
let hash = hash::hash_build(&self.graph.files, &self.file_state, build);
509+
510+
if self.options.explain {
511+
self.progress
512+
.log(&format!("Finished {} with hash {:?}", build.location, hash));
513+
self.progress.log(&hash::explain_hash_build(
514+
&self.graph.files,
515+
&self.file_state,
516+
build,
517+
));
510518
}
519+
520+
self.db.write_build(&self.graph, id, hash)?;
511521
}
512522

513523
Ok(())
@@ -653,8 +663,10 @@ impl<'a> Work<'a> {
653663
let hash = hash::hash_build(&self.graph.files, &self.file_state, build);
654664
if prev_hash != hash {
655665
if self.options.explain {
656-
self.progress
657-
.log(&format!("explain: {}: manifest changed", build.location));
666+
self.progress.log(&format!(
667+
"explain: {}: manifest changed: hashes prev {:?}, now {:?}",
668+
build.location, prev_hash, hash
669+
));
658670
self.progress.log(&hash::explain_hash_build(
659671
&self.graph.files,
660672
&self.file_state,

0 commit comments

Comments
 (0)