From 10bef56fff02ff1da8a0993f33e6d226882c5ccd Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 22 Sep 2021 22:25:42 +0200 Subject: Simplify explicit request check --- src/bootstrap/builder.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/bootstrap/builder.rs') diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 0a6ed2f49b7..1f2109879d1 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -1617,6 +1617,22 @@ impl<'a> Builder<'a> { // Only execute if it's supposed to run as default if desc.default && should_run.is_really_default() { self.ensure(step) } else { None } } + + /// Checks if any of the "should_run" paths is in the `Builder` paths. + pub(crate) fn was_invoked_explicitly(&'a self) -> bool { + let desc = StepDescription::from::(); + let should_run = (desc.should_run)(ShouldRun::new(self)); + + for path in &self.paths { + if should_run.paths.iter().any(|s| s.has(path)) + && !desc.is_excluded(self, &PathSet::Suite(path.clone())) + { + return true; + } + } + + false + } } #[cfg(test)] -- cgit 1.4.1-3-g733a5