Skip to content

Commit cc7a358

Browse files
committed
Split Build::tool_enabled to with/without extended
This commit repurposes the bootstrap `Build::tool_enabled` helper to just check the set of enabled tools. The preexisting check for `extended` as well is refactored to a separate method `Build::extended_tool_enabled`. The purpose for this change is to support `./x.py test --target wasm32-wasip2` which requires the `wasm-component-ld` tool unconditionally regardless of whether `extended` is supported or not.
1 parent b416342 commit cc7a358

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

src/bootstrap/src/core/build_steps/tool.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ impl Step for Cargo {
810810

811811
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
812812
let builder = run.builder;
813-
run.path("src/tools/cargo").default_condition(builder.tool_enabled("cargo"))
813+
run.path("src/tools/cargo").default_condition(builder.extended_tool_enabled("cargo"))
814814
}
815815

816816
fn make_run(run: RunConfig<'_>) {
@@ -1032,7 +1032,8 @@ impl Step for RustAnalyzer {
10321032

10331033
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
10341034
let builder = run.builder;
1035-
run.path("src/tools/rust-analyzer").default_condition(builder.tool_enabled("rust-analyzer"))
1035+
run.path("src/tools/rust-analyzer")
1036+
.default_condition(builder.extended_tool_enabled("rust-analyzer"))
10361037
}
10371038

10381039
fn make_run(run: RunConfig<'_>) {
@@ -1089,8 +1090,8 @@ impl Step for RustAnalyzerProcMacroSrv {
10891090
run.path("src/tools/rust-analyzer")
10901091
.path("src/tools/rust-analyzer/crates/proc-macro-srv-cli")
10911092
.default_condition(
1092-
builder.tool_enabled("rust-analyzer")
1093-
|| builder.tool_enabled("rust-analyzer-proc-macro-srv"),
1093+
builder.extended_tool_enabled("rust-analyzer")
1094+
|| builder.extended_tool_enabled("rust-analyzer-proc-macro-srv"),
10941095
)
10951096
}
10961097

@@ -1176,7 +1177,7 @@ impl Step for LlvmBitcodeLinker {
11761177
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
11771178
let builder = run.builder;
11781179
run.path("src/tools/llvm-bitcode-linker")
1179-
.default_condition(builder.tool_enabled("llvm-bitcode-linker"))
1180+
.default_condition(builder.extended_tool_enabled("llvm-bitcode-linker"))
11801181
}
11811182

11821183
fn make_run(run: RunConfig<'_>) {

src/bootstrap/src/lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,10 +1485,12 @@ impl Build {
14851485
///
14861486
/// This requires that both the `extended` key is set and the `tools` key is
14871487
/// either unset or specifically contains the specified tool.
1488+
fn extended_tool_enabled(&self, tool: &str) -> bool {
1489+
self.config.extended && self.tool_enabled(tool)
1490+
}
1491+
1492+
/// Returns whether the specified tool is configured as part of this build.
14881493
fn tool_enabled(&self, tool: &str) -> bool {
1489-
if !self.config.extended {
1490-
return false;
1491-
}
14921494
match &self.config.tools {
14931495
Some(set) => set.contains(tool),
14941496
None => true,

0 commit comments

Comments
 (0)