Fix a few errors introduced during rebase.

This commit is contained in:
Mark Simulacrum 2017-07-12 09:15:00 -06:00
parent c7435b52a9
commit a5ab2ceef8
4 changed files with 121 additions and 62 deletions

View file

@ -192,8 +192,9 @@ impl<'a> Builder<'a> {
impl<'a> Step<'a> for Libdir<'a> {
type Output = PathBuf;
fn run(self, builder: &Builder) -> PathBuf {
let compiler = self.compiler;
let lib = if compiler.stage >= 2 && builder.build.config.libdir_relative.is_some() {
builder.build.config.libdir_relative.cloned().unwrap()
builder.build.config.libdir_relative.clone().unwrap()
} else {
PathBuf::from("lib")
};

View file

@ -753,40 +753,63 @@ impl<'a> Step<'a> for Compiletest<'a> {
}
}
#[derive(Serialize)]
pub struct Docs<'a> {
compiler: Compiler<'a>,
}
// rules.test("check-docs", "src/doc")
// .dep(|s| s.name("libtest"))
// .default(true)
// .host(true)
// .run(move |s| check::docs(build, &s.compiler()));
/// Run `rustdoc --test` for all documentation in `src/doc`.
///
/// This will run all tests in our markdown documentation (e.g. the book)
/// located in `src/doc`. The `rustdoc` that's run is the one that sits next to
/// `compiler`.
pub fn docs(build: &Build, compiler: &Compiler) {
// 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("src/doc")];
let _time = util::timeit();
let _folder = build.fold_output(|| "test_docs");
impl<'a> Step<'a> for Docs<'a> {
type Output = ();
const DEFAULT: bool = true;
const ONLY_HOSTS: bool = true;
while let Some(p) = stack.pop() {
if p.is_dir() {
stack.extend(t!(p.read_dir()).map(|p| t!(p).path()));
continue
fn should_run(_builder: &Builder, path: &Path) -> bool {
path.ends_with("src/doc")
}
fn make_run(builder: &Builder, _path: Option<&Path>, host: &str, _target: &str) {
builder.ensure(Docs {
compiler: builder.compiler(builder.top_stage, host),
});
}
/// Run `rustdoc --test` for all documentation in `src/doc`.
///
/// This will run all tests in our markdown documentation (e.g. the book)
/// 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;
// 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("src/doc")];
let _time = util::timeit();
let _folder = build.fold_output(|| "test_docs");
while let Some(p) = stack.pop() {
if p.is_dir() {
stack.extend(t!(p.read_dir()).map(|p| t!(p).path()));
continue
}
if p.extension().and_then(|s| s.to_str()) != Some("md") {
continue;
}
// 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.
if p.to_str().map_or(false, |p| p.contains("nostarch")) {
continue;
}
markdown_test(builder, compiler, &p);
}
if p.extension().and_then(|s| s.to_str()) != Some("md") {
continue;
}
// 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.
if p.to_str().map_or(false, |p| p.contains("nostarch")) {
continue;
}
markdown_test(build, compiler, &p);
}
}

View file

@ -553,29 +553,76 @@ impl<'a> Step<'a> for DebuggerScripts<'a> {
// .dep(move |s| tool_rust_installer(build, s))
// .run(move |s| dist::std(build, &s.compiler(), s.target));
let name = pkgname(build, "rust-std");
let image = tmpdir(build).join(format!("{}-{}-image", name, target));
let _ = fs::remove_dir_all(&image);
#[derive(Serialize)]
pub struct Std<'a> {
pub compiler: Compiler<'a>,
pub target: &'a str,
}
let dst = image.join("lib/rustlib").join(target);
t!(fs::create_dir_all(&dst));
let mut src = build.sysroot_libdir(compiler, target);
src.pop(); // Remove the trailing /lib folder from the sysroot_libdir
cp_r(&src, &dst);
impl<'a> Step<'a> for Std<'a> {
type Output = ();
const DEFAULT: bool = true;
const ONLY_BUILD_TARGETS: bool = true;
let mut cmd = rust_installer(build);
cmd.arg("generate")
.arg("--product-name=Rust")
.arg("--rel-manifest-dir=rustlib")
.arg("--success-message=std-is-standing-at-the-ready.")
.arg("--image-dir").arg(&image)
.arg("--work-dir").arg(&tmpdir(build))
.arg("--output-dir").arg(&distdir(build))
.arg(format!("--package-name={}-{}", name, target))
.arg(format!("--component-name=rust-std-{}", target))
.arg("--legacy-manifest-dirs=rustlib,cargo");
build.run(&mut cmd);
t!(fs::remove_dir_all(&image));
fn should_run(_builder: &Builder, path: &Path) -> bool {
path.ends_with("src/libstd")
}
fn make_run(builder: &Builder, _path: Option<&Path>, host: &str, target: &str) {
builder.ensure(Std {
compiler: builder.compiler(builder.top_stage, host),
target: target,
});
}
fn run(self, builder: &Builder) {
let build = builder.build;
let compiler = self.compiler;
let target = self.target;
println!("Dist std stage{} ({} -> {})", compiler.stage, compiler.host,
target);
// The only true set of target libraries came from the build triple, so
// let's reduce redundant work by only producing archives from that host.
if compiler.host != build.build {
println!("\tskipping, not a build host");
return
}
// We want to package up as many target libraries as possible
// for the `rust-std` package, so if this is a host target we
// depend on librustc and otherwise we just depend on libtest.
if build.config.host.iter().any(|t| t == target) {
builder.ensure(compile::Rustc { compiler, target });
} else {
builder.ensure(compile::Test { compiler, target });
}
let name = pkgname(build, "rust-std");
let image = tmpdir(build).join(format!("{}-{}-image", name, target));
let _ = fs::remove_dir_all(&image);
let dst = image.join("lib/rustlib").join(target);
t!(fs::create_dir_all(&dst));
let mut src = builder.sysroot_libdir(compiler, target);
src.pop(); // Remove the trailing /lib folder from the sysroot_libdir
cp_r(&src, &dst);
let mut cmd = rust_installer(builder);
cmd.arg("generate")
.arg("--product-name=Rust")
.arg("--rel-manifest-dir=rustlib")
.arg("--success-message=std-is-standing-at-the-ready.")
.arg("--image-dir").arg(&image)
.arg("--work-dir").arg(&tmpdir(build))
.arg("--output-dir").arg(&distdir(build))
.arg(format!("--package-name={}-{}", name, target))
.arg(format!("--component-name=rust-std-{}", target))
.arg("--legacy-manifest-dirs=rustlib,cargo");
build.run(&mut cmd);
t!(fs::remove_dir_all(&image));
}
}
/// The path to the complete rustc-src tarball

View file

@ -114,6 +114,7 @@
//! also check out the `src/bootstrap/README.md` file for more information.
#![deny(warnings)]
#![allow(stable_features)]
#![feature(associated_consts)]
#![feature(core_intrinsics)]
@ -441,19 +442,6 @@ impl Build {
self.out.join(compiler.host).join(format!("stage{}-incremental", compiler.stage))
}
/// Returns the libdir where the standard library and other artifacts are
/// found for a compiler's sysroot.
fn sysroot_libdir(&self, compiler: &Compiler, target: &str) -> PathBuf {
if compiler.stage >= 2 {
if let Some(ref libdir_relative) = self.config.libdir_relative {
return self.sysroot(compiler).join(libdir_relative)
.join("rustlib").join(target).join("lib")
}
}
self.sysroot(compiler).join("lib").join("rustlib")
.join(target).join("lib")
}
/// Returns the root directory for all output generated in a particular
/// stage when running with a particular host compiler.
///