diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 0c4f3265dbf9e..c8d1f5b3bb661 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -168,7 +168,7 @@ impl PathSet { PathSet::Set(BTreeSet::new()) } - fn one>(path: P, kind: Kind) -> PathSet { + pub fn one>(path: P, kind: Kind) -> PathSet { let mut set = BTreeSet::new(); set.insert(TaskPath { path: path.into(), kind: Some(kind) }); PathSet::Set(set) @@ -226,18 +226,7 @@ impl StepDescription { } fn is_excluded(&self, builder: &Builder<'_>, pathset: &PathSet) -> bool { - if builder.config.exclude.iter().any(|e| pathset.has(&e.path, e.kind)) { - eprintln!("Skipping {:?} because it is excluded", pathset); - return true; - } - - if !builder.config.exclude.is_empty() { - builder.verbose(&format!( - "{:?} not skipped for {:?} -- not in {:?}", - pathset, self.name, builder.config.exclude - )); - } - false + builder.is_excluded(pathset, &format!("for {:?}", self.name)) } fn run(v: &[StepDescription], builder: &Builder<'_>, paths: &[PathBuf]) { @@ -283,7 +272,7 @@ impl StepDescription { } } - if !attempted_run { + if !attempted_run && !builder.is_excluded(&PathSet::one(path, builder.kind), "") { panic!("error: no rules matched {}", path.display()); } } @@ -747,6 +736,21 @@ impl<'a> Builder<'a> { StepDescription::run(v, self, paths); } + pub fn is_excluded(&self, pathset: &PathSet, extra_description: &str) -> bool { + if self.config.exclude.iter().any(|e| pathset.has(&e.path, e.kind)) { + eprintln!("Skipping {:?} because it is excluded", pathset); + return true; + } + + if !self.config.exclude.is_empty() { + self.verbose(&format!( + "{:?} not skipped{} -- not in {:?}", + pathset, extra_description, self.config.exclude + )); + } + false + } + /// Obtain a compiler at a given stage and for a given host. Explicitly does /// not take `Compiler` since all `Compiler` instances are meant to be /// obtained through this function, since it ensures that they are valid