Skip to content

Commit baef666

Browse files
committed
adapt tool module to ToolBuildResult
Signed-off-by: onur-ozkan <[email protected]>
1 parent 5e5b1b0 commit baef666

File tree

6 files changed

+189
-179
lines changed

6 files changed

+189
-179
lines changed

src/bootstrap/src/core/build_steps/compile.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -1977,13 +1977,14 @@ impl Step for Assemble {
19771977
let maybe_install_llvm_bitcode_linker = |compiler| {
19781978
if builder.config.llvm_bitcode_linker_enabled {
19791979
trace!("llvm-bitcode-linker enabled, installing");
1980-
let src_path = builder.ensure(crate::core::build_steps::tool::LlvmBitcodeLinker {
1981-
compiler,
1982-
target: target_compiler.host,
1983-
extra_features: vec![],
1984-
});
1980+
let llvm_bitcode_linker =
1981+
builder.ensure(crate::core::build_steps::tool::LlvmBitcodeLinker {
1982+
compiler,
1983+
target: target_compiler.host,
1984+
extra_features: vec![],
1985+
});
19851986
let tool_exe = exe("llvm-bitcode-linker", target_compiler.host);
1986-
builder.copy_link(&src_path, &libdir_bin.join(tool_exe));
1987+
builder.copy_link(&llvm_bitcode_linker.tool_path, &libdir_bin.join(tool_exe));
19871988
}
19881989
};
19891990

@@ -2171,14 +2172,13 @@ impl Step for Assemble {
21712172
// logic to create the final binary. This is used by the
21722173
// `wasm32-wasip2` target of Rust.
21732174
if builder.tool_enabled("wasm-component-ld") {
2174-
let wasm_component_ld_exe =
2175-
builder.ensure(crate::core::build_steps::tool::WasmComponentLd {
2176-
compiler: build_compiler,
2177-
target: target_compiler.host,
2178-
});
2175+
let wasm_component = builder.ensure(crate::core::build_steps::tool::WasmComponentLd {
2176+
compiler: build_compiler,
2177+
target: target_compiler.host,
2178+
});
21792179
builder.copy_link(
2180-
&wasm_component_ld_exe,
2181-
&libdir_bin.join(wasm_component_ld_exe.file_name().unwrap()),
2180+
&wasm_component.tool_path,
2181+
&libdir_bin.join(wasm_component.tool_path.file_name().unwrap()),
21822182
);
21832183
}
21842184

src/bootstrap/src/core/build_steps/dist.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ impl Step for Rustc {
430430
},
431431
builder.kind,
432432
) {
433-
builder.install(&ra_proc_macro_srv, &image.join("libexec"), 0o755);
433+
builder.install(&ra_proc_macro_srv.tool_path, &image.join("libexec"), 0o755);
434434
}
435435

436436
let libdir_relative = builder.libdir_relative(compiler);
@@ -1134,7 +1134,7 @@ impl Step for Cargo {
11341134
let mut tarball = Tarball::new(builder, "cargo", &target.triple);
11351135
tarball.set_overlay(OverlayKind::Cargo);
11361136

1137-
tarball.add_file(cargo, "bin", 0o755);
1137+
tarball.add_file(cargo.tool_path, "bin", 0o755);
11381138
tarball.add_file(etc.join("_cargo"), "share/zsh/site-functions", 0o644);
11391139
tarball.add_renamed_file(etc.join("cargo.bashcomp.sh"), "etc/bash_completion.d", "cargo");
11401140
tarball.add_dir(etc.join("man"), "share/man/man1");
@@ -1222,7 +1222,7 @@ impl Step for RustAnalyzer {
12221222
let mut tarball = Tarball::new(builder, "rust-analyzer", &target.triple);
12231223
tarball.set_overlay(OverlayKind::RustAnalyzer);
12241224
tarball.is_preview(true);
1225-
tarball.add_file(rust_analyzer, "bin", 0o755);
1225+
tarball.add_file(rust_analyzer.tool_path, "bin", 0o755);
12261226
tarball.add_legal_and_readme_to("share/doc/rust-analyzer");
12271227
Some(tarball.generate())
12281228
}
@@ -2272,7 +2272,7 @@ impl Step for LlvmBitcodeLinker {
22722272
tarball.set_overlay(OverlayKind::LlvmBitcodeLinker);
22732273
tarball.is_preview(true);
22742274

2275-
tarball.add_file(llbc_linker, self_contained_bin_dir, 0o755);
2275+
tarball.add_file(llbc_linker.tool_path, self_contained_bin_dir, 0o755);
22762276

22772277
Some(tarball.generate())
22782278
}

src/bootstrap/src/core/build_steps/perf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ Consider setting `rust.debuginfo-level = 1` in `config.toml`."#);
166166
let results_dir = rustc_perf_dir.join("results");
167167
builder.create_dir(&results_dir);
168168

169-
let mut cmd = command(collector);
169+
let mut cmd = command(collector.tool_path);
170170

171171
// We need to set the working directory to `src/tools/rustc-perf`, so that it can find the directory
172172
// with compile-time benchmarks.

src/bootstrap/src/core/build_steps/test.rs

+11-7
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ impl Step for Cargotest {
263263

264264
let _time = helpers::timeit(builder);
265265
let mut cmd = builder.tool_cmd(Tool::CargoTest);
266-
cmd.arg(&cargo)
266+
cmd.arg(&cargo.tool_path)
267267
.arg(&out_dir)
268268
.args(builder.config.test_args())
269269
.env("RUSTC", builder.rustc(compiler))
@@ -1718,7 +1718,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
17181718
// If we're using `--stage 0`, we should provide the bootstrap cargo.
17191719
builder.initial_cargo.clone()
17201720
} else {
1721-
builder.ensure(tool::Cargo { compiler, target: compiler.host })
1721+
builder.ensure(tool::Cargo { compiler, target: compiler.host }).tool_path
17221722
};
17231723

17241724
cmd.arg("--cargo-path").arg(cargo_path);
@@ -1739,9 +1739,10 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
17391739
// Use the beta compiler for jsondocck
17401740
let json_compiler = compiler.with_stage(0);
17411741
cmd.arg("--jsondocck-path")
1742-
.arg(builder.ensure(tool::JsonDocCk { compiler: json_compiler, target }));
1743-
cmd.arg("--jsondoclint-path")
1744-
.arg(builder.ensure(tool::JsonDocLint { compiler: json_compiler, target }));
1742+
.arg(builder.ensure(tool::JsonDocCk { compiler: json_compiler, target }).tool_path);
1743+
cmd.arg("--jsondoclint-path").arg(
1744+
builder.ensure(tool::JsonDocLint { compiler: json_compiler, target }).tool_path,
1745+
);
17451746
}
17461747

17471748
if matches!(mode, "coverage-map" | "coverage-run") {
@@ -2976,12 +2977,15 @@ impl Step for RemoteCopyLibs {
29762977

29772978
builder.info(&format!("REMOTE copy libs to emulator ({target})"));
29782979

2979-
let server = builder.ensure(tool::RemoteTestServer { compiler, target });
2980+
let remote_test_server = builder.ensure(tool::RemoteTestServer { compiler, target });
29802981

29812982
// Spawn the emulator and wait for it to come online
29822983
let tool = builder.tool_exe(Tool::RemoteTestClient);
29832984
let mut cmd = command(&tool);
2984-
cmd.arg("spawn-emulator").arg(target.triple).arg(&server).arg(builder.tempdir());
2985+
cmd.arg("spawn-emulator")
2986+
.arg(target.triple)
2987+
.arg(&remote_test_server.tool_path)
2988+
.arg(builder.tempdir());
29852989
if let Some(rootfs) = builder.qemu_rootfs(target) {
29862990
cmd.arg(rootfs);
29872991
}

0 commit comments

Comments
 (0)