1
+ //! Handles the vendoring process for the bootstrap system.
2
+ //!
3
+ //! This module ensures that all required Cargo dependencies are gathered
4
+ //! and stored in the `<src>/<VENDOR_DIR>` directory.
1
5
use std::path::PathBuf;
2
6
3
7
use crate::core::build_steps::tool::SUBMODULES_FOR_RUSTBOOK;
4
8
use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
5
9
use crate::utils::exec::command;
6
10
11
+ /// The name of the directory where vendored dependencies are stored.
7
12
pub const VENDOR_DIR: &str = "vendor";
8
13
9
14
/// 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
29
34
.collect()
30
35
}
31
36
37
+ /// Defines the vendoring step in the bootstrap process.
38
+ ///
39
+ /// This step executes `cargo vendor` to collect all dependencies
40
+ /// and store them in the `<src>/<VENDOR_DIR>` directory.
32
41
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
33
42
pub(crate) struct Vendor {
43
+ /// Additional paths to synchronize during vendoring.
34
44
pub(crate) sync_args: Vec<PathBuf>,
45
+ /// Determines whether vendored dependencies use versioned directories.
35
46
pub(crate) versioned_dirs: bool,
47
+ /// The root directory of the source code.
36
48
pub(crate) root_dir: PathBuf,
49
+ /// The target directory for storing vendored dependencies.
37
50
pub(crate) output_dir: PathBuf,
38
51
}
39
52
@@ -55,6 +68,10 @@ impl Step for Vendor {
55
68
});
56
69
}
57
70
71
+ /// Executes the vendoring process.
72
+ ///
73
+ /// This function runs `cargo vendor` and ensures all required submodules
74
+ /// are initialized before vendoring begins.
58
75
fn run(self, builder: &Builder<'_>) -> Self::Output {
59
76
builder.info(&format!("Vendoring sources to {:?}", self.root_dir));
60
77
@@ -94,6 +111,7 @@ impl Step for Vendor {
94
111
}
95
112
}
96
113
114
+ /// Stores the result of the vendoring step.
97
115
#[derive(Debug, Clone)]
98
116
pub(crate) struct VendorOutput {
99
117
pub(crate) config: String,
0 commit comments