Skip to content

Commit dd68d0b

Browse files
committed
Vendor libtest's dependencies in the rust-src component
This is the Rust side of rust-lang/wg-cargo-std-aware#23
1 parent f7801d6 commit dd68d0b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/bootstrap/dist.rs

+19
Original file line numberDiff line numberDiff line change
@@ -1040,6 +1040,25 @@ impl Step for Src {
10401040
builder.copy(&builder.src.join(file), &dst_src.join(file));
10411041
}
10421042

1043+
// libtest includes std and everything else, so vendoring it
1044+
// creates exactly what's needed for `cargo -Zbuild-std` or any
1045+
// other analysis of the stdlib's source. Cargo also needs help
1046+
// finding the lock, so we copy it to libtest temporarily.
1047+
//
1048+
// Note that this requires std to only have one version of each
1049+
// crate. e.g. two versions of getopts won't be patchable.
1050+
let dst_libtest = dst_src.join("library/test");
1051+
let dst_vendor = dst_src.join("vendor");
1052+
let root_lock = dst_src.join("Cargo.lock");
1053+
let temp_lock = dst_libtest.join("Cargo.lock");
1054+
builder.copy(&root_lock, &temp_lock);
1055+
1056+
let mut cmd = Command::new(&builder.initial_cargo);
1057+
cmd.arg("vendor").arg(dst_vendor).current_dir(&dst_libtest);
1058+
builder.run(&mut cmd);
1059+
1060+
builder.remove(&temp_lock);
1061+
10431062
// Create source tarball in rust-installer format
10441063
let mut cmd = rust_installer(builder);
10451064
cmd.arg("generate")

0 commit comments

Comments
 (0)