Skip to content

Commit 469a219

Browse files
Rollup merge of #133215 - ehuss:fix-vendor-rustc-perf, r=kobzol
Fix missing submodule in `./x vendor` The `src/tools/rustc-perf` submodule is needed for vendoring because it is included in the vendor set. To test this: 1. Get a fresh clone of `rust-lang/rust` 2. `./x vendor`
2 parents ef433a3 + d8e8fc5 commit 469a219

File tree

2 files changed

+27
-22
lines changed

2 files changed

+27
-22
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,7 @@ impl Step for PlainSourceTarball {
10231023
let mut cmd = command(&builder.initial_cargo);
10241024
cmd.arg("vendor").arg("--versioned-dirs");
10251025

1026-
for p in default_paths_to_vendor(builder) {
1026+
for (p, _) in default_paths_to_vendor(builder) {
10271027
cmd.arg("--sync").arg(p);
10281028
}
10291029

src/bootstrap/src/core/build_steps/vendor.rs

+26-21
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,26 @@ use crate::core::build_steps::tool::SUBMODULES_FOR_RUSTBOOK;
44
use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
55
use crate::utils::exec::command;
66

7-
/// List of default paths used for vendoring for `x vendor` and dist tarballs.
8-
pub fn default_paths_to_vendor(builder: &Builder<'_>) -> Vec<PathBuf> {
9-
let mut paths = vec![];
10-
for p in [
11-
"src/tools/cargo/Cargo.toml",
12-
"src/tools/rust-analyzer/Cargo.toml",
13-
"compiler/rustc_codegen_cranelift/Cargo.toml",
14-
"compiler/rustc_codegen_gcc/Cargo.toml",
15-
"library/Cargo.toml",
16-
"src/bootstrap/Cargo.toml",
17-
"src/tools/rustbook/Cargo.toml",
18-
"src/tools/rustc-perf/Cargo.toml",
19-
"src/tools/opt-dist/Cargo.toml",
20-
] {
21-
paths.push(builder.src.join(p));
22-
}
23-
24-
paths
7+
/// Returns the cargo workspaces to vendor for `x vendor` and dist tarballs.
8+
///
9+
/// Returns a `Vec` of `(path_to_manifest, submodules_required)` where
10+
/// `path_to_manifest` is the cargo workspace, and `submodules_required` is
11+
/// the set of submodules that must be available.
12+
pub fn default_paths_to_vendor(builder: &Builder<'_>) -> Vec<(PathBuf, Vec<&'static str>)> {
13+
[
14+
("src/tools/cargo/Cargo.toml", vec!["src/tools/cargo"]),
15+
("src/tools/rust-analyzer/Cargo.toml", vec![]),
16+
("compiler/rustc_codegen_cranelift/Cargo.toml", vec![]),
17+
("compiler/rustc_codegen_gcc/Cargo.toml", vec![]),
18+
("library/Cargo.toml", vec![]),
19+
("src/bootstrap/Cargo.toml", vec![]),
20+
("src/tools/rustbook/Cargo.toml", SUBMODULES_FOR_RUSTBOOK.into()),
21+
("src/tools/rustc-perf/Cargo.toml", vec!["src/tools/rustc-perf"]),
22+
("src/tools/opt-dist/Cargo.toml", vec![]),
23+
]
24+
.into_iter()
25+
.map(|(path, submodules)| (builder.src.join(path), submodules))
26+
.collect()
2527
}
2628

2729
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
@@ -56,13 +58,16 @@ impl Step for Vendor {
5658
cmd.arg("--versioned-dirs");
5759
}
5860

61+
let to_vendor = default_paths_to_vendor(builder);
5962
// These submodules must be present for `x vendor` to work.
60-
for submodule in SUBMODULES_FOR_RUSTBOOK.iter().chain(["src/tools/cargo"].iter()) {
61-
builder.build.require_submodule(submodule, None);
63+
for (_, submodules) in &to_vendor {
64+
for submodule in submodules {
65+
builder.build.require_submodule(submodule, None);
66+
}
6267
}
6368

6469
// Sync these paths by default.
65-
for p in default_paths_to_vendor(builder) {
70+
for (p, _) in &to_vendor {
6671
cmd.arg("--sync").arg(p);
6772
}
6873

0 commit comments

Comments
 (0)