8000 [rustbuild] Implement testing and refactor configuration by Mark-Simulacrum · Pull Request #48521 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content

[rustbuild] Implement testing and refactor configuration #48521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
1c55459
[VIC] Prevent bootstrap test from overwriting initial compile
Mark-Simulacrum Feb 11, 2018
e72b895
Remove ONLY_BUILD_TARGETS.
Mark-Simulacrum Feb 11, 2018
f61d354
Remove ONLY_BUILD.
Mark-Simulacrum Feb 11, 2018
3124b25
Refactor run_host_only to have the proper effect.
Mark-Simulacrum Feb 11, 2018
48923dd
[VIC] Remove --host and --target arguments to configure
Mark-Simulacrum Feb 11, 2018
9321fba
Refactor to improve readability.
Mark-Simulacrum Feb 11, 2018
3ae9c7a
Avoid only-hosts to change what is built.
Mark-Simulacrum Feb 11, 2018
db0d96d
Remove unused fields on Crate struct
Mark-Simulacrum Feb 14, 2018
9a8af65
[VIC] Fix cross-compiling rustdoc.
Mark-Simulacrum Feb 15, 2018
7f1426d
Print out the sysroot and libdir on verbose builds.
Mark-Simulacrum Feb 15, 2018
23109dc
Pull paths out of Subcommand enum
Mark-Simulacrum Feb 16, 2018
5cd0002
Move StepDescription::run to Builder::run_step_descriptions.
Mark-Simulacrum Feb 16, 2018
8000
67e6482
Deny warnings
Mark-Simulacrum Feb 16, 2018
ba7a588
Remove src from Build
Mark-Simulacrum Feb 16, 2018
b11dae6
Remove out from Build
Mark-Simulacrum Feb 17, 2018
ca2e204
Remove initial_rustc and initial_cargo from Build
Mark-Simulacrum Feb 17, 2018
7826a74
Remove local_rebuild from Build
Mark-Simulacrum Feb 17, 2018
ca059b9
Move is_sudo to Config
Mark-Simulacrum Feb 17, 2018
cb447a7
Remove hosts from Build
Mark-Simulacrum Feb 17, 2018
ff5117b
Remove targets from Build
Mark-Simulacrum Feb 17, 2018
13d97f3
Remove build from Build
Mark-Simulacrum Feb 17, 2018
9a695be
Remove verbosity from Build
Mark-Simulacrum Feb 17, 2018
f0185ec
Remove fail_fast from Build
Mark-Simulacrum Feb 17, 2018
9fe9348
Build is default-able
Mark-Simulacrum Feb 17, 2018
2b0ce18
Refactor default values for configuration into Default
Mark-Simulacrum Feb 18, 2018
ed4d1e0
Cleanup to config
Mark-Simulacrum Feb 18, 2018
aca2d80
Stop copying llvm configuration from Llvm struct
Mark-Simulacrum Feb 18, 2018
d4e7d53
Cleanup target creation
Mark-Simulacrum Feb 18, 2018
e276ba7
Stop copying install configuration from Install struct
Mark-Simulacrum Feb 18, 2018
a096036
Remove doc_tests from Build
Mark-Simulacrum Feb 18, 2018
483e099
Stop copying dist configuration from Dist struct
Mark-Simulacrum Feb 18, 2018
15a90fa
Stop copying rust configuration from Rust struct
Mark-Simulacrum Feb 19, 2018
2c3860e
Regroup Config
Mark-Simulacrum Feb 19, 2018
c492b71
Stop copying build configuration from Build struct
Mark-Simulacrum Feb 19, 2018
13a4184
Prepare initial_{cargo,rustc} for removal from Config
Mark-Simulacrum Feb 20, 2018
34d1be2
Cleanup hosts/targets handling
Mark-Simulacrum Feb 20, 2018
7ea1d36
Let bootstrap.py handle build triple configuration
Mark-Simulacrum Feb 20, 2018
ff40909
Simplify internment
Mark-Simulacrum Feb 21, 2018
db2187d
Use Intern::intern instead of intern_{string,str,path}
Mark-Simulacrum Feb 21, 2018
6d922e9
Permit ser/deserializing Interned values
Mark-Simulacrum Feb 21, 2018
423aae7
Cleanup Interned impls to remove 'static bounds
Mark-Simulacrum Feb 21, 2018
6a22f0b
Implement PartialOrd, Ord for Interned
Mark-Simulacrum Feb 21, 2018
4f2a860
Refactor {build,host,target} loading
Mark-Simulacrum Feb 21, 2018
3744f53
Refactor initial_{rustc,cargo} defaults into Build::default
Mark-Simulacrum Feb 21, 2018
75ee753
Create Config directly instead of through Default
Mark-Simulacrum Feb 21, 2018
5147b1e
Remove Default impls for Config and Build
Mark-Simulacrum Feb 21, 2018
c310e4d
Polish config loading
Mark-Simulacrum Feb 22, 2018
d2c266a
Set stage default of 2
Mark-Simulacrum Feb 22, 2018
8ae4f7d
Remove out from Config
Mark-Simulacrum Feb 23, 2018
14b227b
Remove initial_{cargo,rustc} from Config
Mark-Simulacrum Feb 23, 2018
d76bf80
Remove hosts, targets from Config
Mark-Simulacrum Feb 23, 2018
de8ee0d
Remove build from Config
Mark-Simulacrum Feb 23, 2018
7385641
Format via rustfmt
Mark-Simulacrum Feb 23, 2018
16d5fe3
Exclusively utilize Builder in methods
Mark-Simulacrum Feb 23, 2018
7503faa
Clear out build directories from Builder::cargo
Mark-Simulacrum Feb 24, 2018
8e6593b
Call {std,test,rustc}_cargo in Builder::cargo
Mark-Simulacrum Feb 24, 2018
20ded30
[VIC] Move codegen backend mangling to copy step
Mark-Simulacrum Feb 24, 2018
98ce89f
Move run_cargo to Builder
Mark-Simulacrum Feb 24, 2018
2bdbb32
Refactor to prevent passing stamp to run_cargo
Mark-Simulacrum Feb 24, 2018
c2a46fc
Move some of prepare_tool_cargo to Builder
Mark-Simulacrum Feb 24, 2018
a68a8e5
[VIC] Add TestTool and RustcTool modes
Mark-Simulacrum Feb 24, 2018
699689b
[VIC] Build rustc libraries for compiler host for RustcTool
Mark-Simulacrum Feb 24, 2018
a1c22f6
Make cargo invocation start with subcommand
Mark-Simulacrum Feb 24, 2018
b33594a
[VIC] Add tests to Rustbuild
Mark-Simulacrum Feb 25, 2018
2fe3ede
Test extended builds
Mark-Simulacrum Feb 25, 2018
1f43cfa
Use fs::{read,read_string,write} instead of File
Mark-Simulacrum Feb 25, 2018
36849ec
Permit specifying build.build in config.toml
Mark-Simulacrum Feb 25, 2018
022ce70
Write dist-src configure to dist.src-tarball
Mark-Simulacrum Feb 25, 2018
3831685
Add more asserts to test cases
Mark-Simulacrum Feb 25, 2018
a174d0e
Fix tidy
Mark-Simulacrum Feb 25, 2018
d7e8200
Clean up Config::libdir_relative
Mark-Simulacrum Feb 25, 2018
b82a798
Fix compilation error
Mark-Simulacrum Feb 25, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove build from Build
  • Loading branch information
