Skip to content

Commit 847648b

Browse files
committed
Auto merge of #38731 - alexcrichton:supafast-cross-dist, r=brson
rustbuild: Quickly `dist` cross-host compilers This commit optimizes the compile time for creating tarballs of cross-host compilers and as a proof of concept adds two to the standard Travis matrix. Much of this commit is further refactoring and refining of the `step.rs` definitions along with the interpretation of `--target` and `--host` flags. This has gotten confusing enough that I've also added a small test suite to `src/bootstrap/step.rs` to ensure what we're doing works and doesn't regress. After this commit when you execute: ./x.py dist --host $MY_HOST --target $MY_HOST the build system will compile two compilers. The first is for the build platform and the second is for the host platform. This second compiler is then packaged up and placed into `build/dist` and is ready to go. With a fully cached LLVM and docker image I was able to create a cross-host compiler in around 20 minutes locally. Eventually we plan to add a whole litany of cross-host entries to the Travis matrix, but for now we're just adding a few before we eat up all the extra capacity. cc #38531
2 parents e06ce71 + 750aa85 commit 847648b

File tree

8 files changed

+484
-33
lines changed

8 files changed

+484
-33
lines changed

src/bootstrap/Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,22 @@ version = "0.0.0"
66
[lib]
77
name = "bootstrap"
88
path = "lib.rs"
9+
doctest = false
910

1011
[[bin]]
1112
name = "bootstrap"
1213
path = "bin/main.rs"
14+
test = false
1315

1416
[[bin]]
1517
name = "rustc"
1618
path = "bin/rustc.rs"
19+
test = false
1720

1821
[[bin]]
1922
name = "rustdoc"
2023
path = "bin/rustdoc.rs"
24+
test = false
2125

2226
[dependencies]
2327
build_helper = { path = "../build_helper" }

src/bootstrap/check.rs

+11
Original file line numberDiff line numberDiff line change
@@ -568,3 +568,14 @@ pub fn distcheck(build: &Build) {
568568
.arg("check")
569569
.current_dir(&dir));
570570
}
571+
572+
/// Test the build system itself
573+
pub fn bootstrap(build: &Build) {
574+
let mut cmd = Command::new(&build.cargo);
575+
cmd.arg("test")
576+
.current_dir(build.src.join("src/bootstrap"))
577+
.env("CARGO_TARGET_DIR", build.out.join("bootstrap"))
578+
.env("RUSTC", &build.rustc);
579+
cmd.arg("--").args(&build.flags.cmd.test_args());
580+
build.run(&mut cmd);
581+
}

src/bootstrap/dist.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -354,14 +354,9 @@ pub fn analysis(build: &Build, compiler: &Compiler, target: &str) {
354354
}
355355

356356
/// Creates the `rust-src` installer component and the plain source tarball
357-
pub fn rust_src(build: &Build, host: &str) {
357+
pub fn rust_src(build: &Build) {
358358
println!("Dist src");
359359

360-
if host != build.config.build {
361-
println!("\tskipping, not a build host");
362-
return
363-
}
364-
365360
let plain_name = format!("rustc-{}-src", package_vers(build));
366361
let name = format!("rust-src-{}", package_vers(build));
367362
let image = tmpdir(build).join(format!("{}-image", name));

src/bootstrap/doc.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ pub fn rustbook(build: &Build, target: &str, name: &str) {
5757
/// `STAMP` alongw ith providing the various header/footer HTML we've cutomized.
5858
///
5959
/// In the end, this is just a glorified wrapper around rustdoc!
60-
pub fn standalone(build: &Build, stage: u32, target: &str) {
61-
println!("Documenting stage{} standalone ({})", stage, target);
60+
pub fn standalone(build: &Build, target: &str) {
61+
println!("Documenting standalone ({})", target);
6262
let out = build.doc_out(target);
6363
t!(fs::create_dir_all(&out));
6464

65-
let compiler = Compiler::new(stage, &build.config.build);
65+
let compiler = Compiler::new(0, &build.config.build);
6666

6767
let favicon = build.src.join("src/doc/favicon.inc");
6868
let footer = build.src.join("src/doc/footer.inc");

0 commit comments

Comments
 (0)