Skip to content

Commit

Permalink
Vendor libtest's dependencies in the rust-src component
Browse files Browse the repository at this point in the history
This is the Rust side of rust-lang/wg-cargo-std-aware#23
  • Loading branch information
Gankra committed Nov 5, 2020
1 parent f7801d6 commit dd68d0b
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 dd68d0b

Please sign in to comment.