mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
Remove uses of Build across Builder steps
This commit is contained in:
parent
9a59133c09
commit
be1e7893d5
@ -154,18 +154,17 @@ impl StepDescription {
|
||||
eprintln!("{:?} not skipped for {:?} -- not in {:?}", pathset,
|
||||
self.name, builder.config.exclude);
|
||||
}
|
||||
let build = builder.build;
|
||||
let hosts = &build.hosts;
|
||||
let hosts = &builder.hosts;
|
||||
|
||||
// Determine the targets participating in this rule.
|
||||
let targets = if self.only_hosts {
|
||||
if !build.config.run_host_only {
|
||||
if !builder.config.run_host_only {
|
||||
return; // don't run anything
|
||||
} else {
|
||||
&build.hosts
|
||||
&builder.hosts
|
||||
}
|
||||
} else {
|
||||
&build.targets
|
||||
&builder.targets
|
||||
};
|
||||
|
||||
for host in hosts {
|
||||
@ -476,7 +475,7 @@ impl<'a> Builder<'a> {
|
||||
|
||||
pub fn sysroot_codegen_backends(&self, compiler: Compiler) -> PathBuf {
|
||||
self.sysroot_libdir(compiler, compiler.host)
|
||||
.with_file_name(self.build.config.rust_codegen_backends_dir.clone())
|
||||
.with_file_name(self.config.rust_codegen_backends_dir.clone())
|
||||
}
|
||||
|
||||
/// Returns the compiler's libdir where it stores the dynamic libraries that
|
||||
@ -486,7 +485,7 @@ impl<'a> Builder<'a> {
|
||||
/// Windows.
|
||||
pub fn rustc_libdir(&self, compiler: Compiler) -> PathBuf {
|
||||
if compiler.is_snapshot(self) {
|
||||
self.build.rustc_snapshot_libdir()
|
||||
self.rustc_snapshot_libdir()
|
||||
} else {
|
||||
self.sysroot(compiler).join(libdir(&compiler.host))
|
||||
}
|
||||
@ -523,12 +522,12 @@ 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("CFG_RELEASE_CHANNEL", &self.build.config.channel)
|
||||
.env("RUSTDOC_LIBDIR", self.sysroot_libdir(compiler, self.config.build))
|
||||
.env("CFG_RELEASE_CHANNEL", &self.config.channel)
|
||||
.env("RUSTDOC_REAL", self.rustdoc(host))
|
||||
.env("RUSTDOC_CRATE_VERSION", self.build.rust_version())
|
||||
.env("RUSTDOC_CRATE_VERSION", self.rust_version())
|
||||
.env("RUSTC_BOOTSTRAP", "1");
|
||||
if let Some(linker) = self.build.linker(host) {
|
||||
if let Some(linker) = self.linker(host) {
|
||||
cmd.env("RUSTC_TARGET_LINKER", linker);
|
||||
}
|
||||
cmd
|
||||
@ -609,17 +608,17 @@ impl<'a> Builder<'a> {
|
||||
.env("TEST_MIRI", self.config.test_miri.to_string())
|
||||
.env("RUSTC_ERROR_METADATA_DST", self.extended_error_dir());
|
||||
|
||||
if let Some(host_linker) = self.build.linker(compiler.host) {
|
||||
if let Some(host_linker) = self.linker(compiler.host) {
|
||||
cargo.env("RUSTC_HOST_LINKER", host_linker);
|
||||
}
|
||||
if let Some(target_linker) = self.build.linker(target) {
|
||||
if let Some(target_linker) = self.linker(target) {
|
||||
cargo.env("RUSTC_TARGET_LINKER", target_linker);
|
||||
}
|
||||
if let Some(ref error_format) = self.config.rustc_error_format {
|
||||
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.config.build)));
|
||||
}
|
||||
|
||||
if mode == Mode::Tool {
|
||||
@ -677,7 +676,7 @@ impl<'a> Builder<'a> {
|
||||
//
|
||||
// If LLVM support is disabled we need to use the snapshot compiler to compile
|
||||
// build scripts, as the new compiler doesn't support executables.
|
||||
if mode == Mode::Libstd || !self.build.config.llvm_enabled {
|
||||
if mode == Mode::Libstd || !self.config.llvm_enabled {
|
||||
cargo.env("RUSTC_SNAPSHOT", &self.initial_rustc)
|
||||
.env("RUSTC_SNAPSHOT_LIBDIR", self.rustc_snapshot_libdir());
|
||||
} else {
|
||||
@ -761,7 +760,7 @@ impl<'a> Builder<'a> {
|
||||
}
|
||||
|
||||
// For `cargo doc` invocations, make rustdoc print the Rust version into the docs
|
||||
cargo.env("RUSTDOC_CRATE_VERSION", self.build.rust_version());
|
||||
cargo.env("RUSTDOC_CRATE_VERSION", self.rust_version());
|
||||
|
||||
// Environment variables *required* throughout the build
|
||||
//
|
||||
@ -769,7 +768,7 @@ impl<'a> Builder<'a> {
|
||||
cargo.env("CFG_COMPILER_HOST_TRIPLE", target);
|
||||
|
||||
// Set this for all builds to make sure doc builds also get it.
|
||||
cargo.env("CFG_RELEASE_CHANNEL", &self.build.config.channel);
|
||||
cargo.env("CFG_RELEASE_CHANNEL", &self.config.channel);
|
||||
|
||||
// This one's a bit tricky. As of the time of this writing the compiler
|
||||
// links to the `winapi` crate on crates.io. This crate provides raw
|
||||
@ -854,7 +853,7 @@ impl<'a> Builder<'a> {
|
||||
panic!(out);
|
||||
}
|
||||
if let Some(out) = self.cache.get(&step) {
|
||||
self.build.verbose(&format!("{}c {:?}", " ".repeat(stack.len()), step));
|
||||
self.verbose(&format!("{}c {:?}", " ".repeat(stack.len()), step));
|
||||
|
||||
{
|
||||
let mut graph = self.graph.borrow_mut();
|
||||
@ -869,7 +868,7 @@ impl<'a> Builder<'a> {
|
||||
|
||||
return out;
|
||||
}
|
||||
self.build.verbose(&format!("{}> {:?}", " ".repeat(stack.len()), step));
|
||||
self.verbose(&format!("{}> {:?}", " ".repeat(stack.len()), step));
|
||||
stack.push(Box::new(step.clone()));
|
||||
}
|
||||
|
||||
@ -899,7 +898,7 @@ impl<'a> Builder<'a> {
|
||||
|
||||
self.parent.set(prev_parent);
|
||||
|
||||
if self.build.config.print_step_timings && dur > Duration::from_millis(100) {
|
||||
if self.config.print_step_timings && dur > Duration::from_millis(100) {
|
||||
println!("[TIMING] {:?} -- {}.{:03}",
|
||||
step,
|
||||
dur.as_secs(),
|
||||
@ -911,7 +910,7 @@ impl<'a> Builder<'a> {
|
||||
let cur_step = stack.pop().expect("step stack empty");
|
||||
assert_eq!(cur_step.downcast_ref(), Some(&step));
|
||||
}
|
||||
self.build.verbose(&format!("{}< {:?}", " ".repeat(self.stack.borrow().len()), step));
|
||||
self.verbose(&format!("{}< {:?}", " ".repeat(self.stack.borrow().len()), step));
|
||||
self.cache.put(step, out.clone());
|
||||
out
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
use compile::{run_cargo, std_cargo, test_cargo, rustc_cargo, add_to_sysroot};
|
||||
use builder::{RunConfig, Builder, ShouldRun, Step};
|
||||
use {Build, Compiler, Mode};
|
||||
use {Compiler, Mode};
|
||||
use cache::Interned;
|
||||
use std::path::PathBuf;
|
||||
|
||||
@ -36,24 +36,23 @@ 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, builder.config.build);
|
||||
|
||||
let out_dir = build.stage_out(compiler, Mode::Libstd);
|
||||
build.clear_if_dirty(&out_dir, &builder.rustc(compiler));
|
||||
let out_dir = builder.stage_out(compiler, Mode::Libstd);
|
||||
builder.clear_if_dirty(&out_dir, &builder.rustc(compiler));
|
||||
let mut cargo = builder.cargo(compiler, Mode::Libstd, target, "check");
|
||||
std_cargo(builder, &compiler, target, &mut cargo);
|
||||
|
||||
let _folder = build.fold_output(|| format!("stage{}-std", compiler.stage));
|
||||
let _folder = builder.fold_output(|| format!("stage{}-std", compiler.stage));
|
||||
println!("Checking std artifacts ({} -> {})", &compiler.host, target);
|
||||
run_cargo(build,
|
||||
run_cargo(builder,
|
||||
&mut cargo,
|
||||
&libstd_stamp(build, compiler, target),
|
||||
&libstd_stamp(builder, compiler, target),
|
||||
true);
|
||||
|
||||
let libdir = builder.sysroot_libdir(compiler, target);
|
||||
add_to_sysroot(&build, &libdir, &libstd_stamp(build, compiler, target));
|
||||
add_to_sysroot(&builder, &libdir, &libstd_stamp(builder, compiler, target));
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,26 +82,25 @@ impl Step for Rustc {
|
||||
/// the `compiler` targeting the `target` architecture. The artifacts
|
||||
/// 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, builder.config.build);
|
||||
let target = self.target;
|
||||
|
||||
let stage_out = builder.stage_out(compiler, Mode::Librustc);
|
||||
build.clear_if_dirty(&stage_out, &libstd_stamp(build, compiler, target));
|
||||
build.clear_if_dirty(&stage_out, &libtest_stamp(build, compiler, target));
|
||||
builder.clear_if_dirty(&stage_out, &libstd_stamp(builder, compiler, target));
|
||||
builder.clear_if_dirty(&stage_out, &libtest_stamp(builder, compiler, target));
|
||||
|
||||
let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "check");
|
||||
rustc_cargo(build, &mut cargo);
|
||||
rustc_cargo(builder, &mut cargo);
|
||||
|
||||
let _folder = build.fold_output(|| format!("stage{}-rustc", compiler.stage));
|
||||
let _folder = builder.fold_output(|| format!("stage{}-rustc", compiler.stage));
|
||||
println!("Checking compiler artifacts ({} -> {})", &compiler.host, target);
|
||||
run_cargo(build,
|
||||
run_cargo(builder,
|
||||
&mut cargo,
|
||||
&librustc_stamp(build, compiler, target),
|
||||
&librustc_stamp(builder, compiler, target),
|
||||
true);
|
||||
|
||||
let libdir = builder.sysroot_libdir(compiler, target);
|
||||
add_to_sysroot(&build, &libdir, &librustc_stamp(build, compiler, target));
|
||||
add_to_sysroot(&builder, &libdir, &librustc_stamp(builder, compiler, target));
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,41 +124,40 @@ 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, builder.config.build);
|
||||
|
||||
let out_dir = build.stage_out(compiler, Mode::Libtest);
|
||||
build.clear_if_dirty(&out_dir, &libstd_stamp(build, compiler, target));
|
||||
let out_dir = builder.stage_out(compiler, Mode::Libtest);
|
||||
builder.clear_if_dirty(&out_dir, &libstd_stamp(builder, compiler, target));
|
||||
let mut cargo = builder.cargo(compiler, Mode::Libtest, target, "check");
|
||||
test_cargo(build, &compiler, target, &mut cargo);
|
||||
test_cargo(builder, &compiler, target, &mut cargo);
|
||||
|
||||
let _folder = build.fold_output(|| format!("stage{}-test", compiler.stage));
|
||||
let _folder = builder.fold_output(|| format!("stage{}-test", compiler.stage));
|
||||
println!("Checking test artifacts ({} -> {})", &compiler.host, target);
|
||||
run_cargo(build,
|
||||
run_cargo(builder,
|
||||
&mut cargo,
|
||||
&libtest_stamp(build, compiler, target),
|
||||
&libtest_stamp(builder, compiler, target),
|
||||
true);
|
||||
|
||||
let libdir = builder.sysroot_libdir(compiler, target);
|
||||
add_to_sysroot(&build, &libdir, &libtest_stamp(build, compiler, target));
|
||||
add_to_sysroot(builder, &libdir, &libtest_stamp(builder, compiler, target));
|
||||
}
|
||||
}
|
||||
|
||||
/// Cargo's output path for the standard library in a given stage, compiled
|
||||
/// by a particular compiler for the specified target.
|
||||
pub fn libstd_stamp(build: &Build, compiler: Compiler, target: Interned<String>) -> PathBuf {
|
||||
build.cargo_out(compiler, Mode::Libstd, target).join(".libstd-check.stamp")
|
||||
pub fn libstd_stamp(builder: &Builder, compiler: Compiler, target: Interned<String>) -> PathBuf {
|
||||
builder.cargo_out(compiler, Mode::Libstd, target).join(".libstd-check.stamp")
|
||||
}
|
||||
|
||||
/// Cargo's output path for libtest in a given stage, compiled by a particular
|
||||
/// compiler for the specified target.
|
||||
pub fn libtest_stamp(build: &Build, compiler: Compiler, target: Interned<String>) -> PathBuf {
|
||||
build.cargo_out(compiler, Mode::Libtest, target).join(".libtest-check.stamp")
|
||||
pub fn libtest_stamp(builder: &Builder, compiler: Compiler, target: Interned<String>) -> PathBuf {
|
||||
builder.cargo_out(compiler, Mode::Libtest, target).join(".libtest-check.stamp")
|
||||
}
|
||||
|
||||
/// Cargo's output path for librustc in a given stage, compiled by a particular
|
||||
/// compiler for the specified target.
|
||||
pub fn librustc_stamp(build: &Build, compiler: Compiler, target: Interned<String>) -> PathBuf {
|
||||
build.cargo_out(compiler, Mode::Librustc, target).join(".librustc-check.stamp")
|
||||
pub fn librustc_stamp(builder: &Builder, compiler: Compiler, target: Interned<String>) -> PathBuf {
|
||||
builder.cargo_out(compiler, Mode::Librustc, target).join(".librustc-check.stamp")
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ use filetime::FileTime;
|
||||
use serde_json;
|
||||
|
||||
use util::{exe, libdir, is_dylib, CiEnv};
|
||||
use {Build, Compiler, Mode};
|
||||
use {Compiler, Mode};
|
||||
use native;
|
||||
use tool;
|
||||
|
||||
@ -65,14 +65,13 @@ impl Step for Std {
|
||||
/// using the `compiler` targeting the `target` architecture. The artifacts
|
||||
/// created will also be linked into the sysroot directory.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let target = self.target;
|
||||
let compiler = self.compiler;
|
||||
|
||||
builder.ensure(StartupObjects { compiler, target });
|
||||
|
||||
if build.force_use_stage1(compiler, target) {
|
||||
let from = builder.compiler(1, build.build);
|
||||
if builder.force_use_stage1(compiler, target) {
|
||||
let from = builder.compiler(1, builder.config.build);
|
||||
builder.ensure(Std {
|
||||
compiler: from,
|
||||
target,
|
||||
@ -83,7 +82,7 @@ impl Step for Std {
|
||||
// still contain the musl startup objects.
|
||||
if target.contains("musl") {
|
||||
let libdir = builder.sysroot_libdir(compiler, target);
|
||||
copy_musl_third_party_objects(build, target, &libdir);
|
||||
copy_musl_third_party_objects(builder, target, &libdir);
|
||||
}
|
||||
|
||||
builder.ensure(StdLink {
|
||||
@ -96,24 +95,24 @@ impl Step for Std {
|
||||
|
||||
if target.contains("musl") {
|
||||
let libdir = builder.sysroot_libdir(compiler, target);
|
||||
copy_musl_third_party_objects(build, target, &libdir);
|
||||
copy_musl_third_party_objects(builder, target, &libdir);
|
||||
}
|
||||
|
||||
let out_dir = build.cargo_out(compiler, Mode::Libstd, target);
|
||||
build.clear_if_dirty(&out_dir, &builder.rustc(compiler));
|
||||
let out_dir = builder.cargo_out(compiler, Mode::Libstd, target);
|
||||
builder.clear_if_dirty(&out_dir, &builder.rustc(compiler));
|
||||
let mut cargo = builder.cargo(compiler, Mode::Libstd, target, "build");
|
||||
std_cargo(builder, &compiler, target, &mut cargo);
|
||||
|
||||
let _folder = build.fold_output(|| format!("stage{}-std", compiler.stage));
|
||||
build.info(&format!("Building stage{} std artifacts ({} -> {})", compiler.stage,
|
||||
let _folder = builder.fold_output(|| format!("stage{}-std", compiler.stage));
|
||||
builder.info(&format!("Building stage{} std artifacts ({} -> {})", compiler.stage,
|
||||
&compiler.host, target));
|
||||
run_cargo(build,
|
||||
run_cargo(builder,
|
||||
&mut cargo,
|
||||
&libstd_stamp(build, compiler, target),
|
||||
&libstd_stamp(builder, compiler, target),
|
||||
false);
|
||||
|
||||
builder.ensure(StdLink {
|
||||
compiler: builder.compiler(compiler.stage, build.build),
|
||||
compiler: builder.compiler(compiler.stage, builder.config.build),
|
||||
target_compiler: compiler,
|
||||
target,
|
||||
});
|
||||
@ -126,17 +125,17 @@ impl Step for Std {
|
||||
/// with a glibc-targeting toolchain, given we have the appropriate startup
|
||||
/// files. As those shipped with glibc won't work, copy the ones provided by
|
||||
/// musl so we have them on linux-gnu hosts.
|
||||
fn copy_musl_third_party_objects(build: &Build,
|
||||
fn copy_musl_third_party_objects(builder: &Builder,
|
||||
target: Interned<String>,
|
||||
into: &Path) {
|
||||
for &obj in &["crt1.o", "crti.o", "crtn.o"] {
|
||||
build.copy(&build.musl_root(target).unwrap().join("lib").join(obj), &into.join(obj));
|
||||
builder.copy(&builder.musl_root(target).unwrap().join("lib").join(obj), &into.join(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// Configure cargo to compile the standard library, adding appropriate env vars
|
||||
/// and such.
|
||||
pub fn std_cargo(build: &Builder,
|
||||
pub fn std_cargo(builder: &Builder,
|
||||
compiler: &Compiler,
|
||||
target: Interned<String>,
|
||||
cargo: &mut Command) {
|
||||
@ -144,27 +143,27 @@ pub fn std_cargo(build: &Builder,
|
||||
cargo.env("MACOSX_DEPLOYMENT_TARGET", target);
|
||||
}
|
||||
|
||||
if build.no_std(target) == Some(true) {
|
||||
if builder.no_std(target) == Some(true) {
|
||||
// for no-std targets we only compile a few no_std crates
|
||||
cargo.arg("--features").arg("c mem")
|
||||
.args(&["-p", "alloc"])
|
||||
.args(&["-p", "compiler_builtins"])
|
||||
.args(&["-p", "std_unicode"])
|
||||
.arg("--manifest-path")
|
||||
.arg(build.src.join("src/rustc/compiler_builtins_shim/Cargo.toml"));
|
||||
.arg(builder.src.join("src/rustc/compiler_builtins_shim/Cargo.toml"));
|
||||
} else {
|
||||
let mut features = build.std_features();
|
||||
let mut features = builder.std_features();
|
||||
|
||||
// When doing a local rebuild we tell cargo that we're stage1 rather than
|
||||
// stage0. This works fine if the local rust and being-built rust have the
|
||||
// same view of what the default allocator is, but fails otherwise. Since
|
||||
// we don't have a way to express an allocator preference yet, work
|
||||
// around the issue in the case of a local rebuild with jemalloc disabled.
|
||||
if compiler.stage == 0 && build.local_rebuild && !build.config.use_jemalloc {
|
||||
if compiler.stage == 0 && builder.local_rebuild && !builder.config.use_jemalloc {
|
||||
features.push_str(" force_alloc_system");
|
||||
}
|
||||
|
||||
if compiler.stage != 0 && build.config.sanitizers {
|
||||
if compiler.stage != 0 && builder.config.sanitizers {
|
||||
// This variable is used by the sanitizer runtime crates, e.g.
|
||||
// rustc_lsan, to build the sanitizer runtime from C code
|
||||
// When this variable is missing, those crates won't compile the C code,
|
||||
@ -172,8 +171,8 @@ pub fn std_cargo(build: &Builder,
|
||||
// missing
|
||||
// We also only build the runtimes when --enable-sanitizers (or its
|
||||
// config.toml equivalent) is used
|
||||
let llvm_config = build.ensure(native::Llvm {
|
||||
target: build.config.build,
|
||||
let llvm_config = builder.ensure(native::Llvm {
|
||||
target: builder.config.build,
|
||||
emscripten: false,
|
||||
});
|
||||
cargo.env("LLVM_CONFIG", llvm_config);
|
||||
@ -181,15 +180,15 @@ pub fn std_cargo(build: &Builder,
|
||||
|
||||
cargo.arg("--features").arg(features)
|
||||
.arg("--manifest-path")
|
||||
.arg(build.src.join("src/libstd/Cargo.toml"));
|
||||
.arg(builder.src.join("src/libstd/Cargo.toml"));
|
||||
|
||||
if let Some(target) = build.config.target_config.get(&target) {
|
||||
if let Some(target) = builder.config.target_config.get(&target) {
|
||||
if let Some(ref jemalloc) = target.jemalloc {
|
||||
cargo.env("JEMALLOC_OVERRIDE", jemalloc);
|
||||
}
|
||||
}
|
||||
if target.contains("musl") {
|
||||
if let Some(p) = build.musl_root(target) {
|
||||
if let Some(p) = builder.musl_root(target) {
|
||||
cargo.env("MUSL_ROOT", p);
|
||||
}
|
||||
}
|
||||
@ -219,24 +218,23 @@ impl Step for StdLink {
|
||||
/// libraries for `target`, and this method will find them in the relevant
|
||||
/// output directory.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let compiler = self.compiler;
|
||||
let target_compiler = self.target_compiler;
|
||||
let target = self.target;
|
||||
build.info(&format!("Copying stage{} std from stage{} ({} -> {} / {})",
|
||||
builder.info(&format!("Copying stage{} std from stage{} ({} -> {} / {})",
|
||||
target_compiler.stage,
|
||||
compiler.stage,
|
||||
&compiler.host,
|
||||
target_compiler.host,
|
||||
target));
|
||||
let libdir = builder.sysroot_libdir(target_compiler, target);
|
||||
add_to_sysroot(&build, &libdir, &libstd_stamp(build, compiler, target));
|
||||
add_to_sysroot(builder, &libdir, &libstd_stamp(builder, compiler, target));
|
||||
|
||||
if build.config.sanitizers && compiler.stage != 0 && target == "x86_64-apple-darwin" {
|
||||
if builder.config.sanitizers && compiler.stage != 0 && target == "x86_64-apple-darwin" {
|
||||
// The sanitizers are only built in stage1 or above, so the dylibs will
|
||||
// be missing in stage0 and causes panic. See the `std()` function above
|
||||
// for reason why the sanitizers are not built in stage0.
|
||||
copy_apple_sanitizer_dylibs(&build, &build.native_dir(target), "osx", &libdir);
|
||||
copy_apple_sanitizer_dylibs(builder, &builder.native_dir(target), "osx", &libdir);
|
||||
}
|
||||
|
||||
builder.ensure(tool::CleanTools {
|
||||
@ -247,7 +245,7 @@ impl Step for StdLink {
|
||||
}
|
||||
}
|
||||
|
||||
fn copy_apple_sanitizer_dylibs(build: &Build, native_dir: &Path, platform: &str, into: &Path) {
|
||||
fn copy_apple_sanitizer_dylibs(builder: &Builder, native_dir: &Path, platform: &str, into: &Path) {
|
||||
for &sanitizer in &["asan", "tsan"] {
|
||||
let filename = format!("libclang_rt.{}_{}_dynamic.dylib", sanitizer, platform);
|
||||
let mut src_path = native_dir.join(sanitizer);
|
||||
@ -255,7 +253,7 @@ fn copy_apple_sanitizer_dylibs(build: &Build, native_dir: &Path, platform: &str,
|
||||
src_path.push("lib");
|
||||
src_path.push("darwin");
|
||||
src_path.push(&filename);
|
||||
build.copy(&src_path, &into.join(filename));
|
||||
builder.copy(&src_path, &into.join(filename));
|
||||
}
|
||||
}
|
||||
|
||||
@ -286,15 +284,14 @@ impl Step for StartupObjects {
|
||||
/// files, so we just use the nightly snapshot compiler to always build them (as
|
||||
/// no other compilers are guaranteed to be available).
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let for_compiler = self.compiler;
|
||||
let target = self.target;
|
||||
if !target.contains("pc-windows-gnu") {
|
||||
return
|
||||
}
|
||||
|
||||
let src_dir = &build.src.join("src/rtstartup");
|
||||
let dst_dir = &build.native_dir(target).join("rtstartup");
|
||||
let src_dir = &builder.src.join("src/rtstartup");
|
||||
let dst_dir = &builder.native_dir(target).join("rtstartup");
|
||||
let sysroot_dir = &builder.sysroot_libdir(for_compiler, target);
|
||||
t!(fs::create_dir_all(dst_dir));
|
||||
|
||||
@ -302,8 +299,8 @@ impl Step for StartupObjects {
|
||||
let src_file = &src_dir.join(file.to_string() + ".rs");
|
||||
let dst_file = &dst_dir.join(file.to_string() + ".o");
|
||||
if !up_to_date(src_file, dst_file) {
|
||||
let mut cmd = Command::new(&build.initial_rustc);
|
||||
build.run(cmd.env("RUSTC_BOOTSTRAP", "1")
|
||||
let mut cmd = Command::new(&builder.initial_rustc);
|
||||
builder.run(cmd.env("RUSTC_BOOTSTRAP", "1")
|
||||
.arg("--cfg").arg("stage0")
|
||||
.arg("--target").arg(target)
|
||||
.arg("--emit=obj")
|
||||
@ -311,15 +308,15 @@ impl Step for StartupObjects {
|
||||
.arg(src_file));
|
||||
}
|
||||
|
||||
build.copy(dst_file, &sysroot_dir.join(file.to_string() + ".o"));
|
||||
builder.copy(dst_file, &sysroot_dir.join(file.to_string() + ".o"));
|
||||
}
|
||||
|
||||
for obj in ["crt2.o", "dllcrt2.o"].iter() {
|
||||
let src = compiler_file(build,
|
||||
build.cc(target),
|
||||
let src = compiler_file(builder,
|
||||
builder.cc(target),
|
||||
target,
|
||||
obj);
|
||||
build.copy(&src, &sysroot_dir.join(obj));
|
||||
builder.copy(&src, &sysroot_dir.join(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -351,41 +348,41 @@ impl Step for Test {
|
||||
/// the build using the `compiler` targeting the `target` architecture. The
|
||||
/// artifacts created will also be linked into the sysroot directory.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let target = self.target;
|
||||
let compiler = self.compiler;
|
||||
|
||||
builder.ensure(Std { compiler, target });
|
||||
|
||||
if build.force_use_stage1(compiler, target) {
|
||||
if builder.force_use_stage1(compiler, target) {
|
||||
builder.ensure(Test {
|
||||
compiler: builder.compiler(1, build.build),
|
||||
compiler: builder.compiler(1, builder.config.build),
|
||||
target,
|
||||
});
|
||||
build.info(&format!("Uplifting stage1 test ({} -> {})", &build.build, target));
|
||||
builder.info(
|
||||
&format!("Uplifting stage1 test ({} -> {})", builder.config.build, target));
|
||||
builder.ensure(TestLink {
|
||||
compiler: builder.compiler(1, build.build),
|
||||
compiler: builder.compiler(1, builder.config.build),
|
||||
target_compiler: compiler,
|
||||
target,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
let out_dir = build.cargo_out(compiler, Mode::Libtest, target);
|
||||
build.clear_if_dirty(&out_dir, &libstd_stamp(build, compiler, target));
|
||||
let out_dir = builder.cargo_out(compiler, Mode::Libtest, target);
|
||||
builder.clear_if_dirty(&out_dir, &libstd_stamp(builder, compiler, target));
|
||||
let mut cargo = builder.cargo(compiler, Mode::Libtest, target, "build");
|
||||
test_cargo(build, &compiler, target, &mut cargo);
|
||||
test_cargo(builder, &compiler, target, &mut cargo);
|
||||
|
||||
let _folder = build.fold_output(|| format!("stage{}-test", compiler.stage));
|
||||
build.info(&format!("Building stage{} test artifacts ({} -> {})", compiler.stage,
|
||||
let _folder = builder.fold_output(|| format!("stage{}-test", compiler.stage));
|
||||
builder.info(&format!("Building stage{} test artifacts ({} -> {})", compiler.stage,
|
||||
&compiler.host, target));
|
||||
run_cargo(build,
|
||||
run_cargo(builder,
|
||||
&mut cargo,
|
||||
&libtest_stamp(build, compiler, target),
|
||||
&libtest_stamp(builder, compiler, target),
|
||||
false);
|
||||
|
||||
builder.ensure(TestLink {
|
||||
compiler: builder.compiler(compiler.stage, build.build),
|
||||
compiler: builder.compiler(compiler.stage, builder.config.build),
|
||||
target_compiler: compiler,
|
||||
target,
|
||||
});
|
||||
@ -393,7 +390,7 @@ impl Step for Test {
|
||||
}
|
||||
|
||||
/// Same as `std_cargo`, but for libtest
|
||||
pub fn test_cargo(build: &Build,
|
||||
pub fn test_cargo(builder: &Builder,
|
||||
_compiler: &Compiler,
|
||||
_target: Interned<String>,
|
||||
cargo: &mut Command) {
|
||||
@ -401,7 +398,7 @@ pub fn test_cargo(build: &Build,
|
||||
cargo.env("MACOSX_DEPLOYMENT_TARGET", target);
|
||||
}
|
||||
cargo.arg("--manifest-path")
|
||||
.arg(build.src.join("src/libtest/Cargo.toml"));
|
||||
.arg(builder.src.join("src/libtest/Cargo.toml"));
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
@ -420,18 +417,17 @@ impl Step for TestLink {
|
||||
|
||||
/// Same as `std_link`, only for libtest
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let compiler = self.compiler;
|
||||
let target_compiler = self.target_compiler;
|
||||
let target = self.target;
|
||||
build.info(&format!("Copying stage{} test from stage{} ({} -> {} / {})",
|
||||
builder.info(&format!("Copying stage{} test from stage{} ({} -> {} / {})",
|
||||
target_compiler.stage,
|
||||
compiler.stage,
|
||||
&compiler.host,
|
||||
target_compiler.host,
|
||||
target));
|
||||
add_to_sysroot(&build, &builder.sysroot_libdir(target_compiler, target),
|
||||
&libtest_stamp(build, compiler, target));
|
||||
add_to_sysroot(builder, &builder.sysroot_libdir(target_compiler, target),
|
||||
&libtest_stamp(builder, compiler, target));
|
||||
builder.ensure(tool::CleanTools {
|
||||
compiler: target_compiler,
|
||||
target,
|
||||
@ -468,20 +464,20 @@ impl Step for Rustc {
|
||||
/// the `compiler` targeting the `target` architecture. The artifacts
|
||||
/// created will also be linked into the sysroot directory.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let compiler = self.compiler;
|
||||
let target = self.target;
|
||||
|
||||
builder.ensure(Test { compiler, target });
|
||||
|
||||
if build.force_use_stage1(compiler, target) {
|
||||
if builder.force_use_stage1(compiler, target) {
|
||||
builder.ensure(Rustc {
|
||||
compiler: builder.compiler(1, build.build),
|
||||
compiler: builder.compiler(1, builder.config.build),
|
||||
target,
|
||||
});
|
||||
build.info(&format!("Uplifting stage1 rustc ({} -> {})", &build.build, target));
|
||||
builder.info(&format!("Uplifting stage1 rustc ({} -> {})",
|
||||
builder.config.build, target));
|
||||
builder.ensure(RustcLink {
|
||||
compiler: builder.compiler(1, build.build),
|
||||
compiler: builder.compiler(1, builder.config.build),
|
||||
target_compiler: compiler,
|
||||
target,
|
||||
});
|
||||
@ -490,71 +486,71 @@ 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, builder.config.build),
|
||||
target: builder.config.build,
|
||||
});
|
||||
let cargo_out = builder.cargo_out(compiler, Mode::Librustc, target);
|
||||
build.clear_if_dirty(&cargo_out, &libstd_stamp(build, compiler, target));
|
||||
build.clear_if_dirty(&cargo_out, &libtest_stamp(build, compiler, target));
|
||||
builder.clear_if_dirty(&cargo_out, &libstd_stamp(builder, compiler, target));
|
||||
builder.clear_if_dirty(&cargo_out, &libtest_stamp(builder, compiler, target));
|
||||
|
||||
let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "build");
|
||||
rustc_cargo(build, &mut cargo);
|
||||
rustc_cargo(builder, &mut cargo);
|
||||
|
||||
let _folder = build.fold_output(|| format!("stage{}-rustc", compiler.stage));
|
||||
build.info(&format!("Building stage{} compiler artifacts ({} -> {})",
|
||||
let _folder = builder.fold_output(|| format!("stage{}-rustc", compiler.stage));
|
||||
builder.info(&format!("Building stage{} compiler artifacts ({} -> {})",
|
||||
compiler.stage, &compiler.host, target));
|
||||
run_cargo(build,
|
||||
run_cargo(builder,
|
||||
&mut cargo,
|
||||
&librustc_stamp(build, compiler, target),
|
||||
&librustc_stamp(builder, compiler, target),
|
||||
false);
|
||||
|
||||
builder.ensure(RustcLink {
|
||||
compiler: builder.compiler(compiler.stage, build.build),
|
||||
compiler: builder.compiler(compiler.stage, builder.config.build),
|
||||
target_compiler: compiler,
|
||||
target,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
pub fn rustc_cargo(build: &Build, cargo: &mut Command) {
|
||||
cargo.arg("--features").arg(build.rustc_features())
|
||||
pub fn rustc_cargo(builder: &Builder, cargo: &mut Command) {
|
||||
cargo.arg("--features").arg(builder.rustc_features())
|
||||
.arg("--manifest-path")
|
||||
.arg(build.src.join("src/rustc/Cargo.toml"));
|
||||
rustc_cargo_env(build, cargo);
|
||||
.arg(builder.src.join("src/rustc/Cargo.toml"));
|
||||
rustc_cargo_env(builder, cargo);
|
||||
}
|
||||
|
||||
fn rustc_cargo_env(build: &Build, cargo: &mut Command) {
|
||||
fn rustc_cargo_env(builder: &Builder, cargo: &mut Command) {
|
||||
// Set some configuration variables picked up by build scripts and
|
||||
// the compiler alike
|
||||
cargo.env("CFG_RELEASE", build.rust_release())
|
||||
.env("CFG_RELEASE_CHANNEL", &build.config.channel)
|
||||
.env("CFG_VERSION", build.rust_version())
|
||||
.env("CFG_PREFIX", build.config.prefix.clone().unwrap_or_default())
|
||||
.env("CFG_CODEGEN_BACKENDS_DIR", &build.config.rust_codegen_backends_dir);
|
||||
cargo.env("CFG_RELEASE", builder.rust_release())
|
||||
.env("CFG_RELEASE_CHANNEL", &builder.config.channel)
|
||||
.env("CFG_VERSION", builder.rust_version())
|
||||
.env("CFG_PREFIX", builder.config.prefix.clone().unwrap_or_default())
|
||||
.env("CFG_CODEGEN_BACKENDS_DIR", &builder.config.rust_codegen_backends_dir);
|
||||
|
||||
let libdir_relative = build.config.libdir_relative().unwrap_or(Path::new("lib"));
|
||||
let libdir_relative = builder.config.libdir_relative().unwrap_or(Path::new("lib"));
|
||||
cargo.env("CFG_LIBDIR_RELATIVE", libdir_relative);
|
||||
|
||||
// If we're not building a compiler with debugging information then remove
|
||||
// these two env vars which would be set otherwise.
|
||||
if build.config.rust_debuginfo_only_std {
|
||||
if builder.config.rust_debuginfo_only_std {
|
||||
cargo.env_remove("RUSTC_DEBUGINFO");
|
||||
cargo.env_remove("RUSTC_DEBUGINFO_LINES");
|
||||
}
|
||||
|
||||
if let Some(ref ver_date) = build.rust_info.commit_date() {
|
||||
if let Some(ref ver_date) = builder.rust_info.commit_date() {
|
||||
cargo.env("CFG_VER_DATE", ver_date);
|
||||
}
|
||||
if let Some(ref ver_hash) = build.rust_info.sha() {
|
||||
if let Some(ref ver_hash) = builder.rust_info.sha() {
|
||||
cargo.env("CFG_VER_HASH", ver_hash);
|
||||
}
|
||||
if !build.unstable_features() {
|
||||
if !builder.unstable_features() {
|
||||
cargo.env("CFG_DISABLE_UNSTABLE_FEATURES", "1");
|
||||
}
|
||||
if let Some(ref s) = build.config.rustc_default_linker {
|
||||
if let Some(ref s) = builder.config.rustc_default_linker {
|
||||
cargo.env("CFG_DEFAULT_LINKER", s);
|
||||
}
|
||||
if build.config.rustc_parallel_queries {
|
||||
if builder.config.rustc_parallel_queries {
|
||||
cargo.env("RUSTC_PARALLEL_QUERIES", "1");
|
||||
}
|
||||
}
|
||||
@ -575,18 +571,17 @@ impl Step for RustcLink {
|
||||
|
||||
/// Same as `std_link`, only for librustc
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let compiler = self.compiler;
|
||||
let target_compiler = self.target_compiler;
|
||||
let target = self.target;
|
||||
build.info(&format!("Copying stage{} rustc from stage{} ({} -> {} / {})",
|
||||
builder.info(&format!("Copying stage{} rustc from stage{} ({} -> {} / {})",
|
||||
target_compiler.stage,
|
||||
compiler.stage,
|
||||
&compiler.host,
|
||||
target_compiler.host,
|
||||
target));
|
||||
add_to_sysroot(&build, &builder.sysroot_libdir(target_compiler, target),
|
||||
&librustc_stamp(build, compiler, target));
|
||||
add_to_sysroot(builder, &builder.sysroot_libdir(target_compiler, target),
|
||||
&librustc_stamp(builder, compiler, target));
|
||||
builder.ensure(tool::CleanTools {
|
||||
compiler: target_compiler,
|
||||
target,
|
||||
@ -624,15 +619,14 @@ impl Step for CodegenBackend {
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let compiler = self.compiler;
|
||||
let target = self.target;
|
||||
|
||||
builder.ensure(Rustc { compiler, target });
|
||||
|
||||
if build.force_use_stage1(compiler, target) {
|
||||
if builder.force_use_stage1(compiler, target) {
|
||||
builder.ensure(CodegenBackend {
|
||||
compiler: builder.compiler(1, build.build),
|
||||
compiler: builder.compiler(1, builder.config.build),
|
||||
target,
|
||||
backend: self.backend,
|
||||
});
|
||||
@ -640,10 +634,10 @@ impl Step for CodegenBackend {
|
||||
}
|
||||
|
||||
let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "build");
|
||||
let mut features = build.rustc_features().to_string();
|
||||
let mut features = builder.rustc_features().to_string();
|
||||
cargo.arg("--manifest-path")
|
||||
.arg(build.src.join("src/librustc_trans/Cargo.toml"));
|
||||
rustc_cargo_env(build, &mut cargo);
|
||||
.arg(builder.src.join("src/librustc_trans/Cargo.toml"));
|
||||
rustc_cargo_env(builder, &mut cargo);
|
||||
|
||||
match &*self.backend {
|
||||
"llvm" | "emscripten" => {
|
||||
@ -658,45 +652,45 @@ impl Step for CodegenBackend {
|
||||
features.push_str(" emscripten");
|
||||
}
|
||||
|
||||
build.info(&format!("Building stage{} codegen artifacts ({} -> {}, {})",
|
||||
builder.info(&format!("Building stage{} codegen artifacts ({} -> {}, {})",
|
||||
compiler.stage, &compiler.host, target, self.backend));
|
||||
|
||||
// Pass down configuration from the LLVM build into the build of
|
||||
// librustc_llvm and librustc_trans.
|
||||
if build.is_rust_llvm(target) {
|
||||
if builder.is_rust_llvm(target) {
|
||||
cargo.env("LLVM_RUSTLLVM", "1");
|
||||
}
|
||||
cargo.env("LLVM_CONFIG", &llvm_config);
|
||||
if self.backend != "emscripten" {
|
||||
let target_config = build.config.target_config.get(&target);
|
||||
let target_config = builder.config.target_config.get(&target);
|
||||
if let Some(s) = target_config.and_then(|c| c.llvm_config.as_ref()) {
|
||||
cargo.env("CFG_LLVM_ROOT", s);
|
||||
}
|
||||
}
|
||||
// Building with a static libstdc++ is only supported on linux right now,
|
||||
// not for MSVC or macOS
|
||||
if build.config.llvm_static_stdcpp &&
|
||||
if builder.config.llvm_static_stdcpp &&
|
||||
!target.contains("freebsd") &&
|
||||
!target.contains("windows") &&
|
||||
!target.contains("apple") {
|
||||
let file = compiler_file(build,
|
||||
build.cxx(target).unwrap(),
|
||||
let file = compiler_file(builder,
|
||||
builder.cxx(target).unwrap(),
|
||||
target,
|
||||
"libstdc++.a");
|
||||
cargo.env("LLVM_STATIC_STDCPP", file);
|
||||
}
|
||||
if build.config.llvm_link_shared {
|
||||
if builder.config.llvm_link_shared {
|
||||
cargo.env("LLVM_LINK_SHARED", "1");
|
||||
}
|
||||
}
|
||||
_ => panic!("unknown backend: {}", self.backend),
|
||||
}
|
||||
|
||||
let tmp_stamp = build.cargo_out(compiler, Mode::Librustc, target)
|
||||
let tmp_stamp = builder.cargo_out(compiler, Mode::Librustc, target)
|
||||
.join(".tmp.stamp");
|
||||
|
||||
let _folder = build.fold_output(|| format!("stage{}-rustc_trans", compiler.stage));
|
||||
let files = run_cargo(build,
|
||||
let _folder = builder.fold_output(|| format!("stage{}-rustc_trans", compiler.stage));
|
||||
let files = run_cargo(builder,
|
||||
cargo.arg("--features").arg(features),
|
||||
&tmp_stamp,
|
||||
false);
|
||||
@ -717,7 +711,7 @@ impl Step for CodegenBackend {
|
||||
codegen_backend.display(),
|
||||
f.display());
|
||||
}
|
||||
let stamp = codegen_backend_stamp(build, compiler, target, self.backend);
|
||||
let stamp = codegen_backend_stamp(builder, compiler, target, self.backend);
|
||||
let codegen_backend = codegen_backend.to_str().unwrap();
|
||||
t!(t!(File::create(&stamp)).write_all(codegen_backend.as_bytes()));
|
||||
}
|
||||
@ -732,7 +726,6 @@ impl Step for CodegenBackend {
|
||||
fn copy_codegen_backends_to_sysroot(builder: &Builder,
|
||||
compiler: Compiler,
|
||||
target_compiler: Compiler) {
|
||||
let build = builder.build;
|
||||
let target = target_compiler.host;
|
||||
|
||||
// Note that this step is different than all the other `*Link` steps in
|
||||
@ -751,7 +744,7 @@ fn copy_codegen_backends_to_sysroot(builder: &Builder,
|
||||
}
|
||||
|
||||
for backend in builder.config.rust_codegen_backends.iter() {
|
||||
let stamp = codegen_backend_stamp(build, compiler, target, *backend);
|
||||
let stamp = codegen_backend_stamp(builder, compiler, target, *backend);
|
||||
let mut dylib = String::new();
|
||||
t!(t!(File::open(&stamp)).read_to_string(&mut dylib));
|
||||
let file = Path::new(&dylib);
|
||||
@ -765,7 +758,7 @@ fn copy_codegen_backends_to_sysroot(builder: &Builder,
|
||||
backend,
|
||||
&filename[dot..])
|
||||
};
|
||||
build.copy(&file, &dst.join(target_filename));
|
||||
builder.copy(&file, &dst.join(target_filename));
|
||||
}
|
||||
}
|
||||
|
||||
@ -786,36 +779,36 @@ fn copy_lld_to_sysroot(builder: &Builder,
|
||||
|
||||
/// Cargo's output path for the standard library in a given stage, compiled
|
||||
/// by a particular compiler for the specified target.
|
||||
pub fn libstd_stamp(build: &Build, compiler: Compiler, target: Interned<String>) -> PathBuf {
|
||||
build.cargo_out(compiler, Mode::Libstd, target).join(".libstd.stamp")
|
||||
pub fn libstd_stamp(builder: &Builder, compiler: Compiler, target: Interned<String>) -> PathBuf {
|
||||
builder.cargo_out(compiler, Mode::Libstd, target).join(".libstd.stamp")
|
||||
}
|
||||
|
||||
/// Cargo's output path for libtest in a given stage, compiled by a particular
|
||||
/// compiler for the specified target.
|
||||
pub fn libtest_stamp(build: &Build, compiler: Compiler, target: Interned<String>) -> PathBuf {
|
||||
build.cargo_out(compiler, Mode::Libtest, target).join(".libtest.stamp")
|
||||
pub fn libtest_stamp(builder: &Builder, compiler: Compiler, target: Interned<String>) -> PathBuf {
|
||||
builder.cargo_out(compiler, Mode::Libtest, target).join(".libtest.stamp")
|
||||
}
|
||||
|
||||
/// Cargo's output path for librustc in a given stage, compiled by a particular
|
||||
/// compiler for the specified target.
|
||||
pub fn librustc_stamp(build: &Build, compiler: Compiler, target: Interned<String>) -> PathBuf {
|
||||
build.cargo_out(compiler, Mode::Librustc, target).join(".librustc.stamp")
|
||||
pub fn librustc_stamp(builder: &Builder, compiler: Compiler, target: Interned<String>) -> PathBuf {
|
||||
builder.cargo_out(compiler, Mode::Librustc, target).join(".librustc.stamp")
|
||||
}
|
||||
|
||||
fn codegen_backend_stamp(build: &Build,
|
||||
fn codegen_backend_stamp(builder: &Builder,
|
||||
compiler: Compiler,
|
||||
target: Interned<String>,
|
||||
backend: Interned<String>) -> PathBuf {
|
||||
build.cargo_out(compiler, Mode::Librustc, target)
|
||||
builder.cargo_out(compiler, Mode::Librustc, target)
|
||||
.join(format!(".librustc_trans-{}.stamp", backend))
|
||||
}
|
||||
|
||||
fn compiler_file(build: &Build,
|
||||
fn compiler_file(builder: &Builder,
|
||||
compiler: &Path,
|
||||
target: Interned<String>,
|
||||
file: &str) -> PathBuf {
|
||||
let mut cmd = Command::new(compiler);
|
||||
cmd.args(build.cflags(target));
|
||||
cmd.args(builder.cflags(target));
|
||||
cmd.arg(format!("-print-file-name={}", file));
|
||||
let out = output(&mut cmd);
|
||||
PathBuf::from(out.trim())
|
||||
@ -840,12 +833,11 @@ impl Step for Sysroot {
|
||||
/// thinks it is by default, but it's the same as the default for stages
|
||||
/// 1-3.
|
||||
fn run(self, builder: &Builder) -> Interned<PathBuf> {
|
||||
let build = builder.build;
|
||||
let compiler = self.compiler;
|
||||
let sysroot = if compiler.stage == 0 {
|
||||
build.out.join(&compiler.host).join("stage0-sysroot")
|
||||
builder.out.join(&compiler.host).join("stage0-sysroot")
|
||||
} else {
|
||||
build.out.join(&compiler.host).join(format!("stage{}", compiler.stage))
|
||||
builder.out.join(&compiler.host).join(format!("stage{}", compiler.stage))
|
||||
};
|
||||
let _ = fs::remove_dir_all(&sysroot);
|
||||
t!(fs::create_dir_all(&sysroot));
|
||||
@ -872,14 +864,13 @@ impl Step for Assemble {
|
||||
/// Prepare a new compiler from the artifacts in `stage`
|
||||
///
|
||||
/// This will assemble a compiler in `build/$host/stage$stage`. The compiler
|
||||
/// must have been previously produced by the `stage - 1` build.build
|
||||
/// must have been previously produced by the `stage - 1` builder.build
|
||||
/// compiler.
|
||||
fn run(self, builder: &Builder) -> Compiler {
|
||||
let build = builder.build;
|
||||
let target_compiler = self.target_compiler;
|
||||
|
||||
if target_compiler.stage == 0 {
|
||||
assert_eq!(build.build, target_compiler.host,
|
||||
assert_eq!(builder.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;
|
||||
@ -902,14 +893,14 @@ 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, builder.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
|
||||
// link to these. (FIXME: Is that correct? It seems to be correct most
|
||||
// of the time but I think we do link to these for stage2/bin compilers
|
||||
// when not performing a full bootstrap).
|
||||
if builder.build.config.keep_stage.map_or(false, |s| target_compiler.stage <= s) {
|
||||
if builder.config.keep_stage.map_or(false, |s| target_compiler.stage <= s) {
|
||||
builder.verbose("skipping compilation of compiler due to --keep-stage");
|
||||
let compiler = build_compiler;
|
||||
for stage in 0..min(target_compiler.stage, builder.config.keep_stage.unwrap()) {
|
||||
@ -924,7 +915,7 @@ impl Step for Assemble {
|
||||
compiler: build_compiler,
|
||||
target: target_compiler.host,
|
||||
});
|
||||
for &backend in build.config.rust_codegen_backends.iter() {
|
||||
for &backend in builder.config.rust_codegen_backends.iter() {
|
||||
builder.ensure(CodegenBackend {
|
||||
compiler: build_compiler,
|
||||
target: target_compiler.host,
|
||||
@ -933,7 +924,7 @@ impl Step for Assemble {
|
||||
}
|
||||
}
|
||||
|
||||
let lld_install = if build.config.lld_enabled {
|
||||
let lld_install = if builder.config.lld_enabled {
|
||||
Some(builder.ensure(native::Lld {
|
||||
target: target_compiler.host,
|
||||
}))
|
||||
@ -943,7 +934,7 @@ impl Step for Assemble {
|
||||
|
||||
let stage = target_compiler.stage;
|
||||
let host = target_compiler.host;
|
||||
build.info(&format!("Assembling stage{} compiler ({})", stage, host));
|
||||
builder.info(&format!("Assembling stage{} compiler ({})", stage, host));
|
||||
|
||||
// Link in all dylibs to the libdir
|
||||
let sysroot = builder.sysroot(target_compiler);
|
||||
@ -965,7 +956,7 @@ impl Step for Assemble {
|
||||
}
|
||||
|
||||
// Link the compiler binary itself into place
|
||||
let out_dir = build.cargo_out(build_compiler, Mode::Librustc, host);
|
||||
let out_dir = builder.cargo_out(build_compiler, Mode::Librustc, host);
|
||||
let rustc = out_dir.join(exe("rustc", &*host));
|
||||
let bindir = sysroot.join("bin");
|
||||
t!(fs::create_dir_all(&bindir));
|
||||
@ -981,10 +972,10 @@ impl Step for Assemble {
|
||||
///
|
||||
/// For a particular stage this will link the file listed in `stamp` into the
|
||||
/// `sysroot_dst` provided.
|
||||
pub fn add_to_sysroot(build: &Build, sysroot_dst: &Path, stamp: &Path) {
|
||||
pub fn add_to_sysroot(builder: &Builder, sysroot_dst: &Path, stamp: &Path) {
|
||||
t!(fs::create_dir_all(&sysroot_dst));
|
||||
for path in build.read_stamp_file(stamp) {
|
||||
build.copy(&path, &sysroot_dst.join(path.file_name().unwrap()));
|
||||
for path in builder.read_stamp_file(stamp) {
|
||||
builder.copy(&path, &sysroot_dst.join(path.file_name().unwrap()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1011,10 +1002,10 @@ fn stderr_isatty() -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn run_cargo(build: &Build, cargo: &mut Command, stamp: &Path, is_check: bool)
|
||||
pub fn run_cargo(builder: &Builder, cargo: &mut Command, stamp: &Path, is_check: bool)
|
||||
-> Vec<PathBuf>
|
||||
{
|
||||
if build.config.dry_run {
|
||||
if builder.config.dry_run {
|
||||
return Vec::new();
|
||||
}
|
||||
|
||||
@ -1032,7 +1023,7 @@ pub fn run_cargo(build: &Build, cargo: &mut Command, stamp: &Path, is_check: boo
|
||||
// files we need to probe for later.
|
||||
let mut deps = Vec::new();
|
||||
let mut toplevel = Vec::new();
|
||||
let ok = stream_cargo(build, cargo, &mut |msg| {
|
||||
let ok = stream_cargo(builder, cargo, &mut |msg| {
|
||||
let filenames = match msg {
|
||||
CargoMessage::CompilerArtifact { filenames, .. } => filenames,
|
||||
_ => return,
|
||||
@ -1141,25 +1132,25 @@ pub fn run_cargo(build: &Build, cargo: &mut Command, stamp: &Path, is_check: boo
|
||||
let max = max.unwrap();
|
||||
let max_path = max_path.unwrap();
|
||||
if stamp_contents == new_contents && max <= stamp_mtime {
|
||||
build.verbose(&format!("not updating {:?}; contents equal and {:?} <= {:?}",
|
||||
builder.verbose(&format!("not updating {:?}; contents equal and {:?} <= {:?}",
|
||||
stamp, max, stamp_mtime));
|
||||
return deps
|
||||
}
|
||||
if max > stamp_mtime {
|
||||
build.verbose(&format!("updating {:?} as {:?} changed", stamp, max_path));
|
||||
builder.verbose(&format!("updating {:?} as {:?} changed", stamp, max_path));
|
||||
} else {
|
||||
build.verbose(&format!("updating {:?} as deps changed", stamp));
|
||||
builder.verbose(&format!("updating {:?} as deps changed", stamp));
|
||||
}
|
||||
t!(t!(File::create(stamp)).write_all(&new_contents));
|
||||
deps
|
||||
}
|
||||
|
||||
pub fn stream_cargo(
|
||||
build: &Build,
|
||||
builder: &Builder,
|
||||
cargo: &mut Command,
|
||||
cb: &mut FnMut(CargoMessage),
|
||||
) -> bool {
|
||||
if build.config.dry_run {
|
||||
if builder.config.dry_run {
|
||||
return true;
|
||||
}
|
||||
// Instruct Cargo to give us json messages on stdout, critically leaving
|
||||
@ -1167,7 +1158,7 @@ pub fn stream_cargo(
|
||||
cargo.arg("--message-format").arg("json")
|
||||
.stdout(Stdio::piped());
|
||||
|
||||
if stderr_isatty() && build.ci_env == CiEnv::None &&
|
||||
if stderr_isatty() && builder.ci_env == CiEnv::None &&
|
||||
// if the terminal is reported as dumb, then we don't want to enable color for rustc
|
||||
env::var_os("TERM").map(|t| t != *"dumb").unwrap_or(true) {
|
||||
// since we pass message-format=json to cargo, we need to tell the rustc
|
||||
@ -1176,7 +1167,7 @@ pub fn stream_cargo(
|
||||
cargo.env("RUSTC_COLOR", "1");
|
||||
}
|
||||
|
||||
build.verbose(&format!("running: {:?}", cargo));
|
||||
builder.verbose(&format!("running: {:?}", cargo));
|
||||
let mut child = match cargo.spawn() {
|
||||
Ok(child) => child,
|
||||
Err(e) => panic!("failed to execute command: {:?}\nerror: {}", cargo, e),
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! Documentation generation for rustbuild.
|
||||
//! Documentation generation for rustbuilder.
|
||||
//!
|
||||
//! This module implements generation for all bits and pieces of documentation
|
||||
//! for the Rust project. This notably includes suites like the rust book, the
|
||||
@ -23,7 +23,7 @@ use std::io::prelude::*;
|
||||
use std::io;
|
||||
use std::path::{PathBuf, Path};
|
||||
|
||||
use {Build, Mode};
|
||||
use Mode;
|
||||
use build_helper::up_to_date;
|
||||
|
||||
use util::symlink_dir;
|
||||
@ -47,7 +47,7 @@ macro_rules! book {
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
let builder = run.builder;
|
||||
run.path($path).default_condition(builder.build.config.docs)
|
||||
run.path($path).default_condition(builder.config.docs)
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig) {
|
||||
@ -94,7 +94,7 @@ impl Step for Rustbook {
|
||||
/// This will not actually generate any documentation if the documentation has
|
||||
/// already been generated.
|
||||
fn run(self, builder: &Builder) {
|
||||
let src = builder.build.src.join("src/doc");
|
||||
let src = builder.src.join("src/doc");
|
||||
builder.ensure(RustbookSrc {
|
||||
target: self.target,
|
||||
name: self.name,
|
||||
@ -114,7 +114,7 @@ impl Step for UnstableBook {
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
let builder = run.builder;
|
||||
run.path("src/doc/unstable-book").default_condition(builder.build.config.docs)
|
||||
run.path("src/doc/unstable-book").default_condition(builder.config.docs)
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig) {
|
||||
@ -130,7 +130,7 @@ impl Step for UnstableBook {
|
||||
builder.ensure(RustbookSrc {
|
||||
target: self.target,
|
||||
name: INTERNER.intern_str("unstable-book"),
|
||||
src: builder.build.md_doc_out(self.target),
|
||||
src: builder.md_doc_out(self.target),
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -147,7 +147,7 @@ impl Step for CargoBook {
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
let builder = run.builder;
|
||||
run.path("src/tools/cargo/src/doc/book").default_condition(builder.build.config.docs)
|
||||
run.path("src/tools/cargo/src/doc/book").default_condition(builder.config.docs)
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig) {
|
||||
@ -158,22 +158,20 @@ impl Step for CargoBook {
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
|
||||
let target = self.target;
|
||||
let name = self.name;
|
||||
let src = build.src.join("src/tools/cargo/src/doc");
|
||||
let src = builder.src.join("src/tools/cargo/src/doc");
|
||||
|
||||
let out = build.doc_out(target);
|
||||
let out = builder.doc_out(target);
|
||||
t!(fs::create_dir_all(&out));
|
||||
|
||||
let out = out.join(name);
|
||||
|
||||
build.info(&format!("Cargo Book ({}) - {}", target, name));
|
||||
builder.info(&format!("Cargo Book ({}) - {}", target, name));
|
||||
|
||||
let _ = fs::remove_dir_all(&out);
|
||||
|
||||
build.run(builder.tool_cmd(Tool::Rustbook)
|
||||
builder.run(builder.tool_cmd(Tool::Rustbook)
|
||||
.arg("build")
|
||||
.arg(&src)
|
||||
.arg("-d")
|
||||
@ -200,11 +198,10 @@ impl Step for RustbookSrc {
|
||||
/// This will not actually generate any documentation if the documentation has
|
||||
/// already been generated.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let target = self.target;
|
||||
let name = self.name;
|
||||
let src = self.src;
|
||||
let out = build.doc_out(target);
|
||||
let out = builder.doc_out(target);
|
||||
t!(fs::create_dir_all(&out));
|
||||
|
||||
let out = out.join(name);
|
||||
@ -215,9 +212,9 @@ impl Step for RustbookSrc {
|
||||
if up_to_date(&src, &index) && up_to_date(&rustbook, &index) {
|
||||
return
|
||||
}
|
||||
build.info(&format!("Rustbook ({}) - {}", target, name));
|
||||
builder.info(&format!("Rustbook ({}) - {}", target, name));
|
||||
let _ = fs::remove_dir_all(&out);
|
||||
build.run(rustbook_cmd
|
||||
builder.run(rustbook_cmd
|
||||
.arg("build")
|
||||
.arg(&src)
|
||||
.arg("-d")
|
||||
@ -238,12 +235,12 @@ impl Step for TheBook {
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
let builder = run.builder;
|
||||
run.path("src/doc/book").default_condition(builder.build.config.docs)
|
||||
run.path("src/doc/book").default_condition(builder.config.docs)
|
||||
}
|
||||
|
||||
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.config.build),
|
||||
target: run.target,
|
||||
name: "book",
|
||||
});
|
||||
@ -259,7 +256,6 @@ impl Step for TheBook {
|
||||
/// * Index page
|
||||
/// * Redirect pages
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let compiler = self.compiler;
|
||||
let target = self.target;
|
||||
let name = self.name;
|
||||
@ -283,12 +279,12 @@ impl Step for TheBook {
|
||||
|
||||
// build the index page
|
||||
let index = format!("{}/index.md", name);
|
||||
build.info(&format!("Documenting book index ({})", target));
|
||||
builder.info(&format!("Documenting book index ({})", target));
|
||||
invoke_rustdoc(builder, compiler, target, &index);
|
||||
|
||||
// build the redirect pages
|
||||
build.info(&format!("Documenting book redirect pages ({})", target));
|
||||
for file in t!(fs::read_dir(build.src.join("src/doc/book/redirects"))) {
|
||||
builder.info(&format!("Documenting book redirect pages ({})", target));
|
||||
for file in t!(fs::read_dir(builder.src.join("src/doc/book/redirects"))) {
|
||||
let file = t!(file);
|
||||
let path = file.path();
|
||||
let path = path.to_str().unwrap();
|
||||
@ -299,13 +295,12 @@ impl Step for TheBook {
|
||||
}
|
||||
|
||||
fn invoke_rustdoc(builder: &Builder, compiler: Compiler, target: Interned<String>, markdown: &str) {
|
||||
let build = builder.build;
|
||||
let out = build.doc_out(target);
|
||||
let out = builder.doc_out(target);
|
||||
|
||||
let path = build.src.join("src/doc").join(markdown);
|
||||
let path = builder.src.join("src/doc").join(markdown);
|
||||
|
||||
let favicon = build.src.join("src/doc/favicon.inc");
|
||||
let footer = build.src.join("src/doc/footer.inc");
|
||||
let favicon = builder.src.join("src/doc/favicon.inc");
|
||||
let footer = builder.src.join("src/doc/footer.inc");
|
||||
let version_info = out.join("version_info.html");
|
||||
|
||||
let mut cmd = builder.rustdoc_cmd(compiler.host);
|
||||
@ -323,7 +318,7 @@ fn invoke_rustdoc(builder: &Builder, compiler: Compiler, target: Interned<String
|
||||
.arg("--markdown-css")
|
||||
.arg("../rust.css");
|
||||
|
||||
build.run(&mut cmd);
|
||||
builder.run(&mut cmd);
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||
@ -338,12 +333,12 @@ impl Step for Standalone {
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
let builder = run.builder;
|
||||
run.path("src/doc").default_condition(builder.build.config.docs)
|
||||
run.path("src/doc").default_condition(builder.config.docs)
|
||||
}
|
||||
|
||||
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.config.build),
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
@ -357,31 +352,30 @@ impl Step for Standalone {
|
||||
///
|
||||
/// In the end, this is just a glorified wrapper around rustdoc!
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let target = self.target;
|
||||
let compiler = self.compiler;
|
||||
build.info(&format!("Documenting standalone ({})", target));
|
||||
let out = build.doc_out(target);
|
||||
builder.info(&format!("Documenting standalone ({})", target));
|
||||
let out = builder.doc_out(target);
|
||||
t!(fs::create_dir_all(&out));
|
||||
|
||||
let favicon = build.src.join("src/doc/favicon.inc");
|
||||
let footer = build.src.join("src/doc/footer.inc");
|
||||
let full_toc = build.src.join("src/doc/full-toc.inc");
|
||||
t!(fs::copy(build.src.join("src/doc/rust.css"), out.join("rust.css")));
|
||||
let favicon = builder.src.join("src/doc/favicon.inc");
|
||||
let footer = builder.src.join("src/doc/footer.inc");
|
||||
let full_toc = builder.src.join("src/doc/full-toc.inc");
|
||||
t!(fs::copy(builder.src.join("src/doc/rust.css"), out.join("rust.css")));
|
||||
|
||||
let version_input = build.src.join("src/doc/version_info.html.template");
|
||||
let version_input = builder.src.join("src/doc/version_info.html.template");
|
||||
let version_info = out.join("version_info.html");
|
||||
|
||||
if !build.config.dry_run && !up_to_date(&version_input, &version_info) {
|
||||
if !builder.config.dry_run && !up_to_date(&version_input, &version_info) {
|
||||
let mut info = String::new();
|
||||
t!(t!(File::open(&version_input)).read_to_string(&mut info));
|
||||
let info = info.replace("VERSION", &build.rust_release())
|
||||
.replace("SHORT_HASH", build.rust_info.sha_short().unwrap_or(""))
|
||||
.replace("STAMP", build.rust_info.sha().unwrap_or(""));
|
||||
let info = info.replace("VERSION", &builder.rust_release())
|
||||
.replace("SHORT_HASH", builder.rust_info.sha_short().unwrap_or(""))
|
||||
.replace("STAMP", builder.rust_info.sha().unwrap_or(""));
|
||||
t!(t!(File::create(&version_info)).write_all(info.as_bytes()));
|
||||
}
|
||||
|
||||
for file in t!(fs::read_dir(build.src.join("src/doc"))) {
|
||||
for file in t!(fs::read_dir(builder.src.join("src/doc"))) {
|
||||
let file = t!(file);
|
||||
let path = file.path();
|
||||
let filename = path.file_name().unwrap().to_str().unwrap();
|
||||
@ -396,7 +390,7 @@ impl Step for Standalone {
|
||||
up_to_date(&favicon, &html) &&
|
||||
up_to_date(&full_toc, &html) &&
|
||||
up_to_date(&version_info, &html) &&
|
||||
(build.config.dry_run || up_to_date(&rustdoc, &html)) {
|
||||
(builder.config.dry_run || up_to_date(&rustdoc, &html)) {
|
||||
continue
|
||||
}
|
||||
|
||||
@ -416,7 +410,7 @@ impl Step for Standalone {
|
||||
} else {
|
||||
cmd.arg("--markdown-css").arg("rust.css");
|
||||
}
|
||||
build.run(&mut cmd);
|
||||
builder.run(&mut cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -433,7 +427,7 @@ impl Step for Std {
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
let builder = run.builder;
|
||||
run.all_krates("std").default_condition(builder.build.config.docs)
|
||||
run.all_krates("std").default_condition(builder.config.docs)
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig) {
|
||||
@ -448,22 +442,21 @@ impl Step for Std {
|
||||
/// This will generate all documentation for the standard library and its
|
||||
/// dependencies. This is largely just a wrapper around `cargo doc`.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let stage = self.stage;
|
||||
let target = self.target;
|
||||
build.info(&format!("Documenting stage{} std ({})", stage, target));
|
||||
let out = build.doc_out(target);
|
||||
builder.info(&format!("Documenting stage{} std ({})", stage, target));
|
||||
let out = builder.doc_out(target);
|
||||
t!(fs::create_dir_all(&out));
|
||||
let compiler = builder.compiler(stage, build.build);
|
||||
let compiler = builder.compiler(stage, builder.config.build);
|
||||
let rustdoc = builder.rustdoc(compiler.host);
|
||||
let compiler = if build.force_use_stage1(compiler, target) {
|
||||
let compiler = if builder.force_use_stage1(compiler, target) {
|
||||
builder.compiler(1, compiler.host)
|
||||
} else {
|
||||
compiler
|
||||
};
|
||||
|
||||
builder.ensure(compile::Std { compiler, target });
|
||||
let out_dir = build.stage_out(compiler, Mode::Libstd)
|
||||
let out_dir = builder.stage_out(compiler, Mode::Libstd)
|
||||
.join(target).join("doc");
|
||||
|
||||
// Here what we're doing is creating a *symlink* (directory junction on
|
||||
@ -479,9 +472,9 @@ impl Step for Std {
|
||||
//
|
||||
// This way rustdoc generates output directly into the output, and rustdoc
|
||||
// will also directly handle merging.
|
||||
let my_out = build.crate_doc_out(target);
|
||||
build.clear_if_dirty(&my_out, &rustdoc);
|
||||
t!(symlink_dir_force(&build.config, &my_out, &out_dir));
|
||||
let my_out = builder.crate_doc_out(target);
|
||||
builder.clear_if_dirty(&my_out, &rustdoc);
|
||||
t!(symlink_dir_force(&builder.config, &my_out, &out_dir));
|
||||
|
||||
let mut cargo = builder.cargo(compiler, Mode::Libstd, target, "doc");
|
||||
compile::std_cargo(builder, &compiler, target, &mut cargo);
|
||||
@ -497,8 +490,8 @@ impl Step for Std {
|
||||
t!(fs::create_dir_all(out_dir.join(krate)));
|
||||
}
|
||||
|
||||
build.run(&mut cargo);
|
||||
build.cp_r(&my_out, &out);
|
||||
builder.run(&mut cargo);
|
||||
builder.cp_r(&my_out, &out);
|
||||
}
|
||||
}
|
||||
|
||||
@ -514,7 +507,7 @@ impl Step for Test {
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
let builder = run.builder;
|
||||
run.krate("test").default_condition(builder.build.config.docs)
|
||||
run.krate("test").default_condition(builder.config.docs)
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig) {
|
||||
@ -529,15 +522,14 @@ impl Step for Test {
|
||||
/// This will generate all documentation for libtest and its dependencies. This
|
||||
/// is largely just a wrapper around `cargo doc`.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let stage = self.stage;
|
||||
let target = self.target;
|
||||
build.info(&format!("Documenting stage{} test ({})", stage, target));
|
||||
let out = build.doc_out(target);
|
||||
builder.info(&format!("Documenting stage{} test ({})", stage, target));
|
||||
let out = builder.doc_out(target);
|
||||
t!(fs::create_dir_all(&out));
|
||||
let compiler = builder.compiler(stage, build.build);
|
||||
let compiler = builder.compiler(stage, builder.config.build);
|
||||
let rustdoc = builder.rustdoc(compiler.host);
|
||||
let compiler = if build.force_use_stage1(compiler, target) {
|
||||
let compiler = if builder.force_use_stage1(compiler, target) {
|
||||
builder.compiler(1, compiler.host)
|
||||
} else {
|
||||
compiler
|
||||
@ -547,21 +539,21 @@ impl Step for Test {
|
||||
builder.ensure(Std { stage, target });
|
||||
|
||||
builder.ensure(compile::Test { compiler, target });
|
||||
let out_dir = build.stage_out(compiler, Mode::Libtest)
|
||||
let out_dir = builder.stage_out(compiler, Mode::Libtest)
|
||||
.join(target).join("doc");
|
||||
|
||||
// See docs in std above for why we symlink
|
||||
let my_out = build.crate_doc_out(target);
|
||||
build.clear_if_dirty(&my_out, &rustdoc);
|
||||
let my_out = builder.crate_doc_out(target);
|
||||
builder.clear_if_dirty(&my_out, &rustdoc);
|
||||
t!(symlink_dir_force(&builder.config, &my_out, &out_dir));
|
||||
|
||||
let mut cargo = builder.cargo(compiler, Mode::Libtest, target, "doc");
|
||||
compile::test_cargo(build, &compiler, target, &mut cargo);
|
||||
compile::test_cargo(builder, &compiler, target, &mut cargo);
|
||||
|
||||
cargo.arg("--no-deps").arg("-p").arg("test");
|
||||
|
||||
build.run(&mut cargo);
|
||||
build.cp_r(&my_out, &out);
|
||||
builder.run(&mut cargo);
|
||||
builder.cp_r(&my_out, &out);
|
||||
}
|
||||
}
|
||||
|
||||
@ -578,7 +570,7 @@ impl Step for WhitelistedRustc {
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
let builder = run.builder;
|
||||
run.krate("rustc-main").default_condition(builder.build.config.docs)
|
||||
run.krate("rustc-main").default_condition(builder.config.docs)
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig) {
|
||||
@ -598,15 +590,14 @@ impl Step for WhitelistedRustc {
|
||||
/// here as we want to be able to keep it separate from the standard
|
||||
/// documentation. This is largely just a wrapper around `cargo doc`.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let stage = self.stage;
|
||||
let target = self.target;
|
||||
build.info(&format!("Documenting stage{} whitelisted compiler ({})", stage, target));
|
||||
let out = build.doc_out(target);
|
||||
builder.info(&format!("Documenting stage{} whitelisted compiler ({})", stage, target));
|
||||
let out = builder.doc_out(target);
|
||||
t!(fs::create_dir_all(&out));
|
||||
let compiler = builder.compiler(stage, build.build);
|
||||
let compiler = builder.compiler(stage, builder.config.build);
|
||||
let rustdoc = builder.rustdoc(compiler.host);
|
||||
let compiler = if build.force_use_stage1(compiler, target) {
|
||||
let compiler = if builder.force_use_stage1(compiler, target) {
|
||||
builder.compiler(1, compiler.host)
|
||||
} else {
|
||||
compiler
|
||||
@ -616,16 +607,16 @@ impl Step for WhitelistedRustc {
|
||||
builder.ensure(Std { stage, target });
|
||||
|
||||
builder.ensure(compile::Rustc { compiler, target });
|
||||
let out_dir = build.stage_out(compiler, Mode::Librustc)
|
||||
let out_dir = builder.stage_out(compiler, Mode::Librustc)
|
||||
.join(target).join("doc");
|
||||
|
||||
// See docs in std above for why we symlink
|
||||
let my_out = build.crate_doc_out(target);
|
||||
build.clear_if_dirty(&my_out, &rustdoc);
|
||||
let my_out = builder.crate_doc_out(target);
|
||||
builder.clear_if_dirty(&my_out, &rustdoc);
|
||||
t!(symlink_dir_force(&builder.config, &my_out, &out_dir));
|
||||
|
||||
let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "doc");
|
||||
compile::rustc_cargo(build, &mut cargo);
|
||||
compile::rustc_cargo(builder, &mut cargo);
|
||||
|
||||
// We don't want to build docs for internal compiler dependencies in this
|
||||
// step (there is another step for that). Therefore, we whitelist the crates
|
||||
@ -635,8 +626,8 @@ impl Step for WhitelistedRustc {
|
||||
cargo.arg("-p").arg(krate);
|
||||
}
|
||||
|
||||
build.run(&mut cargo);
|
||||
build.cp_r(&my_out, &out);
|
||||
builder.run(&mut cargo);
|
||||
builder.cp_r(&my_out, &out);
|
||||
}
|
||||
}
|
||||
|
||||
@ -653,7 +644,7 @@ impl Step for Rustc {
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
let builder = run.builder;
|
||||
run.krate("rustc-main").default_condition(builder.build.config.docs)
|
||||
run.krate("rustc-main").default_condition(builder.config.docs)
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig) {
|
||||
@ -670,22 +661,21 @@ impl Step for Rustc {
|
||||
/// we do not merge it with the other documentation from std, test and
|
||||
/// proc_macros. This is largely just a wrapper around `cargo doc`.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let stage = self.stage;
|
||||
let target = self.target;
|
||||
build.info(&format!("Documenting stage{} compiler ({})", stage, target));
|
||||
let out = build.compiler_doc_out(target);
|
||||
builder.info(&format!("Documenting stage{} compiler ({})", stage, target));
|
||||
let out = builder.compiler_doc_out(target);
|
||||
t!(fs::create_dir_all(&out));
|
||||
let compiler = builder.compiler(stage, build.build);
|
||||
let compiler = builder.compiler(stage, builder.config.build);
|
||||
let rustdoc = builder.rustdoc(compiler.host);
|
||||
let compiler = if build.force_use_stage1(compiler, target) {
|
||||
let compiler = if builder.force_use_stage1(compiler, target) {
|
||||
builder.compiler(1, compiler.host)
|
||||
} else {
|
||||
compiler
|
||||
};
|
||||
|
||||
if !build.config.compiler_docs {
|
||||
build.info(&format!("\tskipping - compiler docs disabled"));
|
||||
if !builder.config.compiler_docs {
|
||||
builder.info(&format!("\tskipping - compiler docs disabled"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -693,16 +683,16 @@ impl Step for Rustc {
|
||||
builder.ensure(Std { stage, target });
|
||||
|
||||
builder.ensure(compile::Rustc { compiler, target });
|
||||
let out_dir = build.stage_out(compiler, Mode::Librustc)
|
||||
let out_dir = builder.stage_out(compiler, Mode::Librustc)
|
||||
.join(target).join("doc");
|
||||
// We do not symlink to the same shared folder that already contains std library
|
||||
// documentation from previous steps as we do not want to include that.
|
||||
build.clear_if_dirty(&out, &rustdoc);
|
||||
builder.clear_if_dirty(&out, &rustdoc);
|
||||
t!(symlink_dir_force(&builder.config, &out, &out_dir));
|
||||
|
||||
let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "doc");
|
||||
cargo.env("RUSTDOCFLAGS", "--document-private-items");
|
||||
compile::rustc_cargo(build, &mut cargo);
|
||||
compile::rustc_cargo(builder, &mut cargo);
|
||||
|
||||
// Only include compiler crates, no dependencies of those, such as `libc`.
|
||||
cargo.arg("--no-deps");
|
||||
@ -711,19 +701,19 @@ impl Step for Rustc {
|
||||
let mut compiler_crates = HashSet::new();
|
||||
for root_crate in &["rustc", "rustc_driver"] {
|
||||
let interned_root_crate = INTERNER.intern_str(root_crate);
|
||||
find_compiler_crates(&build, &interned_root_crate, &mut compiler_crates);
|
||||
find_compiler_crates(builder, &interned_root_crate, &mut compiler_crates);
|
||||
}
|
||||
|
||||
for krate in &compiler_crates {
|
||||
cargo.arg("-p").arg(krate);
|
||||
}
|
||||
|
||||
build.run(&mut cargo);
|
||||
builder.run(&mut cargo);
|
||||
}
|
||||
}
|
||||
|
||||
fn find_compiler_crates(
|
||||
build: &Build,
|
||||
builder: &Builder,
|
||||
name: &Interned<String>,
|
||||
crates: &mut HashSet<Interned<String>>
|
||||
) {
|
||||
@ -731,9 +721,9 @@ fn find_compiler_crates(
|
||||
crates.insert(*name);
|
||||
|
||||
// Look for dependencies.
|
||||
for dep in build.crates.get(name).unwrap().deps.iter() {
|
||||
if build.crates.get(dep).unwrap().is_local(build) {
|
||||
find_compiler_crates(build, dep, crates);
|
||||
for dep in builder.crates.get(name).unwrap().deps.iter() {
|
||||
if builder.crates.get(dep).unwrap().is_local(builder) {
|
||||
find_compiler_crates(builder, dep, crates);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -750,7 +740,7 @@ impl Step for ErrorIndex {
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
let builder = run.builder;
|
||||
run.path("src/tools/error_index_generator").default_condition(builder.build.config.docs)
|
||||
run.path("src/tools/error_index_generator").default_condition(builder.config.docs)
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig) {
|
||||
@ -762,21 +752,20 @@ impl Step for ErrorIndex {
|
||||
/// Generates the HTML rendered error-index by running the
|
||||
/// `error_index_generator` tool.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let target = self.target;
|
||||
|
||||
build.info(&format!("Documenting error index ({})", target));
|
||||
let out = build.doc_out(target);
|
||||
builder.info(&format!("Documenting error index ({})", target));
|
||||
let out = builder.doc_out(target);
|
||||
t!(fs::create_dir_all(&out));
|
||||
let mut index = builder.tool_cmd(Tool::ErrorIndex);
|
||||
index.arg("html");
|
||||
index.arg(out.join("error-index.html"));
|
||||
|
||||
// FIXME: shouldn't have to pass this env var
|
||||
index.env("CFG_BUILD", &build.build)
|
||||
.env("RUSTC_ERROR_METADATA_DST", build.extended_error_dir());
|
||||
index.env("CFG_BUILD", &builder.config.build)
|
||||
.env("RUSTC_ERROR_METADATA_DST", builder.extended_error_dir());
|
||||
|
||||
build.run(&mut index);
|
||||
builder.run(&mut index);
|
||||
}
|
||||
}
|
||||
|
||||
@ -792,7 +781,7 @@ impl Step for UnstableBookGen {
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
let builder = run.builder;
|
||||
run.path("src/tools/unstable-book-gen").default_condition(builder.build.config.docs)
|
||||
run.path("src/tools/unstable-book-gen").default_condition(builder.config.docs)
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig) {
|
||||
@ -802,23 +791,22 @@ impl Step for UnstableBookGen {
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let target = self.target;
|
||||
|
||||
builder.ensure(compile::Std {
|
||||
compiler: builder.compiler(builder.top_stage, build.build),
|
||||
compiler: builder.compiler(builder.top_stage, builder.config.build),
|
||||
target,
|
||||
});
|
||||
|
||||
build.info(&format!("Generating unstable book md files ({})", target));
|
||||
let out = build.md_doc_out(target).join("unstable-book");
|
||||
build.create_dir(&out);
|
||||
build.remove_dir(&out);
|
||||
builder.info(&format!("Generating unstable book md files ({})", target));
|
||||
let out = builder.md_doc_out(target).join("unstable-book");
|
||||
builder.create_dir(&out);
|
||||
builder.remove_dir(&out);
|
||||
let mut cmd = builder.tool_cmd(Tool::UnstableBookGen);
|
||||
cmd.arg(build.src.join("src"));
|
||||
cmd.arg(builder.src.join("src"));
|
||||
cmd.arg(out);
|
||||
|
||||
build.run(&mut cmd);
|
||||
builder.run(&mut cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,8 +62,7 @@ fn install_sh(
|
||||
stage: u32,
|
||||
host: Option<Interned<String>>
|
||||
) {
|
||||
let build = builder.build;
|
||||
build.info(&format!("Install {} stage{} ({:?})", package, stage, host));
|
||||
builder.info(&format!("Install {} stage{} ({:?})", package, stage, host));
|
||||
|
||||
let prefix_default = PathBuf::from("/usr/local");
|
||||
let sysconfdir_default = PathBuf::from("/etc");
|
||||
@ -72,15 +71,15 @@ fn install_sh(
|
||||
let bindir_default = PathBuf::from("bin");
|
||||
let libdir_default = PathBuf::from("lib");
|
||||
let mandir_default = datadir_default.join("man");
|
||||
let prefix = build.config.prefix.as_ref().map_or(prefix_default, |p| {
|
||||
let prefix = builder.config.prefix.as_ref().map_or(prefix_default, |p| {
|
||||
fs::canonicalize(p).expect(&format!("could not canonicalize {}", p.display()))
|
||||
});
|
||||
let sysconfdir = build.config.sysconfdir.as_ref().unwrap_or(&sysconfdir_default);
|
||||
let datadir = build.config.datadir.as_ref().unwrap_or(&datadir_default);
|
||||
let docdir = build.config.docdir.as_ref().unwrap_or(&docdir_default);
|
||||
let bindir = build.config.bindir.as_ref().unwrap_or(&bindir_default);
|
||||
let libdir = build.config.libdir.as_ref().unwrap_or(&libdir_default);
|
||||
let mandir = build.config.mandir.as_ref().unwrap_or(&mandir_default);
|
||||
let sysconfdir = builder.config.sysconfdir.as_ref().unwrap_or(&sysconfdir_default);
|
||||
let datadir = builder.config.datadir.as_ref().unwrap_or(&datadir_default);
|
||||
let docdir = builder.config.docdir.as_ref().unwrap_or(&docdir_default);
|
||||
let bindir = builder.config.bindir.as_ref().unwrap_or(&bindir_default);
|
||||
let libdir = builder.config.libdir.as_ref().unwrap_or(&libdir_default);
|
||||
let mandir = builder.config.mandir.as_ref().unwrap_or(&mandir_default);
|
||||
|
||||
let sysconfdir = prefix.join(sysconfdir);
|
||||
let datadir = prefix.join(datadir);
|
||||
@ -99,18 +98,18 @@ fn install_sh(
|
||||
let libdir = add_destdir(&libdir, &destdir);
|
||||
let mandir = add_destdir(&mandir, &destdir);
|
||||
|
||||
let empty_dir = build.out.join("tmp/empty_dir");
|
||||
let empty_dir = builder.out.join("tmp/empty_dir");
|
||||
|
||||
t!(fs::create_dir_all(&empty_dir));
|
||||
let package_name = if let Some(host) = host {
|
||||
format!("{}-{}", pkgname(build, name), host)
|
||||
format!("{}-{}", pkgname(builder, name), host)
|
||||
} else {
|
||||
pkgname(build, name)
|
||||
pkgname(builder, name)
|
||||
};
|
||||
|
||||
let mut cmd = Command::new("sh");
|
||||
cmd.current_dir(&empty_dir)
|
||||
.arg(sanitize_sh(&tmpdir(build).join(&package_name).join("install.sh")))
|
||||
.arg(sanitize_sh(&tmpdir(builder).join(&package_name).join("install.sh")))
|
||||
.arg(format!("--prefix={}", sanitize_sh(&prefix)))
|
||||
.arg(format!("--sysconfdir={}", sanitize_sh(&sysconfdir)))
|
||||
.arg(format!("--datadir={}", sanitize_sh(&datadir)))
|
||||
@ -119,7 +118,7 @@ fn install_sh(
|
||||
.arg(format!("--libdir={}", sanitize_sh(&libdir)))
|
||||
.arg(format!("--mandir={}", sanitize_sh(&mandir)))
|
||||
.arg("--disable-ldconfig");
|
||||
build.run(&mut cmd);
|
||||
builder.run(&mut cmd);
|
||||
t!(fs::remove_dir_all(&empty_dir));
|
||||
}
|
||||
|
||||
@ -180,7 +179,7 @@ macro_rules! install {
|
||||
run.builder.ensure($name {
|
||||
stage: run.builder.top_stage,
|
||||
target: run.target,
|
||||
host: run.builder.build.build,
|
||||
host: run.builder.config.build,
|
||||
});
|
||||
}
|
||||
|
||||
@ -197,7 +196,7 @@ install!((self, builder, _config),
|
||||
install_docs(builder, self.stage, self.target);
|
||||
};
|
||||
Std, "src/libstd", true, only_hosts: true, {
|
||||
for target in &builder.build.targets {
|
||||
for target in &builder.targets {
|
||||
builder.ensure(dist::Std {
|
||||
compiler: builder.compiler(self.stage, self.host),
|
||||
target: *target
|
||||
|
@ -29,7 +29,6 @@ use build_helper::output;
|
||||
use cmake;
|
||||
use cc;
|
||||
|
||||
use Build;
|
||||
use util::{self, exe};
|
||||
use build_helper::up_to_date;
|
||||
use builder::{Builder, RunConfig, ShouldRun, Step};
|
||||
@ -60,39 +59,38 @@ impl Step for Llvm {
|
||||
|
||||
/// Compile LLVM for `target`.
|
||||
fn run(self, builder: &Builder) -> PathBuf {
|
||||
let build = builder.build;
|
||||
let target = self.target;
|
||||
let emscripten = self.emscripten;
|
||||
|
||||
// If we're using a custom LLVM bail out here, but we can only use a
|
||||
// custom LLVM for the build triple.
|
||||
if !self.emscripten {
|
||||
if let Some(config) = build.config.target_config.get(&target) {
|
||||
if let Some(config) = builder.config.target_config.get(&target) {
|
||||
if let Some(ref s) = config.llvm_config {
|
||||
check_llvm_version(build, s);
|
||||
check_llvm_version(builder, s);
|
||||
return s.to_path_buf()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let rebuild_trigger = build.src.join("src/rustllvm/llvm-rebuild-trigger");
|
||||
let rebuild_trigger = builder.src.join("src/rustllvm/llvm-rebuild-trigger");
|
||||
let mut rebuild_trigger_contents = String::new();
|
||||
t!(t!(File::open(&rebuild_trigger)).read_to_string(&mut rebuild_trigger_contents));
|
||||
|
||||
let (out_dir, llvm_config_ret_dir) = if emscripten {
|
||||
let dir = build.emscripten_llvm_out(target);
|
||||
let dir = builder.emscripten_llvm_out(target);
|
||||
let config_dir = dir.join("bin");
|
||||
(dir, config_dir)
|
||||
} else {
|
||||
let mut dir = build.llvm_out(build.config.build);
|
||||
if !build.config.build.contains("msvc") || build.config.ninja {
|
||||
let mut dir = builder.llvm_out(builder.config.build);
|
||||
if !builder.config.build.contains("msvc") || builder.config.ninja {
|
||||
dir.push("build");
|
||||
}
|
||||
(build.llvm_out(target), dir.join("bin"))
|
||||
(builder.llvm_out(target), dir.join("bin"))
|
||||
};
|
||||
let done_stamp = out_dir.join("llvm-finished-building");
|
||||
let build_llvm_config = llvm_config_ret_dir
|
||||
.join(exe("llvm-config", &*build.config.build));
|
||||
.join(exe("llvm-config", &*builder.config.build));
|
||||
if done_stamp.exists() {
|
||||
let mut done_contents = String::new();
|
||||
t!(t!(File::open(&done_stamp)).read_to_string(&mut done_contents));
|
||||
@ -104,17 +102,17 @@ impl Step for Llvm {
|
||||
}
|
||||
}
|
||||
|
||||
let _folder = build.fold_output(|| "llvm");
|
||||
let _folder = builder.fold_output(|| "llvm");
|
||||
let descriptor = if emscripten { "Emscripten " } else { "" };
|
||||
build.info(&format!("Building {}LLVM for {}", descriptor, target));
|
||||
let _time = util::timeit(&build);
|
||||
builder.info(&format!("Building {}LLVM for {}", descriptor, target));
|
||||
let _time = util::timeit(&builder);
|
||||
t!(fs::create_dir_all(&out_dir));
|
||||
|
||||
// http://llvm.org/docs/CMake.html
|
||||
let root = if self.emscripten { "src/llvm-emscripten" } else { "src/llvm" };
|
||||
let mut cfg = cmake::Config::new(build.src.join(root));
|
||||
let mut cfg = cmake::Config::new(builder.src.join(root));
|
||||
|
||||
let profile = match (build.config.llvm_optimize, build.config.llvm_release_debuginfo) {
|
||||
let profile = match (builder.config.llvm_optimize, builder.config.llvm_release_debuginfo) {
|
||||
(false, _) => "Debug",
|
||||
(true, false) => "Release",
|
||||
(true, true) => "RelWithDebInfo",
|
||||
@ -125,7 +123,7 @@ impl Step for Llvm {
|
||||
let llvm_targets = if self.emscripten {
|
||||
"JSBackend"
|
||||
} else {
|
||||
match build.config.llvm_targets {
|
||||
match builder.config.llvm_targets {
|
||||
Some(ref s) => s,
|
||||
None => "X86;ARM;AArch64;Mips;PowerPC;SystemZ;MSP430;Sparc;NVPTX;Hexagon",
|
||||
}
|
||||
@ -134,10 +132,10 @@ impl Step for Llvm {
|
||||
let llvm_exp_targets = if self.emscripten {
|
||||
""
|
||||
} else {
|
||||
&build.config.llvm_experimental_targets[..]
|
||||
&builder.config.llvm_experimental_targets[..]
|
||||
};
|
||||
|
||||
let assertions = if build.config.llvm_assertions {"ON"} else {"OFF"};
|
||||
let assertions = if builder.config.llvm_assertions {"ON"} else {"OFF"};
|
||||
|
||||
cfg.out_dir(&out_dir)
|
||||
.profile(profile)
|
||||
@ -151,7 +149,7 @@ impl Step for Llvm {
|
||||
.define("WITH_POLLY", "OFF")
|
||||
.define("LLVM_ENABLE_TERMINFO", "OFF")
|
||||
.define("LLVM_ENABLE_LIBEDIT", "OFF")
|
||||
.define("LLVM_PARALLEL_COMPILE_JOBS", build.jobs().to_string())
|
||||
.define("LLVM_PARALLEL_COMPILE_JOBS", builder.jobs().to_string())
|
||||
.define("LLVM_TARGET_ARCH", target.split('-').next().unwrap())
|
||||
.define("LLVM_DEFAULT_TARGET_TRIPLE", target);
|
||||
|
||||
@ -183,22 +181,22 @@ impl Step for Llvm {
|
||||
cfg.define("LLVM_BUILD_32_BITS", "ON");
|
||||
}
|
||||
|
||||
if let Some(num_linkers) = build.config.llvm_link_jobs {
|
||||
if let Some(num_linkers) = builder.config.llvm_link_jobs {
|
||||
if num_linkers > 0 {
|
||||
cfg.define("LLVM_PARALLEL_LINK_JOBS", num_linkers.to_string());
|
||||
}
|
||||
}
|
||||
|
||||
// http://llvm.org/docs/HowToCrossCompileLLVM.html
|
||||
if target != build.build && !emscripten {
|
||||
if target != builder.config.build && !emscripten {
|
||||
builder.ensure(Llvm {
|
||||
target: build.build,
|
||||
target: builder.config.build,
|
||||
emscripten: false,
|
||||
});
|
||||
// FIXME: if the llvm root for the build triple is overridden then we
|
||||
// should use llvm-tblgen from there, also should verify that it
|
||||
// actually exists most of the time in normal installs of LLVM.
|
||||
let host = build.llvm_out(build.build).join("bin/llvm-tblgen");
|
||||
let host = builder.llvm_out(builder.config.build).join("bin/llvm-tblgen");
|
||||
cfg.define("CMAKE_CROSSCOMPILING", "True")
|
||||
.define("LLVM_TABLEGEN", &host);
|
||||
|
||||
@ -208,10 +206,10 @@ impl Step for Llvm {
|
||||
cfg.define("CMAKE_SYSTEM_NAME", "FreeBSD");
|
||||
}
|
||||
|
||||
cfg.define("LLVM_NATIVE_BUILD", build.llvm_out(build.build).join("build"));
|
||||
cfg.define("LLVM_NATIVE_BUILD", builder.llvm_out(builder.config.build).join("build"));
|
||||
}
|
||||
|
||||
configure_cmake(build, target, &mut cfg, false);
|
||||
configure_cmake(builder, target, &mut cfg, false);
|
||||
|
||||
// FIXME: we don't actually need to build all LLVM tools and all LLVM
|
||||
// libraries here, e.g. we just want a few components and a few
|
||||
@ -230,12 +228,12 @@ impl Step for Llvm {
|
||||
}
|
||||
}
|
||||
|
||||
fn check_llvm_version(build: &Build, llvm_config: &Path) {
|
||||
if !build.config.llvm_version_check {
|
||||
fn check_llvm_version(builder: &Builder, llvm_config: &Path) {
|
||||
if !builder.config.llvm_version_check {
|
||||
return
|
||||
}
|
||||
|
||||
if build.config.dry_run {
|
||||
if builder.config.dry_run {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -251,15 +249,15 @@ fn check_llvm_version(build: &Build, llvm_config: &Path) {
|
||||
panic!("\n\nbad LLVM version: {}, need >=3.9\n\n", version)
|
||||
}
|
||||
|
||||
fn configure_cmake(build: &Build,
|
||||
fn configure_cmake(builder: &Builder,
|
||||
target: Interned<String>,
|
||||
cfg: &mut cmake::Config,
|
||||
building_dist_binaries: bool) {
|
||||
if build.config.ninja {
|
||||
if builder.config.ninja {
|
||||
cfg.generator("Ninja");
|
||||
}
|
||||
cfg.target(&target)
|
||||
.host(&build.config.build);
|
||||
.host(&builder.config.build);
|
||||
|
||||
let sanitize_cc = |cc: &Path| {
|
||||
if target.contains("msvc") {
|
||||
@ -272,29 +270,29 @@ fn configure_cmake(build: &Build,
|
||||
// MSVC with CMake uses msbuild by default which doesn't respect these
|
||||
// vars that we'd otherwise configure. In that case we just skip this
|
||||
// entirely.
|
||||
if target.contains("msvc") && !build.config.ninja {
|
||||
if target.contains("msvc") && !builder.config.ninja {
|
||||
return
|
||||
}
|
||||
|
||||
let cc = build.cc(target);
|
||||
let cxx = build.cxx(target).unwrap();
|
||||
let cc = builder.cc(target);
|
||||
let cxx = builder.cxx(target).unwrap();
|
||||
|
||||
// Handle msvc + ninja + ccache specially (this is what the bots use)
|
||||
if target.contains("msvc") &&
|
||||
build.config.ninja &&
|
||||
build.config.ccache.is_some() {
|
||||
builder.config.ninja &&
|
||||
builder.config.ccache.is_some() {
|
||||
let mut cc = env::current_exe().expect("failed to get cwd");
|
||||
cc.set_file_name("sccache-plus-cl.exe");
|
||||
|
||||
cfg.define("CMAKE_C_COMPILER", sanitize_cc(&cc))
|
||||
.define("CMAKE_CXX_COMPILER", sanitize_cc(&cc));
|
||||
cfg.env("SCCACHE_PATH",
|
||||
build.config.ccache.as_ref().unwrap())
|
||||
builder.config.ccache.as_ref().unwrap())
|
||||
.env("SCCACHE_TARGET", target);
|
||||
|
||||
// If ccache is configured we inform the build a little differently hwo
|
||||
// to invoke ccache while also invoking our compilers.
|
||||
} else if let Some(ref ccache) = build.config.ccache {
|
||||
} else if let Some(ref ccache) = builder.config.ccache {
|
||||
cfg.define("CMAKE_C_COMPILER", ccache)
|
||||
.define("CMAKE_C_COMPILER_ARG1", sanitize_cc(cc))
|
||||
.define("CMAKE_CXX_COMPILER", ccache)
|
||||
@ -304,16 +302,16 @@ fn configure_cmake(build: &Build,
|
||||
.define("CMAKE_CXX_COMPILER", sanitize_cc(cxx));
|
||||
}
|
||||
|
||||
cfg.build_arg("-j").build_arg(build.jobs().to_string());
|
||||
cfg.define("CMAKE_C_FLAGS", build.cflags(target).join(" "));
|
||||
let mut cxxflags = build.cflags(target).join(" ");
|
||||
cfg.build_arg("-j").build_arg(builder.jobs().to_string());
|
||||
cfg.define("CMAKE_C_FLAGS", builder.cflags(target).join(" "));
|
||||
let mut cxxflags = builder.cflags(target).join(" ");
|
||||
if building_dist_binaries {
|
||||
if build.config.llvm_static_stdcpp && !target.contains("windows") {
|
||||
if builder.config.llvm_static_stdcpp && !target.contains("windows") {
|
||||
cxxflags.push_str(" -static-libstdc++");
|
||||
}
|
||||
}
|
||||
cfg.define("CMAKE_CXX_FLAGS", cxxflags);
|
||||
if let Some(ar) = build.ar(target) {
|
||||
if let Some(ar) = builder.ar(target) {
|
||||
if ar.is_absolute() {
|
||||
// LLVM build breaks if `CMAKE_AR` is a relative path, for some reason it
|
||||
// tries to resolve this path in the LLVM build directory.
|
||||
@ -349,26 +347,25 @@ impl Step for Lld {
|
||||
return PathBuf::from("lld-out-dir-test-gen");
|
||||
}
|
||||
let target = self.target;
|
||||
let build = builder.build;
|
||||
|
||||
let llvm_config = builder.ensure(Llvm {
|
||||
target: self.target,
|
||||
emscripten: false,
|
||||
});
|
||||
|
||||
let out_dir = build.lld_out(target);
|
||||
let out_dir = builder.lld_out(target);
|
||||
let done_stamp = out_dir.join("lld-finished-building");
|
||||
if done_stamp.exists() {
|
||||
return out_dir
|
||||
}
|
||||
|
||||
let _folder = build.fold_output(|| "lld");
|
||||
build.info(&format!("Building LLD for {}", target));
|
||||
let _time = util::timeit(&build);
|
||||
let _folder = builder.fold_output(|| "lld");
|
||||
builder.info(&format!("Building LLD for {}", target));
|
||||
let _time = util::timeit(&builder);
|
||||
t!(fs::create_dir_all(&out_dir));
|
||||
|
||||
let mut cfg = cmake::Config::new(build.src.join("src/tools/lld"));
|
||||
configure_cmake(build, target, &mut cfg, true);
|
||||
let mut cfg = cmake::Config::new(builder.src.join("src/tools/lld"));
|
||||
configure_cmake(builder, target, &mut cfg, true);
|
||||
|
||||
cfg.out_dir(&out_dir)
|
||||
.profile("Release")
|
||||
@ -404,16 +401,15 @@ impl Step for TestHelpers {
|
||||
if builder.config.dry_run {
|
||||
return;
|
||||
}
|
||||
let build = builder.build;
|
||||
let target = self.target;
|
||||
let dst = build.test_helpers_out(target);
|
||||
let src = build.src.join("src/test/auxiliary/rust_test_helpers.c");
|
||||
let dst = builder.test_helpers_out(target);
|
||||
let src = builder.src.join("src/test/auxiliary/rust_test_helpers.c");
|
||||
if up_to_date(&src, &dst.join("librust_test_helpers.a")) {
|
||||
return
|
||||
}
|
||||
|
||||
let _folder = build.fold_output(|| "build_test_helpers");
|
||||
build.info(&format!("Building test helpers"));
|
||||
let _folder = builder.fold_output(|| "build_test_helpers");
|
||||
builder.info(&format!("Building test helpers"));
|
||||
t!(fs::create_dir_all(&dst));
|
||||
let mut cfg = cc::Build::new();
|
||||
|
||||
@ -421,20 +417,20 @@ impl Step for TestHelpers {
|
||||
// extra configuration, so inform gcc of these compilers. Note, though, that
|
||||
// on MSVC we still need gcc's detection of env vars (ugh).
|
||||
if !target.contains("msvc") {
|
||||
if let Some(ar) = build.ar(target) {
|
||||
if let Some(ar) = builder.ar(target) {
|
||||
cfg.archiver(ar);
|
||||
}
|
||||
cfg.compiler(build.cc(target));
|
||||
cfg.compiler(builder.cc(target));
|
||||
}
|
||||
|
||||
cfg.cargo_metadata(false)
|
||||
.out_dir(&dst)
|
||||
.target(&target)
|
||||
.host(&build.build)
|
||||
.host(&builder.config.build)
|
||||
.opt_level(0)
|
||||
.warnings(false)
|
||||
.debug(false)
|
||||
.file(build.src.join("src/test/auxiliary/rust_test_helpers.c"))
|
||||
.file(builder.src.join("src/test/auxiliary/rust_test_helpers.c"))
|
||||
.compile("rust_test_helpers");
|
||||
}
|
||||
}
|
||||
@ -459,9 +455,8 @@ impl Step for Openssl {
|
||||
if builder.config.dry_run {
|
||||
return;
|
||||
}
|
||||
let build = builder.build;
|
||||
let target = self.target;
|
||||
let out = match build.openssl_dir(target) {
|
||||
let out = match builder.openssl_dir(target) {
|
||||
Some(dir) => dir,
|
||||
None => return,
|
||||
};
|
||||
@ -497,7 +492,8 @@ impl Step for Openssl {
|
||||
}
|
||||
|
||||
// Ensure the hash is correct.
|
||||
let mut shasum = if target.contains("apple") || build.build.contains("netbsd") {
|
||||
let mut shasum = if target.contains("apple") ||
|
||||
builder.config.build.contains("netbsd") {
|
||||
let mut cmd = Command::new("shasum");
|
||||
cmd.arg("-a").arg("256");
|
||||
cmd
|
||||
@ -530,10 +526,10 @@ impl Step for Openssl {
|
||||
t!(fs::rename(&tmp, &tarball));
|
||||
}
|
||||
let obj = out.join(format!("openssl-{}", OPENSSL_VERS));
|
||||
let dst = build.openssl_install_dir(target).unwrap();
|
||||
let dst = builder.openssl_install_dir(target).unwrap();
|
||||
drop(fs::remove_dir_all(&obj));
|
||||
drop(fs::remove_dir_all(&dst));
|
||||
build.run(Command::new("tar").arg("zxf").arg(&tarball).current_dir(&out));
|
||||
builder.run(Command::new("tar").arg("zxf").arg(&tarball).current_dir(&out));
|
||||
|
||||
let mut configure = Command::new("perl");
|
||||
configure.arg(obj.join("Configure"));
|
||||
@ -583,8 +579,8 @@ impl Step for Openssl {
|
||||
_ => panic!("don't know how to configure OpenSSL for {}", target),
|
||||
};
|
||||
configure.arg(os);
|
||||
configure.env("CC", build.cc(target));
|
||||
for flag in build.cflags(target) {
|
||||
configure.env("CC", builder.cc(target));
|
||||
for flag in builder.cflags(target) {
|
||||
configure.arg(flag);
|
||||
}
|
||||
// There is no specific os target for android aarch64 or x86_64,
|
||||
@ -596,7 +592,7 @@ impl Step for Openssl {
|
||||
if target == "sparc64-unknown-netbsd" {
|
||||
// Need -m64 to get assembly generated correctly for sparc64.
|
||||
configure.arg("-m64");
|
||||
if build.build.contains("netbsd") {
|
||||
if builder.config.build.contains("netbsd") {
|
||||
// Disable sparc64 asm on NetBSD builders, it uses
|
||||
// m4(1)'s -B flag, which NetBSD m4 does not support.
|
||||
configure.arg("no-asm");
|
||||
@ -609,12 +605,12 @@ impl Step for Openssl {
|
||||
configure.arg("no-asm");
|
||||
}
|
||||
configure.current_dir(&obj);
|
||||
build.info(&format!("Configuring openssl for {}", target));
|
||||
build.run_quiet(&mut configure);
|
||||
build.info(&format!("Building openssl for {}", target));
|
||||
build.run_quiet(Command::new("make").arg("-j1").current_dir(&obj));
|
||||
build.info(&format!("Installing openssl for {}", target));
|
||||
build.run_quiet(Command::new("make").arg("install").arg("-j1").current_dir(&obj));
|
||||
builder.info(&format!("Configuring openssl for {}", target));
|
||||
builder.run_quiet(&mut configure);
|
||||
builder.info(&format!("Building openssl for {}", target));
|
||||
builder.run_quiet(Command::new("make").arg("-j1").current_dir(&obj));
|
||||
builder.info(&format!("Installing openssl for {}", target));
|
||||
builder.run_quiet(Command::new("make").arg("install").arg("-j1").current_dir(&obj));
|
||||
|
||||
let mut f = t!(File::create(&stamp));
|
||||
t!(f.write_all(OPENSSL_VERS.as_bytes()));
|
||||
|
@ -32,7 +32,7 @@ use dist;
|
||||
use native;
|
||||
use tool::{self, Tool};
|
||||
use util::{self, dylib_path, dylib_path_var};
|
||||
use {Build, Mode};
|
||||
use Mode;
|
||||
use toolstate::ToolState;
|
||||
|
||||
const ADB_TEST_DIR: &str = "/data/tmp/work";
|
||||
@ -65,28 +65,28 @@ impl fmt::Display for TestKind {
|
||||
}
|
||||
}
|
||||
|
||||
fn try_run(build: &Build, cmd: &mut Command) -> bool {
|
||||
if !build.fail_fast {
|
||||
if !build.try_run(cmd) {
|
||||
let mut failures = build.delayed_failures.borrow_mut();
|
||||
fn try_run(builder: &Builder, cmd: &mut Command) -> bool {
|
||||
if !builder.fail_fast {
|
||||
if !builder.try_run(cmd) {
|
||||
let mut failures = builder.delayed_failures.borrow_mut();
|
||||
failures.push(format!("{:?}", cmd));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
build.run(cmd);
|
||||
builder.run(cmd);
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
fn try_run_quiet(build: &Build, cmd: &mut Command) -> bool {
|
||||
if !build.fail_fast {
|
||||
if !build.try_run_quiet(cmd) {
|
||||
let mut failures = build.delayed_failures.borrow_mut();
|
||||
fn try_run_quiet(builder: &Builder, cmd: &mut Command) -> bool {
|
||||
if !builder.fail_fast {
|
||||
if !builder.try_run_quiet(cmd) {
|
||||
let mut failures = builder.delayed_failures.borrow_mut();
|
||||
failures.push(format!("{:?}", cmd));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
build.run_quiet(cmd);
|
||||
builder.run_quiet(cmd);
|
||||
}
|
||||
true
|
||||
}
|
||||
@ -106,21 +106,20 @@ impl Step for Linkcheck {
|
||||
/// This tool in `src/tools` will verify the validity of all our links in the
|
||||
/// documentation to ensure we don't have a bunch of dead ones.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let host = self.host;
|
||||
|
||||
build.info(&format!("Linkcheck ({})", host));
|
||||
builder.info(&format!("Linkcheck ({})", host));
|
||||
|
||||
builder.default_doc(None);
|
||||
|
||||
let _time = util::timeit(&build);
|
||||
try_run(build, builder.tool_cmd(Tool::Linkchecker)
|
||||
.arg(build.out.join(host).join("doc")));
|
||||
let _time = util::timeit(&builder);
|
||||
try_run(builder, builder.tool_cmd(Tool::Linkchecker)
|
||||
.arg(builder.out.join(host).join("doc")));
|
||||
}
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
let builder = run.builder;
|
||||
run.path("src/tools/linkchecker").default_condition(builder.build.config.docs)
|
||||
run.path("src/tools/linkchecker").default_condition(builder.config.docs)
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig) {
|
||||
@ -154,19 +153,18 @@ impl Step for Cargotest {
|
||||
/// This tool in `src/tools` will check out a few Rust projects and run `cargo
|
||||
/// test` to ensure that we don't regress the test suites there.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let compiler = builder.compiler(self.stage, self.host);
|
||||
builder.ensure(compile::Rustc { compiler, target: compiler.host });
|
||||
|
||||
// Note that this is a short, cryptic, and not scoped directory name. This
|
||||
// is currently to minimize the length of path on Windows where we otherwise
|
||||
// quickly run into path name limit constraints.
|
||||
let out_dir = build.out.join("ct");
|
||||
let out_dir = builder.out.join("ct");
|
||||
t!(fs::create_dir_all(&out_dir));
|
||||
|
||||
let _time = util::timeit(&build);
|
||||
let _time = util::timeit(&builder);
|
||||
let mut cmd = builder.tool_cmd(Tool::CargoTest);
|
||||
try_run(build, cmd.arg(&build.initial_cargo)
|
||||
try_run(builder, cmd.arg(&builder.initial_cargo)
|
||||
.arg(&out_dir)
|
||||
.env("RUSTC", builder.rustc(compiler))
|
||||
.env("RUSTDOC", builder.rustdoc(compiler.host)));
|
||||
@ -196,13 +194,12 @@ impl Step for Cargo {
|
||||
|
||||
/// Runs `cargo test` for `cargo` packaged with Rust.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let compiler = builder.compiler(self.stage, self.host);
|
||||
|
||||
builder.ensure(tool::Cargo { compiler, target: self.host });
|
||||
let mut cargo = builder.cargo(compiler, Mode::Tool, self.host, "test");
|
||||
cargo.arg("--manifest-path").arg(build.src.join("src/tools/cargo/Cargo.toml"));
|
||||
if !build.fail_fast {
|
||||
cargo.arg("--manifest-path").arg(builder.src.join("src/tools/cargo/Cargo.toml"));
|
||||
if !builder.fail_fast {
|
||||
cargo.arg("--no-fail-fast");
|
||||
}
|
||||
|
||||
@ -213,7 +210,7 @@ impl Step for Cargo {
|
||||
// available.
|
||||
cargo.env("CFG_DISABLE_CROSS_TESTS", "1");
|
||||
|
||||
try_run(build, cargo.env("PATH", &path_for_cargo(builder, compiler)));
|
||||
try_run(builder, cargo.env("PATH", &path_for_cargo(builder, compiler)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,7 +237,6 @@ impl Step for Rls {
|
||||
|
||||
/// Runs `cargo test` for the rls.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let stage = self.stage;
|
||||
let host = self.host;
|
||||
let compiler = builder.compiler(stage, host);
|
||||
@ -257,8 +253,8 @@ impl Step for Rls {
|
||||
|
||||
builder.add_rustc_lib_path(compiler, &mut cargo);
|
||||
|
||||
if try_run(build, &mut cargo) {
|
||||
build.save_toolstate("rls", ToolState::TestPass);
|
||||
if try_run(builder, &mut cargo) {
|
||||
builder.save_toolstate("rls", ToolState::TestPass);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -286,7 +282,6 @@ impl Step for Rustfmt {
|
||||
|
||||
/// Runs `cargo test` for rustfmt.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let stage = self.stage;
|
||||
let host = self.host;
|
||||
let compiler = builder.compiler(stage, host);
|
||||
@ -303,8 +298,8 @@ impl Step for Rustfmt {
|
||||
|
||||
builder.add_rustc_lib_path(compiler, &mut cargo);
|
||||
|
||||
if try_run(build, &mut cargo) {
|
||||
build.save_toolstate("rustfmt", ToolState::TestPass);
|
||||
if try_run(builder, &mut cargo) {
|
||||
builder.save_toolstate("rustfmt", ToolState::TestPass);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -321,7 +316,7 @@ impl Step for Miri {
|
||||
const DEFAULT: bool = true;
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
let test_miri = run.builder.build.config.test_miri;
|
||||
let test_miri = run.builder.config.test_miri;
|
||||
run.path("src/tools/miri").default_condition(test_miri)
|
||||
}
|
||||
|
||||
@ -334,7 +329,6 @@ impl Step for Miri {
|
||||
|
||||
/// Runs `cargo test` for miri.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let stage = self.stage;
|
||||
let host = self.host;
|
||||
let compiler = builder.compiler(stage, host);
|
||||
@ -346,7 +340,7 @@ impl Step for Miri {
|
||||
});
|
||||
if let Some(miri) = miri {
|
||||
let mut cargo = builder.cargo(compiler, Mode::Tool, host, "test");
|
||||
cargo.arg("--manifest-path").arg(build.src.join("src/tools/miri/Cargo.toml"));
|
||||
cargo.arg("--manifest-path").arg(builder.src.join("src/tools/miri/Cargo.toml"));
|
||||
|
||||
// Don't build tests dynamically, just a pain to work with
|
||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
||||
@ -358,8 +352,8 @@ impl Step for Miri {
|
||||
|
||||
builder.add_rustc_lib_path(compiler, &mut cargo);
|
||||
|
||||
if try_run(build, &mut cargo) {
|
||||
build.save_toolstate("miri", ToolState::TestPass);
|
||||
if try_run(builder, &mut cargo) {
|
||||
builder.save_toolstate("miri", ToolState::TestPass);
|
||||
}
|
||||
} else {
|
||||
eprintln!("failed to test miri: could not build");
|
||||
@ -391,7 +385,6 @@ impl Step for Clippy {
|
||||
|
||||
/// Runs `cargo test` for clippy.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let stage = self.stage;
|
||||
let host = self.host;
|
||||
let compiler = builder.compiler(stage, host);
|
||||
@ -403,7 +396,7 @@ impl Step for Clippy {
|
||||
});
|
||||
if let Some(clippy) = clippy {
|
||||
let mut cargo = builder.cargo(compiler, Mode::Tool, host, "test");
|
||||
cargo.arg("--manifest-path").arg(build.src.join("src/tools/clippy/Cargo.toml"));
|
||||
cargo.arg("--manifest-path").arg(builder.src.join("src/tools/clippy/Cargo.toml"));
|
||||
|
||||
// Don't build tests dynamically, just a pain to work with
|
||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
||||
@ -418,8 +411,8 @@ impl Step for Clippy {
|
||||
|
||||
builder.add_rustc_lib_path(compiler, &mut cargo);
|
||||
|
||||
if try_run(build, &mut cargo) {
|
||||
build.save_toolstate("clippy-driver", ToolState::TestPass);
|
||||
if try_run(builder, &mut cargo) {
|
||||
builder.save_toolstate("clippy-driver", ToolState::TestPass);
|
||||
}
|
||||
} else {
|
||||
eprintln!("failed to test clippy: could not build");
|
||||
@ -466,14 +459,14 @@ impl Step for RustdocTheme {
|
||||
.env("RUSTC_STAGE", self.compiler.stage.to_string())
|
||||
.env("RUSTC_SYSROOT", builder.sysroot(self.compiler))
|
||||
.env("RUSTDOC_LIBDIR", builder.sysroot_libdir(self.compiler, self.compiler.host))
|
||||
.env("CFG_RELEASE_CHANNEL", &builder.build.config.channel)
|
||||
.env("CFG_RELEASE_CHANNEL", &builder.config.channel)
|
||||
.env("RUSTDOC_REAL", builder.rustdoc(self.compiler.host))
|
||||
.env("RUSTDOC_CRATE_VERSION", builder.build.rust_version())
|
||||
.env("RUSTDOC_CRATE_VERSION", builder.rust_version())
|
||||
.env("RUSTC_BOOTSTRAP", "1");
|
||||
if let Some(linker) = builder.build.linker(self.compiler.host) {
|
||||
if let Some(linker) = builder.linker(self.compiler.host) {
|
||||
cmd.env("RUSTC_TARGET_LINKER", linker);
|
||||
}
|
||||
try_run(builder.build, &mut cmd);
|
||||
try_run(builder, &mut cmd);
|
||||
}
|
||||
}
|
||||
|
||||
@ -563,21 +556,19 @@ impl Step for Tidy {
|
||||
/// otherwise just implements a few lint-like checks that are specific to the
|
||||
/// compiler itself.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
|
||||
let mut cmd = builder.tool_cmd(Tool::Tidy);
|
||||
cmd.arg(build.src.join("src"));
|
||||
cmd.arg(&build.initial_cargo);
|
||||
if !build.config.vendor {
|
||||
cmd.arg(builder.src.join("src"));
|
||||
cmd.arg(&builder.initial_cargo);
|
||||
if !builder.config.vendor {
|
||||
cmd.arg("--no-vendor");
|
||||
}
|
||||
if build.config.quiet_tests {
|
||||
if builder.config.quiet_tests {
|
||||
cmd.arg("--quiet");
|
||||
}
|
||||
|
||||
let _folder = build.fold_output(|| "tidy");
|
||||
let _folder = builder.fold_output(|| "tidy");
|
||||
builder.info(&format!("tidy check"));
|
||||
try_run(build, &mut cmd);
|
||||
try_run(builder, &mut cmd);
|
||||
}
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
@ -589,8 +580,8 @@ impl Step for Tidy {
|
||||
}
|
||||
}
|
||||
|
||||
fn testdir(build: &Build, host: Interned<String>) -> PathBuf {
|
||||
build.out.join(host).join("test")
|
||||
fn testdir(builder: &Builder, host: Interned<String>) -> PathBuf {
|
||||
builder.out.join(host).join("test")
|
||||
}
|
||||
|
||||
macro_rules! default_test {
|
||||
@ -828,25 +819,24 @@ impl Step for Compiletest {
|
||||
/// compiletest `mode` and `suite` arguments. For example `mode` can be
|
||||
/// "run-pass" or `suite` can be something like `debuginfo`.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let compiler = self.compiler;
|
||||
let target = self.target;
|
||||
let mode = self.mode;
|
||||
let suite = self.suite;
|
||||
|
||||
// Skip codegen tests if they aren't enabled in configuration.
|
||||
if !build.config.codegen_tests && suite == "codegen" {
|
||||
if !builder.config.codegen_tests && suite == "codegen" {
|
||||
return;
|
||||
}
|
||||
|
||||
if suite == "debuginfo" {
|
||||
// Skip debuginfo tests on MSVC
|
||||
if build.build.contains("msvc") {
|
||||
if builder.config.build.contains("msvc") {
|
||||
return;
|
||||
}
|
||||
|
||||
if mode == "debuginfo-XXX" {
|
||||
return if build.build.contains("apple") {
|
||||
return if builder.config.build.contains("apple") {
|
||||
builder.ensure(Compiletest {
|
||||
mode: "debuginfo-lldb",
|
||||
..self
|
||||
@ -895,15 +885,15 @@ impl Step for Compiletest {
|
||||
cmd.arg("--rustdoc-path").arg(builder.rustdoc(compiler.host));
|
||||
}
|
||||
|
||||
cmd.arg("--src-base").arg(build.src.join("src/test").join(suite));
|
||||
cmd.arg("--build-base").arg(testdir(build, compiler.host).join(suite));
|
||||
cmd.arg("--src-base").arg(builder.src.join("src/test").join(suite));
|
||||
cmd.arg("--build-base").arg(testdir(builder, compiler.host).join(suite));
|
||||
cmd.arg("--stage-id").arg(format!("stage{}-{}", compiler.stage, target));
|
||||
cmd.arg("--mode").arg(mode);
|
||||
cmd.arg("--target").arg(target);
|
||||
cmd.arg("--host").arg(&*compiler.host);
|
||||
cmd.arg("--llvm-filecheck").arg(build.llvm_filecheck(build.build));
|
||||
cmd.arg("--llvm-filecheck").arg(builder.llvm_filecheck(builder.config.build));
|
||||
|
||||
if let Some(ref nodejs) = build.config.nodejs {
|
||||
if let Some(ref nodejs) = builder.config.nodejs {
|
||||
cmd.arg("--nodejs").arg(nodejs);
|
||||
}
|
||||
|
||||
@ -913,17 +903,17 @@ impl Step for Compiletest {
|
||||
vec!["-Crpath".to_string()]
|
||||
};
|
||||
if !is_rustdoc_ui {
|
||||
if build.config.rust_optimize_tests {
|
||||
if builder.config.rust_optimize_tests {
|
||||
flags.push("-O".to_string());
|
||||
}
|
||||
if build.config.rust_debuginfo_tests {
|
||||
if builder.config.rust_debuginfo_tests {
|
||||
flags.push("-g".to_string());
|
||||
}
|
||||
}
|
||||
flags.push("-Zunstable-options".to_string());
|
||||
flags.push(build.config.cmd.rustc_args().join(" "));
|
||||
flags.push(builder.config.cmd.rustc_args().join(" "));
|
||||
|
||||
if let Some(linker) = build.linker(target) {
|
||||
if let Some(linker) = builder.linker(target) {
|
||||
cmd.arg("--linker").arg(linker);
|
||||
}
|
||||
|
||||
@ -932,69 +922,69 @@ impl Step for Compiletest {
|
||||
|
||||
let mut targetflags = flags.clone();
|
||||
targetflags.push(format!("-Lnative={}",
|
||||
build.test_helpers_out(target).display()));
|
||||
builder.test_helpers_out(target).display()));
|
||||
cmd.arg("--target-rustcflags").arg(targetflags.join(" "));
|
||||
|
||||
cmd.arg("--docck-python").arg(build.python());
|
||||
cmd.arg("--docck-python").arg(builder.python());
|
||||
|
||||
if build.build.ends_with("apple-darwin") {
|
||||
if builder.config.build.ends_with("apple-darwin") {
|
||||
// Force /usr/bin/python on macOS for LLDB tests because we're loading the
|
||||
// LLDB plugin's compiled module which only works with the system python
|
||||
// (namely not Homebrew-installed python)
|
||||
cmd.arg("--lldb-python").arg("/usr/bin/python");
|
||||
} else {
|
||||
cmd.arg("--lldb-python").arg(build.python());
|
||||
cmd.arg("--lldb-python").arg(builder.python());
|
||||
}
|
||||
|
||||
if let Some(ref gdb) = build.config.gdb {
|
||||
if let Some(ref gdb) = builder.config.gdb {
|
||||
cmd.arg("--gdb").arg(gdb);
|
||||
}
|
||||
if let Some(ref vers) = build.lldb_version {
|
||||
if let Some(ref vers) = builder.lldb_version {
|
||||
cmd.arg("--lldb-version").arg(vers);
|
||||
}
|
||||
if let Some(ref dir) = build.lldb_python_dir {
|
||||
if let Some(ref dir) = builder.lldb_python_dir {
|
||||
cmd.arg("--lldb-python-dir").arg(dir);
|
||||
}
|
||||
|
||||
cmd.args(&build.config.cmd.test_args());
|
||||
cmd.args(&builder.config.cmd.test_args());
|
||||
|
||||
if build.is_verbose() {
|
||||
if builder.is_verbose() {
|
||||
cmd.arg("--verbose");
|
||||
}
|
||||
|
||||
if build.config.quiet_tests {
|
||||
if builder.config.quiet_tests {
|
||||
cmd.arg("--quiet");
|
||||
}
|
||||
|
||||
if build.config.llvm_enabled {
|
||||
if builder.config.llvm_enabled {
|
||||
let llvm_config = builder.ensure(native::Llvm {
|
||||
target: build.config.build,
|
||||
target: builder.config.build,
|
||||
emscripten: false,
|
||||
});
|
||||
if !build.config.dry_run {
|
||||
if !builder.config.dry_run {
|
||||
let llvm_version = output(Command::new(&llvm_config).arg("--version"));
|
||||
cmd.arg("--llvm-version").arg(llvm_version);
|
||||
}
|
||||
if !build.is_rust_llvm(target) {
|
||||
if !builder.is_rust_llvm(target) {
|
||||
cmd.arg("--system-llvm");
|
||||
}
|
||||
|
||||
// Only pass correct values for these flags for the `run-make` suite as it
|
||||
// requires that a C++ compiler was configured which isn't always the case.
|
||||
if !build.config.dry_run && suite == "run-make-fulldeps" {
|
||||
if !builder.config.dry_run && suite == "run-make-fulldeps" {
|
||||
let llvm_components = output(Command::new(&llvm_config).arg("--components"));
|
||||
let llvm_cxxflags = output(Command::new(&llvm_config).arg("--cxxflags"));
|
||||
cmd.arg("--cc").arg(build.cc(target))
|
||||
.arg("--cxx").arg(build.cxx(target).unwrap())
|
||||
.arg("--cflags").arg(build.cflags(target).join(" "))
|
||||
cmd.arg("--cc").arg(builder.cc(target))
|
||||
.arg("--cxx").arg(builder.cxx(target).unwrap())
|
||||
.arg("--cflags").arg(builder.cflags(target).join(" "))
|
||||
.arg("--llvm-components").arg(llvm_components.trim())
|
||||
.arg("--llvm-cxxflags").arg(llvm_cxxflags.trim());
|
||||
if let Some(ar) = build.ar(target) {
|
||||
if let Some(ar) = builder.ar(target) {
|
||||
cmd.arg("--ar").arg(ar);
|
||||
}
|
||||
}
|
||||
}
|
||||
if suite == "run-make-fulldeps" && !build.config.llvm_enabled {
|
||||
if suite == "run-make-fulldeps" && !builder.config.llvm_enabled {
|
||||
builder.info(
|
||||
&format!("Ignoring run-make test suite as they generally don't work without LLVM"));
|
||||
return;
|
||||
@ -1008,7 +998,7 @@ impl Step for Compiletest {
|
||||
.arg("--llvm-cxxflags").arg("");
|
||||
}
|
||||
|
||||
if build.remote_tested(target) {
|
||||
if builder.remote_tested(target) {
|
||||
cmd.arg("--remote-test-client").arg(builder.tool_exe(Tool::RemoteTestClient));
|
||||
}
|
||||
|
||||
@ -1018,42 +1008,42 @@ impl Step for Compiletest {
|
||||
// Note that if we encounter `PATH` we make sure to append to our own `PATH`
|
||||
// rather than stomp over it.
|
||||
if target.contains("msvc") {
|
||||
for &(ref k, ref v) in build.cc[&target].env() {
|
||||
for &(ref k, ref v) in builder.cc[&target].env() {
|
||||
if k != "PATH" {
|
||||
cmd.env(k, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
cmd.env("RUSTC_BOOTSTRAP", "1");
|
||||
build.add_rust_test_threads(&mut cmd);
|
||||
builder.add_rust_test_threads(&mut cmd);
|
||||
|
||||
if build.config.sanitizers {
|
||||
if builder.config.sanitizers {
|
||||
cmd.env("SANITIZER_SUPPORT", "1");
|
||||
}
|
||||
|
||||
if build.config.profiler {
|
||||
if builder.config.profiler {
|
||||
cmd.env("PROFILER_SUPPORT", "1");
|
||||
}
|
||||
|
||||
cmd.env("RUST_TEST_TMPDIR", build.out.join("tmp"));
|
||||
cmd.env("RUST_TEST_TMPDIR", builder.out.join("tmp"));
|
||||
|
||||
cmd.arg("--adb-path").arg("adb");
|
||||
cmd.arg("--adb-test-dir").arg(ADB_TEST_DIR);
|
||||
if target.contains("android") {
|
||||
// Assume that cc for this target comes from the android sysroot
|
||||
cmd.arg("--android-cross-path")
|
||||
.arg(build.cc(target).parent().unwrap().parent().unwrap());
|
||||
.arg(builder.cc(target).parent().unwrap().parent().unwrap());
|
||||
} else {
|
||||
cmd.arg("--android-cross-path").arg("");
|
||||
}
|
||||
|
||||
build.ci_env.force_coloring_in_ci(&mut cmd);
|
||||
builder.ci_env.force_coloring_in_ci(&mut cmd);
|
||||
|
||||
let _folder = build.fold_output(|| format!("test_{}", suite));
|
||||
let _folder = builder.fold_output(|| format!("test_{}", suite));
|
||||
builder.info(&format!("Check compiletest suite={} mode={} ({} -> {})",
|
||||
suite, mode, &compiler.host, target));
|
||||
let _time = util::timeit(&build);
|
||||
try_run(build, &mut cmd);
|
||||
let _time = util::timeit(&builder);
|
||||
try_run(builder, &mut cmd);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1079,16 +1069,15 @@ impl Step for DocTest {
|
||||
/// located in `src/doc`. The `rustdoc` that's run is the one that sits next to
|
||||
/// `compiler`.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let compiler = self.compiler;
|
||||
|
||||
builder.ensure(compile::Test { compiler, target: compiler.host });
|
||||
|
||||
// Do a breadth-first traversal of the `src/doc` directory and just run
|
||||
// tests for all files that end in `*.md`
|
||||
let mut stack = vec![build.src.join(self.path)];
|
||||
let _time = util::timeit(&build);
|
||||
let _folder = build.fold_output(|| format!("test_{}", self.name));
|
||||
let mut stack = vec![builder.src.join(self.path)];
|
||||
let _time = util::timeit(&builder);
|
||||
let _folder = builder.fold_output(|| format!("test_{}", self.name));
|
||||
|
||||
let mut files = Vec::new();
|
||||
while let Some(p) = stack.pop() {
|
||||
@ -1102,7 +1091,7 @@ impl Step for DocTest {
|
||||
}
|
||||
|
||||
// The nostarch directory in the book is for no starch, and so isn't
|
||||
// guaranteed to build. We don't care if it doesn't build, so skip it.
|
||||
// guaranteed to builder. We don't care if it doesn't build, so skip it.
|
||||
if p.to_str().map_or(false, |p| p.contains("nostarch")) {
|
||||
continue;
|
||||
}
|
||||
@ -1120,7 +1109,7 @@ impl Step for DocTest {
|
||||
} else {
|
||||
ToolState::TestFail
|
||||
};
|
||||
build.save_toolstate(self.name, toolstate);
|
||||
builder.save_toolstate(self.name, toolstate);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1198,32 +1187,30 @@ impl Step for ErrorIndex {
|
||||
/// generate a markdown file from the error indexes of the code base which is
|
||||
/// then passed to `rustdoc --test`.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let compiler = self.compiler;
|
||||
|
||||
builder.ensure(compile::Std { compiler, target: compiler.host });
|
||||
|
||||
let dir = testdir(build, compiler.host);
|
||||
let dir = testdir(builder, compiler.host);
|
||||
t!(fs::create_dir_all(&dir));
|
||||
let output = dir.join("error-index.md");
|
||||
|
||||
let mut tool = builder.tool_cmd(Tool::ErrorIndex);
|
||||
tool.arg("markdown")
|
||||
.arg(&output)
|
||||
.env("CFG_BUILD", &build.build)
|
||||
.env("RUSTC_ERROR_METADATA_DST", build.extended_error_dir());
|
||||
.env("CFG_BUILD", &builder.config.build)
|
||||
.env("RUSTC_ERROR_METADATA_DST", builder.extended_error_dir());
|
||||
|
||||
|
||||
let _folder = build.fold_output(|| "test_error_index");
|
||||
build.info(&format!("Testing error-index stage{}", compiler.stage));
|
||||
let _time = util::timeit(&build);
|
||||
build.run(&mut tool);
|
||||
let _folder = builder.fold_output(|| "test_error_index");
|
||||
builder.info(&format!("Testing error-index stage{}", compiler.stage));
|
||||
let _time = util::timeit(&builder);
|
||||
builder.run(&mut tool);
|
||||
markdown_test(builder, compiler, &output);
|
||||
}
|
||||
}
|
||||
|
||||
fn markdown_test(builder: &Builder, compiler: Compiler, markdown: &Path) -> bool {
|
||||
let build = builder.build;
|
||||
match File::open(markdown) {
|
||||
Ok(mut file) => {
|
||||
let mut contents = String::new();
|
||||
@ -1235,20 +1222,20 @@ fn markdown_test(builder: &Builder, compiler: Compiler, markdown: &Path) -> bool
|
||||
Err(_) => {},
|
||||
}
|
||||
|
||||
build.info(&format!("doc tests for: {}", markdown.display()));
|
||||
builder.info(&format!("doc tests for: {}", markdown.display()));
|
||||
let mut cmd = builder.rustdoc_cmd(compiler.host);
|
||||
build.add_rust_test_threads(&mut cmd);
|
||||
builder.add_rust_test_threads(&mut cmd);
|
||||
cmd.arg("--test");
|
||||
cmd.arg(markdown);
|
||||
cmd.env("RUSTC_BOOTSTRAP", "1");
|
||||
|
||||
let test_args = build.config.cmd.test_args().join(" ");
|
||||
let test_args = builder.config.cmd.test_args().join(" ");
|
||||
cmd.arg("--test-args").arg(test_args);
|
||||
|
||||
if build.config.quiet_tests {
|
||||
try_run_quiet(build, &mut cmd)
|
||||
if builder.config.quiet_tests {
|
||||
try_run_quiet(builder, &mut cmd)
|
||||
} else {
|
||||
try_run(build, &mut cmd)
|
||||
try_run(builder, &mut cmd)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1432,7 +1419,6 @@ impl Step for Crate {
|
||||
/// Currently this runs all tests for a DAG by passing a bunch of `-p foo`
|
||||
/// arguments, and those arguments are discovered from `cargo metadata`.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let compiler = self.compiler;
|
||||
let target = self.target;
|
||||
let mode = self.mode;
|
||||
@ -1446,7 +1432,7 @@ impl Step for Crate {
|
||||
// libstd, then what we're actually testing is the libstd produced in
|
||||
// stage1. Reflect that here by updating the compiler that we're working
|
||||
// with automatically.
|
||||
let compiler = if build.force_use_stage1(compiler, target) {
|
||||
let compiler = if builder.force_use_stage1(compiler, target) {
|
||||
builder.compiler(1, compiler.host)
|
||||
} else {
|
||||
compiler.clone()
|
||||
@ -1458,11 +1444,11 @@ impl Step for Crate {
|
||||
compile::std_cargo(builder, &compiler, target, &mut cargo);
|
||||
}
|
||||
Mode::Libtest => {
|
||||
compile::test_cargo(build, &compiler, target, &mut cargo);
|
||||
compile::test_cargo(builder, &compiler, target, &mut cargo);
|
||||
}
|
||||
Mode::Librustc => {
|
||||
builder.ensure(compile::Rustc { compiler, target });
|
||||
compile::rustc_cargo(build, &mut cargo);
|
||||
compile::rustc_cargo(builder, &mut cargo);
|
||||
}
|
||||
_ => panic!("can only test libraries"),
|
||||
};
|
||||
@ -1472,10 +1458,10 @@ impl Step for Crate {
|
||||
// Pass in some standard flags then iterate over the graph we've discovered
|
||||
// in `cargo metadata` with the maps above and figure out what `-p`
|
||||
// arguments need to get passed.
|
||||
if test_kind.subcommand() == "test" && !build.fail_fast {
|
||||
if test_kind.subcommand() == "test" && !builder.fail_fast {
|
||||
cargo.arg("--no-fail-fast");
|
||||
}
|
||||
if build.doc_tests {
|
||||
if builder.doc_tests {
|
||||
cargo.arg("--doc");
|
||||
}
|
||||
|
||||
@ -1491,21 +1477,21 @@ impl Step for Crate {
|
||||
cargo.env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());
|
||||
|
||||
cargo.arg("--");
|
||||
cargo.args(&build.config.cmd.test_args());
|
||||
cargo.args(&builder.config.cmd.test_args());
|
||||
|
||||
if build.config.quiet_tests {
|
||||
if builder.config.quiet_tests {
|
||||
cargo.arg("--quiet");
|
||||
}
|
||||
|
||||
if target.contains("emscripten") {
|
||||
cargo.env(format!("CARGO_TARGET_{}_RUNNER", envify(&target)),
|
||||
build.config.nodejs.as_ref().expect("nodejs not configured"));
|
||||
builder.config.nodejs.as_ref().expect("nodejs not configured"));
|
||||
} else if target.starts_with("wasm32") {
|
||||
// Warn about running tests without the `wasm_syscall` feature enabled.
|
||||
// The javascript shim implements the syscall interface so that test
|
||||
// output can be correctly reported.
|
||||
if !build.config.wasm_syscall {
|
||||
build.info(&format!("Libstd was built without `wasm_syscall` feature enabled: \
|
||||
if !builder.config.wasm_syscall {
|
||||
builder.info(&format!("Libstd was built without `wasm_syscall` feature enabled: \
|
||||
test output may not be visible."));
|
||||
}
|
||||
|
||||
@ -1513,25 +1499,25 @@ impl Step for Crate {
|
||||
// incompatible with `-C prefer-dynamic`, so disable that here
|
||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
||||
|
||||
let node = build.config.nodejs.as_ref()
|
||||
let node = builder.config.nodejs.as_ref()
|
||||
.expect("nodejs not configured");
|
||||
let runner = format!("{} {}/src/etc/wasm32-shim.js",
|
||||
node.display(),
|
||||
build.src.display());
|
||||
builder.src.display());
|
||||
cargo.env(format!("CARGO_TARGET_{}_RUNNER", envify(&target)), &runner);
|
||||
} else if build.remote_tested(target) {
|
||||
} else if builder.remote_tested(target) {
|
||||
cargo.env(format!("CARGO_TARGET_{}_RUNNER", envify(&target)),
|
||||
format!("{} run",
|
||||
builder.tool_exe(Tool::RemoteTestClient).display()));
|
||||
}
|
||||
|
||||
let _folder = build.fold_output(|| {
|
||||
let _folder = builder.fold_output(|| {
|
||||
format!("{}_stage{}-{}", test_kind.subcommand(), compiler.stage, krate)
|
||||
});
|
||||
build.info(&format!("{} {} stage{} ({} -> {})", test_kind, krate, compiler.stage,
|
||||
builder.info(&format!("{} {} stage{} ({} -> {})", test_kind, krate, compiler.stage,
|
||||
&compiler.host, target));
|
||||
let _time = util::timeit(&build);
|
||||
try_run(build, &mut cargo);
|
||||
let _time = util::timeit(&builder);
|
||||
try_run(builder, &mut cargo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1568,7 +1554,6 @@ impl Step for CrateRustdoc {
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let test_kind = self.test_kind;
|
||||
|
||||
let compiler = builder.compiler(builder.top_stage, self.host);
|
||||
@ -1579,27 +1564,27 @@ impl Step for CrateRustdoc {
|
||||
target,
|
||||
test_kind.subcommand(),
|
||||
"src/tools/rustdoc");
|
||||
if test_kind.subcommand() == "test" && !build.fail_fast {
|
||||
if test_kind.subcommand() == "test" && !builder.fail_fast {
|
||||
cargo.arg("--no-fail-fast");
|
||||
}
|
||||
|
||||
cargo.arg("-p").arg("rustdoc:0.0.0");
|
||||
|
||||
cargo.arg("--");
|
||||
cargo.args(&build.config.cmd.test_args());
|
||||
cargo.args(&builder.config.cmd.test_args());
|
||||
|
||||
if build.config.quiet_tests {
|
||||
if builder.config.quiet_tests {
|
||||
cargo.arg("--quiet");
|
||||
}
|
||||
|
||||
let _folder = build.fold_output(|| {
|
||||
let _folder = builder.fold_output(|| {
|
||||
format!("{}_stage{}-rustdoc", test_kind.subcommand(), compiler.stage)
|
||||
});
|
||||
build.info(&format!("{} rustdoc stage{} ({} -> {})", test_kind, compiler.stage,
|
||||
builder.info(&format!("{} rustdoc stage{} ({} -> {})", test_kind, compiler.stage,
|
||||
&compiler.host, target));
|
||||
let _time = util::timeit(&build);
|
||||
let _time = util::timeit(&builder);
|
||||
|
||||
try_run(build, &mut cargo);
|
||||
try_run(builder, &mut cargo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1635,17 +1620,16 @@ impl Step for RemoteCopyLibs {
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let compiler = self.compiler;
|
||||
let target = self.target;
|
||||
if !build.remote_tested(target) {
|
||||
if !builder.remote_tested(target) {
|
||||
return
|
||||
}
|
||||
|
||||
builder.ensure(compile::Test { compiler, target });
|
||||
|
||||
build.info(&format!("REMOTE copy libs to emulator ({})", target));
|
||||
t!(fs::create_dir_all(build.out.join("tmp")));
|
||||
builder.info(&format!("REMOTE copy libs to emulator ({})", target));
|
||||
t!(fs::create_dir_all(builder.out.join("tmp")));
|
||||
|
||||
let server = builder.ensure(tool::RemoteTestServer { compiler, target });
|
||||
|
||||
@ -1655,18 +1639,18 @@ impl Step for RemoteCopyLibs {
|
||||
cmd.arg("spawn-emulator")
|
||||
.arg(target)
|
||||
.arg(&server)
|
||||
.arg(build.out.join("tmp"));
|
||||
if let Some(rootfs) = build.qemu_rootfs(target) {
|
||||
.arg(builder.out.join("tmp"));
|
||||
if let Some(rootfs) = builder.qemu_rootfs(target) {
|
||||
cmd.arg(rootfs);
|
||||
}
|
||||
build.run(&mut cmd);
|
||||
builder.run(&mut cmd);
|
||||
|
||||
// Push all our dylibs to the emulator
|
||||
for f in t!(builder.sysroot_libdir(compiler, target).read_dir()) {
|
||||
let f = t!(f);
|
||||
let name = f.file_name().into_string().unwrap();
|
||||
if util::is_dylib(&name) {
|
||||
build.run(Command::new(&tool)
|
||||
builder.run(Command::new(&tool)
|
||||
.arg("push")
|
||||
.arg(f.path()));
|
||||
}
|
||||
@ -1690,10 +1674,8 @@ impl Step for Distcheck {
|
||||
|
||||
/// Run "distcheck", a 'make check' from a tarball
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
|
||||
build.info(&format!("Distcheck"));
|
||||
let dir = build.out.join("tmp").join("distcheck");
|
||||
builder.info(&format!("Distcheck"));
|
||||
let dir = builder.out.join("tmp").join("distcheck");
|
||||
let _ = fs::remove_dir_all(&dir);
|
||||
t!(fs::create_dir_all(&dir));
|
||||
|
||||
@ -1706,18 +1688,18 @@ impl Step for Distcheck {
|
||||
.arg(builder.ensure(dist::PlainSourceTarball))
|
||||
.arg("--strip-components=1")
|
||||
.current_dir(&dir);
|
||||
build.run(&mut cmd);
|
||||
build.run(Command::new("./configure")
|
||||
.args(&build.config.configure_args)
|
||||
builder.run(&mut cmd);
|
||||
builder.run(Command::new("./configure")
|
||||
.args(&builder.config.configure_args)
|
||||
.arg("--enable-vendor")
|
||||
.current_dir(&dir));
|
||||
build.run(Command::new(build_helper::make(&build.build))
|
||||
builder.run(Command::new(build_helper::make(&builder.config.build))
|
||||
.arg("check")
|
||||
.current_dir(&dir));
|
||||
|
||||
// Now make sure that rust-src has all of libstd's dependencies
|
||||
build.info(&format!("Distcheck rust-src"));
|
||||
let dir = build.out.join("tmp").join("distcheck-src");
|
||||
builder.info(&format!("Distcheck rust-src"));
|
||||
let dir = builder.out.join("tmp").join("distcheck-src");
|
||||
let _ = fs::remove_dir_all(&dir);
|
||||
t!(fs::create_dir_all(&dir));
|
||||
|
||||
@ -1726,10 +1708,10 @@ impl Step for Distcheck {
|
||||
.arg(builder.ensure(dist::Src))
|
||||
.arg("--strip-components=1")
|
||||
.current_dir(&dir);
|
||||
build.run(&mut cmd);
|
||||
builder.run(&mut cmd);
|
||||
|
||||
let toml = dir.join("rust-src/lib/rustlib/src/rust/src/libstd/Cargo.toml");
|
||||
build.run(Command::new(&build.initial_cargo)
|
||||
builder.run(Command::new(&builder.initial_cargo)
|
||||
.arg("generate-lockfile")
|
||||
.arg("--manifest-path")
|
||||
.arg(&toml)
|
||||
@ -1747,25 +1729,24 @@ impl Step for Bootstrap {
|
||||
|
||||
/// Test the build system itself
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let mut cmd = Command::new(&build.initial_cargo);
|
||||
let mut cmd = Command::new(&builder.initial_cargo);
|
||||
cmd.arg("test")
|
||||
.current_dir(build.src.join("src/bootstrap"))
|
||||
.current_dir(builder.src.join("src/bootstrap"))
|
||||
.env("RUSTFLAGS", "-Cdebuginfo=2")
|
||||
.env("CARGO_TARGET_DIR", build.out.join("bootstrap"))
|
||||
.env("CARGO_TARGET_DIR", builder.out.join("bootstrap"))
|
||||
.env("RUSTC_BOOTSTRAP", "1")
|
||||
.env("RUSTC", &build.initial_rustc);
|
||||
.env("RUSTC", &builder.initial_rustc);
|
||||
if let Some(flags) = option_env!("RUSTFLAGS") {
|
||||
// Use the same rustc flags for testing as for "normal" compilation,
|
||||
// so that Cargo doesn’t recompile the entire dependency graph every time:
|
||||
// https://github.com/rust-lang/rust/issues/49215
|
||||
cmd.env("RUSTFLAGS", flags);
|
||||
}
|
||||
if !build.fail_fast {
|
||||
if !builder.fail_fast {
|
||||
cmd.arg("--no-fail-fast");
|
||||
}
|
||||
cmd.arg("--").args(&build.config.cmd.test_args());
|
||||
try_run(build, &mut cmd);
|
||||
cmd.arg("--").args(&builder.config.cmd.test_args());
|
||||
try_run(builder, &mut cmd);
|
||||
}
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
|
@ -38,7 +38,6 @@ impl Step for CleanTools {
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let compiler = self.compiler;
|
||||
let target = self.target;
|
||||
let mode = self.mode;
|
||||
@ -46,7 +45,7 @@ impl Step for CleanTools {
|
||||
// This is for the original compiler, but if we're forced to use stage 1, then
|
||||
// std/test/rustc stamps won't exist in stage 2, so we need to get those from stage 1, since
|
||||
// we copy the libs forward.
|
||||
let tools_dir = build.stage_out(compiler, Mode::Tool);
|
||||
let tools_dir = builder.stage_out(compiler, Mode::Tool);
|
||||
let compiler = if builder.force_use_stage1(compiler, target) {
|
||||
builder.compiler(1, compiler.host)
|
||||
} else {
|
||||
@ -55,13 +54,13 @@ impl Step for CleanTools {
|
||||
|
||||
for &cur_mode in &[Mode::Libstd, Mode::Libtest, Mode::Librustc] {
|
||||
let stamp = match cur_mode {
|
||||
Mode::Libstd => libstd_stamp(build, compiler, target),
|
||||
Mode::Libtest => libtest_stamp(build, compiler, target),
|
||||
Mode::Librustc => librustc_stamp(build, compiler, target),
|
||||
Mode::Libstd => libstd_stamp(builder, compiler, target),
|
||||
Mode::Libtest => libtest_stamp(builder, compiler, target),
|
||||
Mode::Librustc => librustc_stamp(builder, compiler, target),
|
||||
_ => panic!(),
|
||||
};
|
||||
|
||||
if build.clear_if_dirty(&tools_dir, &stamp) {
|
||||
if builder.clear_if_dirty(&tools_dir, &stamp) {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -97,7 +96,6 @@ impl Step for ToolBuild {
|
||||
/// This will build the specified tool with the specified `host` compiler in
|
||||
/// `stage` into the normal cargo output directory.
|
||||
fn run(self, builder: &Builder) -> Option<PathBuf> {
|
||||
let build = builder.build;
|
||||
let compiler = self.compiler;
|
||||
let target = self.target;
|
||||
let tool = self.tool;
|
||||
@ -114,10 +112,10 @@ impl Step for ToolBuild {
|
||||
let mut cargo = prepare_tool_cargo(builder, compiler, target, "build", path);
|
||||
cargo.arg("--features").arg(self.extra_features.join(" "));
|
||||
|
||||
let _folder = build.fold_output(|| format!("stage{}-{}", compiler.stage, tool));
|
||||
build.info(&format!("Building stage{} tool {} ({})", compiler.stage, tool, target));
|
||||
let _folder = builder.fold_output(|| format!("stage{}-{}", compiler.stage, tool));
|
||||
builder.info(&format!("Building stage{} tool {} ({})", compiler.stage, tool, target));
|
||||
let mut duplicates = Vec::new();
|
||||
let is_expected = compile::stream_cargo(build, &mut cargo, &mut |msg| {
|
||||
let is_expected = compile::stream_cargo(builder, &mut cargo, &mut |msg| {
|
||||
// Only care about big things like the RLS/Cargo for now
|
||||
if tool != "rls" && tool != "cargo" {
|
||||
return
|
||||
@ -156,7 +154,7 @@ impl Step for ToolBuild {
|
||||
}
|
||||
}
|
||||
|
||||
let mut artifacts = build.tool_artifacts.borrow_mut();
|
||||
let mut artifacts = builder.tool_artifacts.borrow_mut();
|
||||
let prev_artifacts = artifacts
|
||||
.entry(target)
|
||||
.or_insert_with(Default::default);
|
||||
@ -190,7 +188,7 @@ impl Step for ToolBuild {
|
||||
panic!("tools should not compile multiple copies of the same crate");
|
||||
}
|
||||
|
||||
build.save_toolstate(tool, if is_expected {
|
||||
builder.save_toolstate(tool, if is_expected {
|
||||
ToolState::TestFail
|
||||
} else {
|
||||
ToolState::BuildFail
|
||||
@ -203,10 +201,10 @@ impl Step for ToolBuild {
|
||||
return None;
|
||||
}
|
||||
} else {
|
||||
let cargo_out = build.cargo_out(compiler, Mode::Tool, target)
|
||||
let cargo_out = builder.cargo_out(compiler, Mode::Tool, target)
|
||||
.join(exe(tool, &compiler.host));
|
||||
let bin = build.tools_dir(compiler).join(exe(tool, &compiler.host));
|
||||
build.copy(&cargo_out, &bin);
|
||||
let bin = builder.tools_dir(compiler).join(exe(tool, &compiler.host));
|
||||
builder.copy(&cargo_out, &bin);
|
||||
Some(bin)
|
||||
}
|
||||
}
|
||||
@ -219,16 +217,15 @@ pub fn prepare_tool_cargo(
|
||||
command: &'static str,
|
||||
path: &'static str,
|
||||
) -> Command {
|
||||
let build = builder.build;
|
||||
let mut cargo = builder.cargo(compiler, Mode::Tool, target, command);
|
||||
let dir = build.src.join(path);
|
||||
let dir = builder.src.join(path);
|
||||
cargo.arg("--manifest-path").arg(dir.join("Cargo.toml"));
|
||||
|
||||
// We don't want to build tools dynamically as they'll be running across
|
||||
// stages and such and it's just easier if they're not dynamically linked.
|
||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
||||
|
||||
if let Some(dir) = build.openssl_install_dir(target) {
|
||||
if let Some(dir) = builder.openssl_install_dir(target) {
|
||||
cargo.env("OPENSSL_STATIC", "1");
|
||||
cargo.env("OPENSSL_DIR", dir);
|
||||
cargo.env("LIBZ_SYS_STATIC", "1");
|
||||
@ -238,10 +235,10 @@ pub fn prepare_tool_cargo(
|
||||
// own copy
|
||||
cargo.env("LZMA_API_STATIC", "1");
|
||||
|
||||
cargo.env("CFG_RELEASE_CHANNEL", &build.config.channel);
|
||||
cargo.env("CFG_VERSION", build.rust_version());
|
||||
cargo.env("CFG_RELEASE_CHANNEL", &builder.config.channel);
|
||||
cargo.env("CFG_VERSION", builder.rust_version());
|
||||
|
||||
let info = GitInfo::new(&build.config, &dir);
|
||||
let info = GitInfo::new(&builder.config, &dir);
|
||||
if let Some(sha) = info.sha() {
|
||||
cargo.env("CFG_COMMIT_HASH", sha);
|
||||
}
|
||||
@ -269,8 +266,8 @@ macro_rules! tool {
|
||||
match tool {
|
||||
$(Tool::$name =>
|
||||
self.ensure($name {
|
||||
compiler: self.compiler(stage, self.build.build),
|
||||
target: self.build.build,
|
||||
compiler: self.compiler(stage, self.config.build),
|
||||
target: self.config.build,
|
||||
}),
|
||||
)+
|
||||
}
|
||||
@ -304,7 +301,7 @@ macro_rules! tool {
|
||||
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure($name {
|
||||
compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.build),
|
||||
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
@ -354,7 +351,7 @@ impl Step for RemoteTestServer {
|
||||
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(RemoteTestServer {
|
||||
compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.build),
|
||||
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
@ -393,26 +390,25 @@ impl Step for Rustdoc {
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder) -> PathBuf {
|
||||
let build = builder.build;
|
||||
let target_compiler = builder.compiler(builder.top_stage, self.host);
|
||||
let target = target_compiler.host;
|
||||
let build_compiler = if target_compiler.stage == 0 {
|
||||
builder.compiler(0, builder.build.build)
|
||||
builder.compiler(0, builder.config.build)
|
||||
} else if target_compiler.stage >= 2 {
|
||||
// Past stage 2, we consider the compiler to be ABI-compatible and hence capable of
|
||||
// building rustdoc itself.
|
||||
builder.compiler(target_compiler.stage, builder.build.build)
|
||||
builder.compiler(target_compiler.stage, builder.config.build)
|
||||
} else {
|
||||
// Similar to `compile::Assemble`, build with the previous stage's compiler. Otherwise
|
||||
// we'd have stageN/bin/rustc and stageN/bin/rustdoc be effectively different stage
|
||||
// compilers, which isn't what we want.
|
||||
builder.compiler(target_compiler.stage - 1, builder.build.build)
|
||||
builder.compiler(target_compiler.stage - 1, builder.config.build)
|
||||
};
|
||||
|
||||
builder.ensure(compile::Rustc { compiler: build_compiler, target });
|
||||
builder.ensure(compile::Rustc {
|
||||
compiler: build_compiler,
|
||||
target: builder.build.build,
|
||||
target: builder.config.build,
|
||||
});
|
||||
|
||||
let mut cargo = prepare_tool_cargo(builder,
|
||||
@ -425,15 +421,15 @@ impl Step for Rustdoc {
|
||||
cargo.env("RUSTC_DEBUGINFO", builder.config.rust_debuginfo.to_string())
|
||||
.env("RUSTC_DEBUGINFO_LINES", builder.config.rust_debuginfo_lines.to_string());
|
||||
|
||||
let _folder = build.fold_output(|| format!("stage{}-rustdoc", target_compiler.stage));
|
||||
build.info(&format!("Building rustdoc for stage{} ({})",
|
||||
let _folder = builder.fold_output(|| format!("stage{}-rustdoc", target_compiler.stage));
|
||||
builder.info(&format!("Building rustdoc for stage{} ({})",
|
||||
target_compiler.stage, target_compiler.host));
|
||||
build.run(&mut cargo);
|
||||
builder.run(&mut cargo);
|
||||
|
||||
// Cargo adds a number of paths to the dylib search path on windows, which results in
|
||||
// the wrong rustdoc being executed. To avoid the conflicting rustdocs, we name the "tool"
|
||||
// rustdoc a different name.
|
||||
let tool_rustdoc = build.cargo_out(build_compiler, Mode::Tool, target)
|
||||
let tool_rustdoc = builder.cargo_out(build_compiler, Mode::Tool, target)
|
||||
.join(exe("rustdoc-tool-binary", &target_compiler.host));
|
||||
|
||||
// don't create a stage0-sysroot/bin directory.
|
||||
@ -443,7 +439,7 @@ impl Step for Rustdoc {
|
||||
t!(fs::create_dir_all(&bindir));
|
||||
let bin_rustdoc = bindir.join(exe("rustdoc", &*target_compiler.host));
|
||||
let _ = fs::remove_file(&bin_rustdoc);
|
||||
build.copy(&tool_rustdoc, &bin_rustdoc);
|
||||
builder.copy(&tool_rustdoc, &bin_rustdoc);
|
||||
bin_rustdoc
|
||||
} else {
|
||||
tool_rustdoc
|
||||
@ -464,12 +460,12 @@ impl Step for Cargo {
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
let builder = run.builder;
|
||||
run.path("src/tools/cargo").default_condition(builder.build.config.extended)
|
||||
run.path("src/tools/cargo").default_condition(builder.config.extended)
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Cargo {
|
||||
compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.build),
|
||||
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
@ -482,7 +478,7 @@ impl Step for Cargo {
|
||||
// compiler to be available, so we need to depend on that.
|
||||
builder.ensure(compile::Rustc {
|
||||
compiler: self.compiler,
|
||||
target: builder.build.build,
|
||||
target: builder.config.build,
|
||||
});
|
||||
builder.ensure(ToolBuild {
|
||||
compiler: self.compiler,
|
||||
@ -518,12 +514,12 @@ macro_rules! tool_extended {
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
let builder = run.builder;
|
||||
run.path($path).default_condition(builder.build.config.extended)
|
||||
run.path($path).default_condition(builder.config.extended)
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure($name {
|
||||
compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.build),
|
||||
compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
|
||||
target: run.target,
|
||||
extra_features: Vec::new(),
|
||||
});
|
||||
@ -554,7 +550,7 @@ tool_extended!((self, builder),
|
||||
// compiler to be available, so we need to depend on that.
|
||||
builder.ensure(compile::Rustc {
|
||||
compiler: self.compiler,
|
||||
target: builder.build.build,
|
||||
target: builder.config.build,
|
||||
});
|
||||
};
|
||||
Miri, miri, "src/tools/miri", "miri", {};
|
||||
@ -575,7 +571,7 @@ tool_extended!((self, builder),
|
||||
// compiler to be available, so we need to depend on that.
|
||||
builder.ensure(compile::Rustc {
|
||||
compiler: self.compiler,
|
||||
target: builder.build.build,
|
||||
target: builder.config.build,
|
||||
});
|
||||
};
|
||||
Rustfmt, rustfmt, "src/tools/rustfmt", "rustfmt", {};
|
||||
@ -586,7 +582,7 @@ impl<'a> Builder<'a> {
|
||||
/// `host`.
|
||||
pub fn tool_cmd(&self, tool: Tool) -> Command {
|
||||
let mut cmd = Command::new(self.tool_exe(tool));
|
||||
let compiler = self.compiler(self.tool_default_stage(tool), self.build.build);
|
||||
let compiler = self.compiler(self.tool_default_stage(tool), self.config.build);
|
||||
self.prepare_tool_cmd(compiler, &mut cmd);
|
||||
cmd
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ use std::process::Command;
|
||||
use std::time::{SystemTime, Instant};
|
||||
|
||||
use config::Config;
|
||||
use Build;
|
||||
use builder::Builder;
|
||||
|
||||
/// Returns the `name` as the filename of a static library for `target`.
|
||||
pub fn staticlib(name: &str, target: &str) -> String {
|
||||
@ -104,8 +104,8 @@ pub fn push_exe_path(mut buf: PathBuf, components: &[&str]) -> PathBuf {
|
||||
pub struct TimeIt(bool, Instant);
|
||||
|
||||
/// Returns an RAII structure that prints out how long it took to drop.
|
||||
pub fn timeit(build: &Build) -> TimeIt {
|
||||
TimeIt(build.config.dry_run, Instant::now())
|
||||
pub fn timeit(builder: &Builder) -> TimeIt {
|
||||
TimeIt(builder.config.dry_run, Instant::now())
|
||||
}
|
||||
|
||||
impl Drop for TimeIt {
|
||||
|
Loading…
Reference in New Issue
Block a user