Rollup merge of #124429 - Enselic:document-builder, r=Mark-Simulacrum

bootstrap: Document `struct Builder` and its fields

I'm exploring the code of bootstrap and had a bit of a hard time understanding exactly what `Builder` is for at first. I decided to help document it and its field to help future explorers.
This commit is contained in:
Matthias Krüger 2024-04-28 01:25:01 +02:00 committed by GitHub
commit 088753cb9a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 0 deletions

View file

@ -35,13 +35,34 @@
#[cfg(test)]
mod tests;
/// Builds and performs different [`Self::kind`]s of stuff and actions, taking
/// into account build configuration from e.g. config.toml.
pub struct Builder<'a> {
/// Build configuration from e.g. config.toml.
pub build: &'a Build,
/// The stage to use. Either implicitly determined based on subcommand, or
/// explicitly specified with `--stage N`. Normally this is the stage we
/// use, but sometimes we want to run steps with a lower stage than this.
pub top_stage: u32,
/// What to build or what action to perform.
pub kind: Kind,
/// A cache of outputs of [`Step`]s so we can avoid running steps we already
/// ran.
cache: Cache,
/// A stack of [`Step`]s to run before we can run this builder. The output
/// of steps is cached in [`Self::cache`].
stack: RefCell<Vec<Box<dyn Any>>>,
/// The total amount of time we spent running [`Step`]s in [`Self::stack`].
time_spent_on_dependencies: Cell<Duration>,
/// The paths passed on the command line. Used by steps to figure out what
/// to do. For example: with `./x check foo bar` we get `paths=["foo",
/// "bar"]`.
pub paths: Vec<PathBuf>,
}

View file

@ -345,6 +345,8 @@ pub struct Config {
#[cfg(test)]
pub initial_rustfmt: RefCell<RustfmtState>,
/// The paths to work with. For example: with `./x check foo bar` we get
/// `paths=["foo", "bar"]`.
pub paths: Vec<PathBuf>,
}