diff options
| author | bit-aloo <sshourya17@gmail.com> | 2025-02-21 21:09:31 +0530 |
|---|---|---|
| committer | bit-aloo <sshourya17@gmail.com> | 2025-02-21 22:03:38 +0530 |
| commit | 12a0e2b4dd1e93d7f68c9bdaf4ada618c9cdfb38 (patch) | |
| tree | af078fa9121fe117947ba6fe774677633e0d38dd | |
| parent | 9f48dedc9763334a587c66558974635807a113ed (diff) | |
| download | rust-12a0e2b4dd1e93d7f68c9bdaf4ada618c9cdfb38.tar.gz rust-12a0e2b4dd1e93d7f68c9bdaf4ada618c9cdfb38.zip | |
bootstrap: add doc for vendor build step
| -rw-r--r-- | src/bootstrap/src/core/build_steps/vendor.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/bootstrap/src/core/build_steps/vendor.rs b/src/bootstrap/src/core/build_steps/vendor.rs index 410dbc04f03..984c70955d7 100644 --- a/src/bootstrap/src/core/build_steps/vendor.rs +++ b/src/bootstrap/src/core/build_steps/vendor.rs @@ -1,9 +1,14 @@ +//! Handles the vendoring process for the bootstrap system. +//! +//! This module ensures that all required Cargo dependencies are gathered +//! and stored in the `<src>/<VENDOR_DIR>` directory. use std::path::PathBuf; use crate::core::build_steps::tool::SUBMODULES_FOR_RUSTBOOK; use crate::core::builder::{Builder, RunConfig, ShouldRun, Step}; use crate::utils::exec::command; +/// The name of the directory where vendored dependencies are stored. pub const VENDOR_DIR: &str = "vendor"; /// Returns the cargo workspaces to vendor for `x vendor` and dist tarballs. @@ -29,11 +34,19 @@ pub fn default_paths_to_vendor(builder: &Builder<'_>) -> Vec<(PathBuf, Vec<&'sta .collect() } +/// Defines the vendoring step in the bootstrap process. +/// +/// This step executes `cargo vendor` to collect all dependencies +/// and store them in the `<src>/<VENDOR_DIR>` directory. #[derive(Debug, Clone, Hash, PartialEq, Eq)] pub(crate) struct Vendor { + /// Additional paths to synchronize during vendoring. pub(crate) sync_args: Vec<PathBuf>, + /// Determines whether vendored dependencies use versioned directories. pub(crate) versioned_dirs: bool, + /// The root directory of the source code. pub(crate) root_dir: PathBuf, + /// The target directory for storing vendored dependencies. pub(crate) output_dir: PathBuf, } @@ -55,6 +68,10 @@ impl Step for Vendor { }); } + /// Executes the vendoring process. + /// + /// This function runs `cargo vendor` and ensures all required submodules + /// are initialized before vendoring begins. fn run(self, builder: &Builder<'_>) -> Self::Output { builder.info(&format!("Vendoring sources to {:?}", self.root_dir)); @@ -94,6 +111,7 @@ impl Step for Vendor { } } +/// Stores the result of the vendoring step. #[derive(Debug, Clone)] pub(crate) struct VendorOutput { pub(crate) config: String, |