Mark-Simulacrum committed Feb 25, 2018
commit 13d97f3f12dbe57eb8d157dd8bdbc27a82b9decb
4 changes: 2 additions & 2 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ impl<'a> Builder<'a> {
let compiler = self.compiler(self.top_stage, host);
cmd.env("RUSTC_STAGE", compiler.stage.to_string())
.env("RUSTC_SYSROOT", self.sysroot(compiler))
.env("RUSTDOC_LIBDIR", self.sysroot_libdir(compiler, self.build.build))
.env("RUSTDOC_LIBDIR", self.sysroot_libdir(compiler, self.build.config.build))
.env("CFG_RELEASE_CHANNEL", &self.build.config.channel)
.env("RUSTDOC_REAL", self.rustdoc(host))
.env("RUSTDOC_CRATE_VERSION", self.build.rust_version())
Expand Down Expand Up @@ -589,7 +589,7 @@ impl<'a> Builder<'a> {
cargo.env("RUSTC_ERROR_FORMAT", error_format);
}
if cmd != "build" && cmd != "check" {
cargo.env("RUSTDOC_LIBDIR", self.rustc_libdir(self.compiler(2, self.build.build)));
cargo.env("RUSTDOC_LIBDIR", self.rustc_libdir(self.compiler(2, self.build.config.build)));
}

if mode != Mode::Tool {
Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl Step for Std {
fn run(self, builder: &Builder) {
let build = builder.build;
let target = self.target;
let compiler = builder.compiler(0, build.build);
let compiler = builder.compiler(0, build.config.build);

let _folder = build.fold_output(|| format!("stage{}-std", compiler.stage));
println!("Checking std artifacts ({} -> {})", &compiler.host, target);
Expand Down Expand Up @@ -83,7 +83,7 @@ impl Step for Rustc {
/// created will also be linked into the sysroot directory.
fn run(self, builder: &Builder) {
let build = builder.build;
let compiler = builder.compiler(0, build.build);
let compiler = builder.compiler(0, build.config.build);
let target = self.target;

let _folder = build.fold_output(|| format!("stage{}-rustc", compiler.stage));
Expand Down Expand Up @@ -126,7 +126,7 @@ impl Step for Test {
fn run(self, builder: &Builder) {
let build = builder.build;
let target = self.target;
let compiler = builder.compiler(0, build.build);
let compiler = builder.compiler(0, build.config.build);

let _folder = build.fold_output(|| format!("stage{}-test", compiler.stage));
println!("Checking test artifacts ({} -> {})", &compiler.host, target);
Expand Down
30 changes: 15 additions & 15 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl Step for Std {
builder.ensure(StartupObjects { compiler, target });

if build.force_use_stage1(compiler, target) {
let from = builder.compiler(1, build.build);
let from = builder.compiler(1, build.config.build);
builder.ensure(Std {
compiler: from,
target,
Expand Down Expand Up @@ -112,7 +112,7 @@ impl Step for Std {
false);

builder.ensure(StdLink {
compiler: builder.compiler(compiler.stage, build.build),
compiler: builder.compiler(compiler.stage, build.config.build),
target_compiler: compiler,
target,
});
Expand Down Expand Up @@ -344,12 +344,12 @@ impl Step for Test {

if build.force_use_stage1(compiler, target) {
builder.ensure(Test {
compiler: builder.compiler(1, build.build),
compiler: builder.compiler(1, build.config.build),
target,
});
println!("Uplifting stage1 test ({} -> {})", &build.build, target);
println!("Uplifting stage1 test ({} -> {})", &build.config.build, target);
builder.ensure(TestLink {
compiler: builder.compiler(1, build.build),
compiler: builder.compiler(1, build.config.build),
target_compiler: compiler,
target,
});
Expand All @@ -369,7 +369,7 @@ impl Step for Test {
false);

builder.ensure(TestLink {
compiler: builder.compiler(compiler.stage, build.build),
compiler: builder.compiler(compiler.stage, build.config.build),
target_compiler: compiler,
target,
});
Expand Down Expand Up @@ -460,12 +460,12 @@ impl Step for Rustc {

if build.force_use_stage1(compiler, target) {
builder.ensure(Rustc {
compiler: builder.compiler(1, build.build),
compiler: builder.compiler(1, build.config.build),
target,
});
println!("Uplifting stage1 rustc ({} -> {})", &build.build, target);
println!("Uplifting stage1 rustc ({} -> {})", &build.config.build, target);
builder.ensure(RustcLink {
compiler: builder.compiler(1, build.build),
compiler: builder.compiler(1, build.config.build),
target_compiler: compiler,
target,
});
Expand All @@ -474,8 +474,8 @@ impl Step for Rustc {

// Ensure that build scripts have a std to link against.
builder.ensure(Std {
compiler: builder.compiler(self.compiler.stage, build.build),
target: build.build,
compiler: builder.compiler(self.compiler.stage, build.config.build),
target: build.config.build,
});

let _folder = build.fold_output(|| format!("stage{}-rustc", compiler.stage));
Expand All @@ -494,7 +494,7 @@ impl Step for Rustc {
false);

builder.ensure(RustcLink {
compiler: builder.compiler(compiler.stage, build.build),
compiler: builder.compiler(compiler.stage, build.config.build),
target_compiler: compiler,
target,
});
Expand Down Expand Up @@ -616,7 +616,7 @@ impl Step for CodegenBackend {

if build.force_use_stage1(compiler, target) {
builder.ensure(CodegenBackend {
compiler: builder.compiler(1, build.build),
compiler: builder.compiler(1, build.config.build),
target,
backend: self.backend,
});
Expand Down Expand Up @@ -840,7 +840,7 @@ impl Step for Assemble {
let target_compiler = self.target_compiler;

if target_compiler.stage == 0 {
assert_eq!(build.build, target_compiler.host,
assert_eq!(build.config.build, target_compiler.host,
"Cannot obtain compiler for non-native build triple at stage 0");
// The stage 0 compiler for the build triple is always pre-built.
return target_compiler;
Expand All @@ -863,7 +863,7 @@ impl Step for Assemble {
// FIXME: It may be faster if we build just a stage 1 compiler and then
// use that to bootstrap this compiler forward.
let build_compiler =
builder.compiler(target_compiler.stage - 1, build.build);
builder.compiler(target_compiler.stage - 1, build.config.build);

// Build the libraries for this compiler to link to (i.e., the libraries
// it uses at runtime). NOTE: Crates the target compiler compiles don't
Expand Down
20 changes: 10 additions & 10 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl Step for Docs {

// As part of this step, *also* copy the docs directory to a directory which
// buildbot typically uploads.
if host == build.build {
if host == build.config.build {
let dst = distdir(build).join("doc").join(build.rust_package_vers());
t!(fs::create_dir_all(&dst));
cp_r(&src, &dst);
Expand Down Expand Up @@ -549,7 +549,7 @@ impl Step for Std {

fn make_run(run: RunConfig) {
run.builder.ensure(Std {
compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.build),
compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.config.build),
target: run.target,
});
}
Expand All @@ -564,7 +564,7 @@ impl Step for Std {

// The only true set of target libraries came from the build triple, so
// let's reduce redundant work by only producing archives from that host.
if compiler.host != build.build {
if compiler.host != build.config.build {
println!("\tskipping, not a build host");
return distdir(build).join(format!("{}-{}.tar.gz", name, target));
}
Expand Down Expand Up @@ -623,7 +623,7 @@ impl Step for Analysis {

fn make_run(run: RunConfig) {
run.builder.ensure(Analysis {
compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.build),
compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.config.build),
target: run.target,
});
}
Expand All @@ -637,7 +637,7 @@ impl Step for Analysis {
println!("Dist analysis");
let name = pkgname(build, "rust-analysis");

if &compiler.host != build.build {
if &compiler.host != build.config.build {
println!("\tskipping, not a build host");
return distdir(build).join(format!("{}-{}.tar.gz", name, target));
}
Expand Down Expand Up @@ -1012,7 +1012,7 @@ impl Step for Cargo {
t!(fs::create_dir_all(image.join("share/zsh/site-functions")));
t!(fs::create_dir_all(image.join("etc/bash_completion.d")));
let cargo = builder.ensure(tool::Cargo {
compiler: builder.compiler(stage, build.build),
compiler: builder.compiler(stage, build.config.build),
target
});
install(&cargo, &image.join("bin"), 0o755);
Expand Down Expand Up @@ -1099,7 +1099,7 @@ impl Step for Rls {
// We expect RLS to build, because we've exited this step above if tool
// state for RLS isn't testing.
let rls = builder.ensure(tool::Rls {
compiler: builder.compiler(stage, build.build),
compiler: builder.compiler(stage, build.config.build),
target
}).or_else(|| { println!("Unable to build RLS, skipping dist"); None })?;

Expand Down Expand Up @@ -1178,11 +1178,11 @@ impl Step for Rustfmt {

// Prepare the image directory
let rustfmt = builder.ensure(tool::Rustfmt {
compiler: builder.compiler(stage, build.build),
compiler: builder.compiler(stage, build.config.build),
target
}).or_else(|| { println!("Unable to build Rustfmt, skipping dist"); None })?;
let cargofmt = builder.ensure(tool::Cargofmt {
compiler: builder.compiler(stage, build.build),
compiler: builder.compiler(stage, build.config.build),
target
}).or_else(|| { println!("Unable to build Cargofmt, skipping dist"); None })?;

Expand Down Expand Up @@ -1241,7 +1241,7 @@ impl Step for Extended {
fn make_run(run: RunConfig) {
run.builder.ensure(Extended {
stage: run.builder.top_stage,
host: run.builder.build.build,
host: run.builder.build.config.build,
target: run.host,
});
}
Expand Down
14 changes: 7 additions & 7 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ impl Step for TheBook {

fn make_run(run: RunConfig) {
run.builder.ensure(TheBook {
compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.build),
compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.config.build),
target: run.target,
name: "book",
});
Expand Down Expand Up @@ -339,7 +339,7 @@ impl Step for Standalone {

fn make_run(run: RunConfig) {
run.builder.ensure(Standalone {
compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.build),
compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.config.build),
target: run.target,
});
}
Expand Down Expand Up @@ -450,7 +450,7 @@ impl Step for Std {
println!("Documenting stage{} std ({})", stage, target);
let out = build.doc_out(target);
t!(fs::create_dir_all(&out));
let compiler = builder.compiler(stage, build.build);
let compiler = builder.compiler(stage, build.config.build);
let rustdoc = builder.rustdoc(compiler.host);
let compiler = if build.force_use_stage1(compiler, target) {
builder.compiler(1, compiler.host)
Expand Down Expand Up @@ -535,7 +535,7 @@ impl Step for Test {
println!("Documenting stage{} test ({})", stage, target);
let out = build.doc_out(target);
t!(fs::create_dir_all(&out));
let compiler = builder.compiler(stage, build.build);
let compiler = builder.compiler(stage, build.config.build);
let rustdoc = builder.rustdoc(compiler.host);
let compiler = if build.force_use_stage1(compiler, target) {
builder.compiler(1, compiler.host)
Expand Down Expand Up @@ -596,7 +596,7 @@ impl Step for Rustc {
println!("Documenting stage{} compiler ({})", stage, target);
let out = build.doc_out(target);
t!(fs::create_dir_all(&out));
let compiler = builder.compiler(stage, build.build);
let compiler = builder.compiler(stage, build.config.build);
let rustdoc = builder.rustdoc(compiler.host);
let compiler = if build.force_use_stage1(compiler, target) {
builder.compiler(1, compiler.host)
Expand Down Expand Up @@ -672,7 +672,7 @@ impl Step for ErrorIndex {
index.arg(out.join("error-index.html"));

// FIXME: shouldn't have to pass this env var
index.env("CFG_BUILD", &build.build)
index.env("CFG_BUILD", &build.config.build)
.env("RUSTC_ERROR_METADATA_DST", build.extended_error_dir());

build.run(&mut index);
Expand Down Expand Up @@ -705,7 +705,7 @@ impl Step for UnstableBookGen {
let target = self.target;

builder.ensure(compile::Std {
compiler: builder.compiler(builder.top_stage, build.build),
compiler: builder.compiler(builder.top_stage, build.config.build),
target,
});

Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/install.rs
1CF5
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ macro_rules! install {
run.builder.ensure($name {
stage: run.builder.top_stage,
target: run.target,
host: run.builder.build.build,
host: run.builder.build.config.build,
});
}

Expand Down Expand Up @@ -226,7 +226,7 @@ install!((self, builder, _config),
install_analysis(builder, self.stage, self.target);
};
Src, "src", Self::should_build(_config) , only_hosts: true, {
if self.target == builder.build.build {
if self.target == builder.build.config.build {
builder.ensure(dist::Src);
install_src(builder, self.stage);
}
Expand Down
11 changes: 3 additions & 8 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,6 @@ pub struct Build {
doc_tests: bool,
verbosity: usize,

// Targets for which to build.
build: Interned<String>,

// Probed tools at runtime
lldb_version: Option<String>,
lldb_python_dir: Option<String>,
Expand Down Expand Up @@ -300,8 +297,6 @@ impl Build {
doc_tests: config.cmd.doc_tests(),
verbosity: config.verbose,

build: config.build,

config,

rust_info,
Expand All @@ -322,7 +317,7 @@ impl Build {

pub fn build_triple(&self) -> &[Interned<String>] {
unsafe {
slice::from_raw_parts(&self.build, 1)
slice::from_raw_parts(&self.config.build, 1)
}
}

Expand Down Expand Up @@ -714,7 +709,7 @@ impl Build {
fn force_use_stage1(&self, compiler: Compiler, target: Interned<String>) -> bool {
!self.config.full_bootstrap &&
compiler.stage >= 2 &&
(self.config.hosts.iter().any(|h| *h == target) || target == self.build)
(self.config.hosts.iter().any(|h| *h == target) || target == self.config.build)
}

/// Returns the directory that OpenSSL artifacts are compiled into if
Expand Down Expand Up @@ -944,7 +939,7 @@ impl<'a> Compiler {

/// Returns whether this is a snapshot compiler for `build`'s configuration
pub fn is_snapshot(&self, build: &Build) -> bool {
self.stage == 0 && self.host == build.build
self.stage == 0 && self.host == build.config.build
}

/// Returns if this compiler should be treated as a final stage one in the
Expand Down
Loading
0