about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJack Huey <31162821+jackh726@users.noreply.github.com>2021-05-18 22:36:08 -0400
committerGitHub <noreply@github.com>2021-05-18 22:36:08 -0400
commitf66b6c2e6cf4ad3084fe30ac4dea5e43b9ab7d84 (patch)
treefc9ebafa1a09da1eef8c335c0110056c92bd89eb
parentec0e0d1e7aac94245dfe0c11f55c9ba6d2754aba (diff)
parent15aad5fcdb33a75e495a3d427228df62b6eadd5b (diff)
downloadrust-f66b6c2e6cf4ad3084fe30ac4dea5e43b9ab7d84.tar.gz
rust-f66b6c2e6cf4ad3084fe30ac4dea5e43b9ab7d84.zip
Rollup merge of #85297 - infinity0:master, r=Mark-Simulacrum
bootstrap: build cargo only if requested in tools

In Debian we'd like to build rustfmt and clippy alongside rustc, but we're still excluding cargo from the rustc build and doing that separately. This patch makes that possible.
-rw-r--r--src/bootstrap/tool.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index 12571c1b97d..dd8c6023a44 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -593,7 +593,14 @@ impl Step for Cargo {
 
     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
         let builder = run.builder;
-        run.path("src/tools/cargo").default_condition(builder.config.extended)
+        run.path("src/tools/cargo").default_condition(
+            builder.config.extended
+                && builder.config.tools.as_ref().map_or(
+                    true,
+                    // If `tools` is set, search list for this tool.
+                    |tools| tools.iter().any(|tool| tool == "cargo"),
+                ),
+        )
     }
 
     fn make_run(run: RunConfig<'_>) {