Skip to content

Commit 92f31b9

Browse files
committedFeb 17, 2025··
use the shared vendor impl for plan source tarballs
1 parent 33e7f9b commit 92f31b9

File tree

2 files changed

+17
-21
lines changed

2 files changed

+17
-21
lines changed
 

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

+9-19
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use object::read::archive::ArchiveFile;
1919

2020
use crate::core::build_steps::doc::DocumentationFormat;
2121
use crate::core::build_steps::tool::{self, Tool};
22-
use crate::core::build_steps::vendor::default_paths_to_vendor;
22+
use crate::core::build_steps::vendor::{VENDOR_DIR, Vendor};
2323
use crate::core::build_steps::{compile, llvm};
2424
use crate::core::builder::{Builder, Kind, RunConfig, ShouldRun, Step};
2525
use crate::core::config::TargetSelection;
@@ -1050,19 +1050,6 @@ impl Step for PlainSourceTarball {
10501050
if builder.config.dist_vendor {
10511051
builder.require_and_update_all_submodules();
10521052

1053-
// Vendor all Cargo dependencies
1054-
let mut cmd = command(&builder.initial_cargo);
1055-
cmd.arg("vendor").arg("--versioned-dirs");
1056-
1057-
for (p, _) in default_paths_to_vendor(builder) {
1058-
cmd.arg("--sync").arg(p);
1059-
}
1060-
1061-
cmd
1062-
// Will read the libstd Cargo.toml which uses the unstable `public-dependency` feature.
1063-
.env("RUSTC_BOOTSTRAP", "1")
1064-
.current_dir(plain_dst_src);
1065-
10661053
// Vendor packages that are required by opt-dist to collect PGO profiles.
10671054
let pkgs_for_pgo_training = build_helper::LLVM_PGO_CRATES
10681055
.iter()
@@ -1074,15 +1061,18 @@ impl Step for PlainSourceTarball {
10741061
manifest_path.push("Cargo.toml");
10751062
manifest_path
10761063
});
1077-
for manifest_path in pkgs_for_pgo_training {
1078-
cmd.arg("--sync").arg(manifest_path);
1079-
}
10801064

1081-
let config = cmd.run_capture(builder).stdout();
1065+
// Vendor all Cargo dependencies
1066+
let vendor = builder.ensure(Vendor {
1067+
sync_args: pkgs_for_pgo_training.collect(),
1068+
versioned_dirs: true,
1069+
root_dir: plain_dst_src.into(),
1070+
output_dir: VENDOR_DIR.into(),
1071+
});
10821072

10831073
let cargo_config_dir = plain_dst_src.join(".cargo");
10841074
builder.create_dir(&cargo_config_dir);
1085-
builder.create(&cargo_config_dir.join("config.toml"), &config);
1075+
builder.create(&cargo_config_dir.join("config.toml"), &vendor.config);
10861076
}
10871077

10881078
// Delete extraneous directories

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

+8-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub(crate) struct Vendor {
3838
}
3939

4040
impl Step for Vendor {
41-
type Output = ();
41+
type Output = VendorOutput;
4242
const DEFAULT: bool = true;
4343
const ONLY_HOSTS: bool = true;
4444

@@ -89,6 +89,12 @@ impl Step for Vendor {
8989

9090
cmd.current_dir(self.root_dir).arg(&self.output_dir);
9191

92-
cmd.run(builder);
92+
let config = cmd.run_capture_stdout(builder);
93+
VendorOutput { config: config.stdout() }
9394
}
9495
}
96+
97+
#[derive(Debug, Clone)]
98+
pub(crate) struct VendorOutput {
99+
pub(crate) config: String,
100+
}

0 commit comments

Comments
 (0)
Please sign in to comment.