Fix a few errors introduced during rebase.
This commit is contained in:
parent
c7435b52a9
commit
a5ab2ceef8
4 changed files with 121 additions and 62 deletions
|
@ -192,8 +192,9 @@ impl<'a> Builder<'a> {
|
||||||
impl<'a> Step<'a> for Libdir<'a> {
|
impl<'a> Step<'a> for Libdir<'a> {
|
||||||
type Output = PathBuf;
|
type Output = PathBuf;
|
||||||
fn run(self, builder: &Builder) -> PathBuf {
|
fn run(self, builder: &Builder) -> PathBuf {
|
||||||
|
let compiler = self.compiler;
|
||||||
let lib = if compiler.stage >= 2 && builder.build.config.libdir_relative.is_some() {
|
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 {
|
} else {
|
||||||
PathBuf::from("lib")
|
PathBuf::from("lib")
|
||||||
};
|
};
|
||||||
|
|
|
@ -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")
|
// rules.test("check-docs", "src/doc")
|
||||||
// .dep(|s| s.name("libtest"))
|
// .dep(|s| s.name("libtest"))
|
||||||
// .default(true)
|
// .default(true)
|
||||||
// .host(true)
|
// .host(true)
|
||||||
// .run(move |s| check::docs(build, &s.compiler()));
|
// .run(move |s| check::docs(build, &s.compiler()));
|
||||||
/// Run `rustdoc --test` for all documentation in `src/doc`.
|
impl<'a> Step<'a> for Docs<'a> {
|
||||||
///
|
type Output = ();
|
||||||
/// This will run all tests in our markdown documentation (e.g. the book)
|
const DEFAULT: bool = true;
|
||||||
/// located in `src/doc`. The `rustdoc` that's run is the one that sits next to
|
const ONLY_HOSTS: bool = true;
|
||||||
/// `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");
|
|
||||||
|
|
||||||
while let Some(p) = stack.pop() {
|
fn should_run(_builder: &Builder, path: &Path) -> bool {
|
||||||
if p.is_dir() {
|
path.ends_with("src/doc")
|
||||||
stack.extend(t!(p.read_dir()).map(|p| t!(p).path()));
|
}
|
||||||
continue
|
|
||||||
|
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -553,29 +553,76 @@ impl<'a> Step<'a> for DebuggerScripts<'a> {
|
||||||
// .dep(move |s| tool_rust_installer(build, s))
|
// .dep(move |s| tool_rust_installer(build, s))
|
||||||
// .run(move |s| dist::std(build, &s.compiler(), s.target));
|
// .run(move |s| dist::std(build, &s.compiler(), s.target));
|
||||||
|
|
||||||
let name = pkgname(build, "rust-std");
|
#[derive(Serialize)]
|
||||||
let image = tmpdir(build).join(format!("{}-{}-image", name, target));
|
pub struct Std<'a> {
|
||||||
let _ = fs::remove_dir_all(&image);
|
pub compiler: Compiler<'a>,
|
||||||
|
pub target: &'a str,
|
||||||
|
}
|
||||||
|
|
||||||
let dst = image.join("lib/rustlib").join(target);
|
impl<'a> Step<'a> for Std<'a> {
|
||||||
t!(fs::create_dir_all(&dst));
|
type Output = ();
|
||||||
let mut src = build.sysroot_libdir(compiler, target);
|
const DEFAULT: bool = true;
|
||||||
src.pop(); // Remove the trailing /lib folder from the sysroot_libdir
|
const ONLY_BUILD_TARGETS: bool = true;
|
||||||
cp_r(&src, &dst);
|
|
||||||
|
|
||||||
let mut cmd = rust_installer(build);
|
fn should_run(_builder: &Builder, path: &Path) -> bool {
|
||||||
cmd.arg("generate")
|
path.ends_with("src/libstd")
|
||||||
.arg("--product-name=Rust")
|
}
|
||||||
.arg("--rel-manifest-dir=rustlib")
|
|
||||||
.arg("--success-message=std-is-standing-at-the-ready.")
|
fn make_run(builder: &Builder, _path: Option<&Path>, host: &str, target: &str) {
|
||||||
.arg("--image-dir").arg(&image)
|
builder.ensure(Std {
|
||||||
.arg("--work-dir").arg(&tmpdir(build))
|
compiler: builder.compiler(builder.top_stage, host),
|
||||||
.arg("--output-dir").arg(&distdir(build))
|
target: target,
|
||||||
.arg(format!("--package-name={}-{}", name, target))
|
});
|
||||||
.arg(format!("--component-name=rust-std-{}", target))
|
}
|
||||||
.arg("--legacy-manifest-dirs=rustlib,cargo");
|
|
||||||
build.run(&mut cmd);
|
fn run(self, builder: &Builder) {
|
||||||
t!(fs::remove_dir_all(&image));
|
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
|
/// The path to the complete rustc-src tarball
|
||||||
|
|
|
@ -114,6 +114,7 @@
|
||||||
//! also check out the `src/bootstrap/README.md` file for more information.
|
//! also check out the `src/bootstrap/README.md` file for more information.
|
||||||
|
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
|
#![allow(stable_features)]
|
||||||
#![feature(associated_consts)]
|
#![feature(associated_consts)]
|
||||||
#![feature(core_intrinsics)]
|
#![feature(core_intrinsics)]
|
||||||
|
|
||||||
|
@ -441,19 +442,6 @@ impl Build {
|
||||||
self.out.join(compiler.host).join(format!("stage{}-incremental", compiler.stage))
|
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
|
/// Returns the root directory for all output generated in a particular
|
||||||
/// stage when running with a particular host compiler.
|
/// stage when running with a particular host compiler.
|
||||||
///
|
///
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue