about summary refs log tree commit diff
path: root/src/bootstrap/builder.rs
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2021-09-22 22:25:42 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2021-09-24 12:01:57 +0200
commit10bef56fff02ff1da8a0993f33e6d226882c5ccd (patch)
tree7b49d269cb2961d282d4296144d4657957a0156f /src/bootstrap/builder.rs
parentcfff31bc833070a00578bd6178160aeed56f28ba (diff)
downloadrust-10bef56fff02ff1da8a0993f33e6d226882c5ccd.tar.gz
rust-10bef56fff02ff1da8a0993f33e6d226882c5ccd.zip
Simplify explicit request check
Diffstat (limited to 'src/bootstrap/builder.rs')
-rw-r--r--src/bootstrap/builder.rs16
1 files changed, 16 insertions, 0 deletions
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<S: Step>(&'a self) -> bool {
+        let desc = StepDescription::from::<S>();
+        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)]