Skip to content

Commit 5e5b1b0

Browse files
committed
document tool implementations
Signed-off-by: onur-ozkan <[email protected]>
1 parent 6cf650f commit 5e5b1b0

File tree

1 file changed

+18
-0
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+18
-0
lines changed

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

+18
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
//! This module handles building and managing various tools in bootstrap
2+
//! build system.
3+
//!
4+
//! **What It Does**
5+
//! - Defines how tools are built, configured and installed.
6+
//! - Manages tool dependencies and build steps.
7+
//! - Copies built tool binaries to the correct locations.
8+
//!
9+
//! Each Rust tool **MUST** utilize `ToolBuild` inside their `Step` logic,
10+
//! return `ToolBuildResult` and should never prepare `cargo` invocations manually.
11+
112
use std::path::PathBuf;
213
use std::{env, fs};
314

@@ -64,10 +75,16 @@ impl Builder<'_> {
6475
}
6576
}
6677

78+
/// Result of the tool build process. Each `Step` in this module is responsible
79+
/// for using this type as `type Output = ToolBuildResult;`
6780
#[derive(Clone)]
6881
pub struct ToolBuildResult {
82+
/// Executable path of the corresponding tool that was built.
6983
pub tool_path: PathBuf,
84+
/// Compiler used to build the tool. For non-`ToolRustc` tools this is equal to `target_compiler`.
85+
/// For `ToolRustc` this is one stage before of the `target_compiler`.
7086
pub build_compiler: Compiler,
87+
/// Target compiler passed to `Step`.
7188
pub target_compiler: Compiler,
7289
}
7390

@@ -274,6 +291,7 @@ pub fn prepare_tool_cargo(
274291
cargo
275292
}
276293

294+
/// Handle stage-off logic for `ToolRustc` tools when necessary.
277295
pub(crate) fn get_tool_rustc_compiler(
278296
builder: &Builder<'_>,
279297
target_compiler: Compiler,

0 commit comments

Comments
 (0)