mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-04 20:54:13 +00:00
Finish fixing warnings and errors. Bootstrap builds.
This commit is contained in:
parent
7db49fb467
commit
c114fe576f
@ -187,22 +187,6 @@ impl<'a> Builder<'a> {
|
||||
self.ensure(compile::Assemble { target_compiler: Compiler { stage, host } })
|
||||
}
|
||||
|
||||
pub fn rustc(&self, compiler: Compiler) -> PathBuf {
|
||||
if compiler.is_snapshot(self) {
|
||||
self.build.initial_rustc.clone()
|
||||
} else {
|
||||
self.compiler(compiler.stage, compiler.host);
|
||||
self.sysroot(compiler).join("bin").join(exe("rustc", compiler.host))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn rustdoc(&self, compiler: Compiler) -> PathBuf {
|
||||
let mut rustdoc = self.rustc(compiler);
|
||||
rustdoc.pop();
|
||||
rustdoc.push(exe("rustdoc", compiler.host));
|
||||
rustdoc
|
||||
}
|
||||
|
||||
pub fn sysroot(&self, compiler: Compiler<'a>) -> PathBuf {
|
||||
self.ensure(compile::Sysroot { compiler })
|
||||
}
|
||||
@ -254,6 +238,23 @@ impl<'a> Builder<'a> {
|
||||
add_lib_path(vec![self.rustc_libdir(compiler)], cmd);
|
||||
}
|
||||
|
||||
/// Get a path to the compiler specified.
|
||||
pub fn rustc(&self, compiler: Compiler) -> PathBuf {
|
||||
if compiler.is_snapshot(self) {
|
||||
self.initial_rustc.clone()
|
||||
} else {
|
||||
self.sysroot(compiler).join("bin").join(exe("rustc", compiler.host))
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the `rustdoc` executable next to the specified compiler
|
||||
pub fn rustdoc(&self, compiler: Compiler) -> PathBuf {
|
||||
let mut rustdoc = self.rustc(compiler);
|
||||
rustdoc.pop();
|
||||
rustdoc.push(exe("rustdoc", compiler.host));
|
||||
rustdoc
|
||||
}
|
||||
|
||||
/// Prepares an invocation of `cargo` to be run.
|
||||
///
|
||||
/// This will create a `Command` that represents a pending execution of
|
||||
@ -261,7 +262,7 @@ impl<'a> Builder<'a> {
|
||||
/// rustc compiler, its output will be scoped by `mode`'s output directory,
|
||||
/// it will pass the `--target` flag for the specified `target`, and will be
|
||||
/// executing the Cargo command `cmd`.
|
||||
fn cargo(&self,
|
||||
pub fn cargo(&self,
|
||||
compiler: Compiler,
|
||||
mode: Mode,
|
||||
target: &str,
|
||||
@ -293,7 +294,7 @@ impl<'a> Builder<'a> {
|
||||
// src/bootstrap/bin/{rustc.rs,rustdoc.rs}
|
||||
cargo.env("RUSTBUILD_NATIVE_DIR", self.native_dir(target))
|
||||
.env("RUSTC", self.out.join("bootstrap/debug/rustc"))
|
||||
.env("RUSTC_REAL", self.compiler_path(compiler))
|
||||
.env("RUSTC_REAL", self.rustc(compiler))
|
||||
.env("RUSTC_STAGE", stage.to_string())
|
||||
.env("RUSTC_CODEGEN_UNITS",
|
||||
self.config.rust_codegen_units.to_string())
|
||||
@ -353,7 +354,7 @@ impl<'a> Builder<'a> {
|
||||
cargo.env("RUSTC_SNAPSHOT", &self.initial_rustc)
|
||||
.env("RUSTC_SNAPSHOT_LIBDIR", self.rustc_snapshot_libdir());
|
||||
} else {
|
||||
cargo.env("RUSTC_SNAPSHOT", self.compiler_path(compiler))
|
||||
cargo.env("RUSTC_SNAPSHOT", self.rustc(compiler))
|
||||
.env("RUSTC_SNAPSHOT_LIBDIR", self.rustc_libdir(compiler));
|
||||
}
|
||||
|
||||
|
@ -170,8 +170,8 @@ impl<'a> Step<'a> for Cargotest<'a> {
|
||||
let mut cmd = builder.tool_cmd(Tool::CargoTest);
|
||||
try_run(build, cmd.arg(&build.initial_cargo)
|
||||
.arg(&out_dir)
|
||||
.env("RUSTC", build.compiler_path(compiler))
|
||||
.env("RUSTDOC", build.rustdoc(compiler)));
|
||||
.env("RUSTC", builder.rustc(compiler))
|
||||
.env("RUSTDOC", builder.rustdoc(compiler)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ impl<'a> Step<'a> for Cargo<'a> {
|
||||
iter::once(path).chain(env::split_paths(&old_path))
|
||||
).expect("");
|
||||
|
||||
let mut cargo = build.cargo(compiler, Mode::Tool, self.host, "test");
|
||||
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("--no-fail-fast");
|
||||
@ -584,10 +584,10 @@ impl<'a> Step<'a> for Compiletest<'a> {
|
||||
// compiletest currently has... a lot of arguments, so let's just pass all
|
||||
// of them!
|
||||
|
||||
cmd.arg("--compile-lib-path").arg(build.rustc_libdir(compiler));
|
||||
cmd.arg("--compile-lib-path").arg(builder.rustc_libdir(compiler));
|
||||
cmd.arg("--run-lib-path").arg(builder.sysroot_libdir(compiler, target));
|
||||
cmd.arg("--rustc-path").arg(build.compiler_path(compiler));
|
||||
cmd.arg("--rustdoc-path").arg(build.rustdoc(compiler));
|
||||
cmd.arg("--rustc-path").arg(builder.rustc(compiler));
|
||||
cmd.arg("--rustdoc-path").arg(builder.rustdoc(compiler));
|
||||
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("--stage-id").arg(format!("stage{}-{}", compiler.stage, target));
|
||||
@ -806,11 +806,12 @@ impl<'a> Step<'a> for ErrorIndex<'a> {
|
||||
.arg(&output)
|
||||
.env("CFG_BUILD", &build.build));
|
||||
|
||||
markdown_test(build, compiler, &output);
|
||||
markdown_test(builder, compiler, &output);
|
||||
}
|
||||
}
|
||||
|
||||
fn markdown_test(build: &Build, compiler: Compiler, markdown: &Path) {
|
||||
fn markdown_test(builder: &Builder, compiler: Compiler, markdown: &Path) {
|
||||
let build = builder.build;
|
||||
let mut file = t!(File::open(markdown));
|
||||
let mut contents = String::new();
|
||||
t!(file.read_to_string(&mut contents));
|
||||
@ -819,8 +820,8 @@ fn markdown_test(build: &Build, compiler: Compiler, markdown: &Path) {
|
||||
}
|
||||
|
||||
println!("doc tests for: {}", markdown.display());
|
||||
let mut cmd = Command::new(build.rustdoc(compiler));
|
||||
build.add_rustc_lib_path(compiler, &mut cmd);
|
||||
let mut cmd = Command::new(builder.rustdoc(compiler));
|
||||
builder.add_rustc_lib_path(compiler, &mut cmd);
|
||||
build.add_rust_test_threads(&mut cmd);
|
||||
cmd.arg("--test");
|
||||
cmd.arg(markdown);
|
||||
@ -1071,7 +1072,7 @@ impl<'a> Step<'a> for Krate<'a> {
|
||||
// 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.
|
||||
let mut cargo = build.cargo(compiler, mode, target, test_kind.subcommand());
|
||||
let mut cargo = builder.cargo(compiler, mode, target, test_kind.subcommand());
|
||||
cargo.arg("--manifest-path")
|
||||
.arg(build.src.join(path).join("Cargo.toml"))
|
||||
.arg("--features").arg(features);
|
||||
|
@ -196,7 +196,7 @@ impl<'a> Step<'a> for Std<'a> {
|
||||
compiler.host, target);
|
||||
|
||||
let out_dir = build.cargo_out(compiler, Mode::Libstd, target);
|
||||
build.clear_if_dirty(&out_dir, &build.compiler_path(compiler));
|
||||
build.clear_if_dirty(&out_dir, &builder.rustc(compiler));
|
||||
let mut cargo = builder.cargo(compiler, Mode::Libstd, target, "build");
|
||||
let mut features = build.std_features();
|
||||
|
||||
@ -365,7 +365,7 @@ impl<'a> Step<'a> for StartupObjects<'a> {
|
||||
}
|
||||
|
||||
let compiler = builder.compiler(0, &build.build);
|
||||
let compiler_path = build.compiler_path(compiler);
|
||||
let compiler_path = builder.rustc(compiler);
|
||||
let src_dir = &build.src.join("src/rtstartup");
|
||||
let dst_dir = &build.native_dir(target).join("rtstartup");
|
||||
let sysroot_dir = &builder.sysroot_libdir(for_compiler, target);
|
||||
@ -454,7 +454,7 @@ impl<'a> Step<'a> for Test<'a> {
|
||||
compiler.host, target);
|
||||
let out_dir = build.cargo_out(compiler, Mode::Libtest, target);
|
||||
build.clear_if_dirty(&out_dir, &libstd_stamp(build, compiler, target));
|
||||
let mut cargo = build.cargo(compiler, Mode::Libtest, target, "build");
|
||||
let mut cargo = builder.cargo(compiler, Mode::Libtest, target, "build");
|
||||
if let Some(target) = env::var_os("MACOSX_STD_DEPLOYMENT_TARGET") {
|
||||
cargo.env("MACOSX_DEPLOYMENT_TARGET", target);
|
||||
}
|
||||
@ -465,7 +465,7 @@ impl<'a> Step<'a> for Test<'a> {
|
||||
&libtest_stamp(build, compiler, target));
|
||||
|
||||
builder.ensure(TestLink {
|
||||
compiler: builder.compiler(1, &build.build),
|
||||
compiler: builder.compiler(compiler.stage, &build.build),
|
||||
target_compiler: compiler,
|
||||
target: target,
|
||||
});
|
||||
@ -583,7 +583,7 @@ impl<'a> Step<'a> for Rustc<'a> {
|
||||
let out_dir = build.cargo_out(compiler, Mode::Librustc, target);
|
||||
build.clear_if_dirty(&out_dir, &libtest_stamp(build, compiler, target));
|
||||
|
||||
let mut cargo = build.cargo(compiler, Mode::Librustc, target, "build");
|
||||
let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "build");
|
||||
cargo.arg("--features").arg(build.rustc_features())
|
||||
.arg("--manifest-path")
|
||||
.arg(build.src.join("src/rustc/Cargo.toml"));
|
||||
@ -838,7 +838,7 @@ impl<'a> Step<'a> for Assemble<'a> {
|
||||
let rustc = out_dir.join(exe("rustc", host));
|
||||
let bindir = sysroot.join("bin");
|
||||
t!(fs::create_dir_all(&bindir));
|
||||
let compiler = build.compiler_path(target_compiler);
|
||||
let compiler = builder.rustc(target_compiler);
|
||||
let _ = fs::remove_file(&compiler);
|
||||
copy(&rustc, &compiler);
|
||||
|
||||
|
@ -998,7 +998,7 @@ impl<'a> Step<'a> for Cargo<'a> {
|
||||
let etc = src.join("src/etc");
|
||||
let release_num = build.release_num("cargo");
|
||||
let name = pkgname(build, "cargo");
|
||||
let version = build.cargo_info.version(build, &release_num);
|
||||
let version = builder.cargo_info.version(build, &release_num);
|
||||
|
||||
let tmp = tmpdir(build);
|
||||
let image = tmp.join("cargo-image");
|
||||
|
@ -271,7 +271,7 @@ fn invoke_rustdoc(builder: &Builder, target: &str, markdown: &str) {
|
||||
|
||||
let path = build.src.join("src/doc").join(markdown);
|
||||
|
||||
let rustdoc = build.rustdoc(compiler);
|
||||
let rustdoc = builder.rustdoc(compiler);
|
||||
|
||||
let favicon = build.src.join("src/doc/favicon.inc");
|
||||
let footer = build.src.join("src/doc/footer.inc");
|
||||
@ -290,7 +290,7 @@ fn invoke_rustdoc(builder: &Builder, target: &str, markdown: &str) {
|
||||
|
||||
let mut cmd = Command::new(&rustdoc);
|
||||
|
||||
build.add_rustc_lib_path(compiler, &mut cmd);
|
||||
builder.add_rustc_lib_path(compiler, &mut cmd);
|
||||
|
||||
let out = out.join("book");
|
||||
|
||||
@ -386,7 +386,7 @@ impl<'a> Step<'a> for Standalone<'a> {
|
||||
}
|
||||
|
||||
let html = out.join(filename).with_extension("html");
|
||||
let rustdoc = build.rustdoc(compiler);
|
||||
let rustdoc = builder.rustdoc(compiler);
|
||||
if up_to_date(&path, &html) &&
|
||||
up_to_date(&footer, &html) &&
|
||||
up_to_date(&favicon, &html) &&
|
||||
@ -397,7 +397,7 @@ impl<'a> Step<'a> for Standalone<'a> {
|
||||
}
|
||||
|
||||
let mut cmd = Command::new(&rustdoc);
|
||||
build.add_rustc_lib_path(compiler, &mut cmd);
|
||||
builder.add_rustc_lib_path(compiler, &mut cmd);
|
||||
cmd.arg("--html-after-content").arg(&footer)
|
||||
.arg("--html-before-content").arg(&version_info)
|
||||
.arg("--html-in-header").arg(&favicon)
|
||||
@ -483,7 +483,7 @@ impl<'a> Step<'a> for Std<'a> {
|
||||
builder.ensure(compile::Std { compiler, target });
|
||||
let out_dir = build.stage_out(compiler, Mode::Libstd)
|
||||
.join(target).join("doc");
|
||||
let rustdoc = build.rustdoc(compiler);
|
||||
let rustdoc = builder.rustdoc(compiler);
|
||||
|
||||
// Here what we're doing is creating a *symlink* (directory junction on
|
||||
// Windows) to the final output location. This is not done as an
|
||||
@ -502,7 +502,7 @@ impl<'a> Step<'a> for Std<'a> {
|
||||
build.clear_if_dirty(&my_out, &rustdoc);
|
||||
t!(symlink_dir_force(&my_out, &out_dir));
|
||||
|
||||
let mut cargo = build.cargo(compiler, Mode::Libstd, target, "doc");
|
||||
let mut cargo = builder.cargo(compiler, Mode::Libstd, target, "doc");
|
||||
cargo.arg("--manifest-path")
|
||||
.arg(build.src.join("src/libstd/Cargo.toml"))
|
||||
.arg("--features").arg(build.std_features());
|
||||
@ -597,14 +597,14 @@ impl<'a> Step<'a> for Test<'a> {
|
||||
builder.ensure(compile::Test { compiler, target });
|
||||
let out_dir = build.stage_out(compiler, Mode::Libtest)
|
||||
.join(target).join("doc");
|
||||
let rustdoc = build.rustdoc(compiler);
|
||||
let rustdoc = builder.rustdoc(compiler);
|
||||
|
||||
// See docs in std above for why we symlink
|
||||
let my_out = build.crate_doc_out(target);
|
||||
build.clear_if_dirty(&my_out, &rustdoc);
|
||||
t!(symlink_dir_force(&my_out, &out_dir));
|
||||
|
||||
let mut cargo = build.cargo(compiler, Mode::Libtest, target, "doc");
|
||||
let mut cargo = builder.cargo(compiler, Mode::Libtest, target, "doc");
|
||||
cargo.arg("--manifest-path")
|
||||
.arg(build.src.join("src/libtest/Cargo.toml"));
|
||||
build.run(&mut cargo);
|
||||
@ -685,14 +685,14 @@ impl<'a> Step<'a> for Rustc<'a> {
|
||||
builder.ensure(compile::Rustc { compiler, target });
|
||||
let out_dir = build.stage_out(compiler, Mode::Librustc)
|
||||
.join(target).join("doc");
|
||||
let rustdoc = build.rustdoc(compiler);
|
||||
let rustdoc = builder.rustdoc(compiler);
|
||||
|
||||
// See docs in std above for why we symlink
|
||||
let my_out = build.crate_doc_out(target);
|
||||
build.clear_if_dirty(&my_out, &rustdoc);
|
||||
t!(symlink_dir_force(&my_out, &out_dir));
|
||||
|
||||
let mut cargo = build.cargo(compiler, Mode::Librustc, target, "doc");
|
||||
let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "doc");
|
||||
cargo.arg("--manifest-path")
|
||||
.arg(build.src.join("src/rustc/Cargo.toml"))
|
||||
.arg("--features").arg(build.rustc_features());
|
||||
|
@ -96,7 +96,7 @@ use std::process::Command;
|
||||
|
||||
use build_helper::{run_silent, run_suppressed, try_run_silent, try_run_suppressed, output, mtime};
|
||||
|
||||
use util::{exe, libdir, add_lib_path, OutputFolder, CiEnv};
|
||||
use util::{exe, libdir, OutputFolder, CiEnv};
|
||||
|
||||
mod cc;
|
||||
mod channel;
|
||||
@ -352,23 +352,6 @@ impl Build {
|
||||
t!(File::create(stamp));
|
||||
}
|
||||
|
||||
/// Get a path to the compiler specified.
|
||||
fn compiler_path(&self, compiler: Compiler) -> PathBuf {
|
||||
if compiler.is_snapshot(self) {
|
||||
self.initial_rustc.clone()
|
||||
} else {
|
||||
self.sysroot(compiler).join("bin").join(exe("rustc", compiler.host))
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the `rustdoc` executable next to the specified compiler
|
||||
fn rustdoc(&self, compiler: Compiler) -> PathBuf {
|
||||
let mut rustdoc = self.compiler_path(compiler);
|
||||
rustdoc.pop();
|
||||
rustdoc.push(exe("rustdoc", compiler.host));
|
||||
rustdoc
|
||||
}
|
||||
|
||||
/// Get the space-separated set of activated features for the standard
|
||||
/// library.
|
||||
fn std_features(&self) -> String {
|
||||
@ -532,19 +515,6 @@ impl Build {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the compiler's libdir where it stores the dynamic libraries that
|
||||
/// it itself links against.
|
||||
///
|
||||
/// For example this returns `<sysroot>/lib` on Unix and `<sysroot>/bin` on
|
||||
/// Windows.
|
||||
fn rustc_libdir(&self, compiler: Compiler) -> PathBuf {
|
||||
if compiler.is_snapshot(self) {
|
||||
self.rustc_snapshot_libdir()
|
||||
} else {
|
||||
self.sysroot(compiler).join(libdir(compiler.host))
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the libdir of the snapshot compiler.
|
||||
fn rustc_snapshot_libdir(&self) -> PathBuf {
|
||||
self.initial_rustc.parent().unwrap().parent().unwrap()
|
||||
|
@ -110,7 +110,7 @@ impl<'a> Step<'a> for ToolBuild<'a> {
|
||||
let _folder = build.fold_output(|| format!("stage{}-{}", stage, tool));
|
||||
println!("Building stage{} tool {} ({})", stage, tool, target);
|
||||
|
||||
let mut cargo = build.cargo(compiler, Mode::Tool, target, "build");
|
||||
let mut cargo = builder.cargo(compiler, Mode::Tool, target, "build");
|
||||
let dir = build.src.join("src/tools").join(tool);
|
||||
cargo.arg("--manifest-path").arg(dir.join("Cargo.toml"));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user