Skip to content

Commit

Permalink
Rollup merge of rust-lang#78790 - Gankra:rust-src-vendor, r=Mark-Simu…
Browse files Browse the repository at this point in the history
…lacrum

Vendor libtest's dependencies in the rust-src component

This is the Rust side of rust-lang/wg-cargo-std-aware#23

Note that this won't produce a useful result for `cargo -Zbuild-std` if there are multiple versions of a crate vendored, but will otherwise produce a valid vendor dir.

See rust-lang/cargo#8834 for the other half of this change.
  • Loading branch information
Dylan-DPC authored Nov 8, 2020
2 parents 1a949e7 + dd68d0b commit 38bfdae
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,25 @@ impl Step for Src {
builder.copy(&builder.src.join(file), &dst_src.join(file));
}

// libtest includes std and everything else, so vendoring it
// creates exactly what's needed for `cargo -Zbuild-std` or any
// other analysis of the stdlib's source. Cargo also needs help
// finding the lock, so we copy it to libtest temporarily.
//
// Note that this requires std to only have one version of each
// crate. e.g. two versions of getopts won't be patchable.
let dst_libtest = dst_src.join("library/test");
let dst_vendor = dst_src.join("vendor");
let root_lock = dst_src.join("Cargo.lock");
let temp_lock = dst_libtest.join("Cargo.lock");
builder.copy(&root_lock, &temp_lock);

let mut cmd = Command::new(&builder.initial_cargo);
cmd.arg("vendor").arg(dst_vendor).current_dir(&dst_libtest);
builder.run(&mut cmd);

builder.remove(&temp_lock);

// Create source tarball in rust-installer format
let mut cmd = rust_installer(builder);
cmd.arg("generate")
Expand Down

0 comments on commit 38bfdae

Please sign in to comment.