]> git.lizzy.rs Git - rust.git/commitdiff
Fix a few errors introduced during rebase.
authorMark Simulacrum <mark.simulacrum@gmail.com>
Wed, 12 Jul 2017 15:15:00 +0000 (09:15 -0600)
committerMark Simulacrum <mark.simulacrum@gmail.com>
Thu, 20 Jul 2017 17:23:59 +0000 (11:23 -0600)
src/bootstrap/builder.rs
src/bootstrap/check.rs
src/bootstrap/dist.rs
src/bootstrap/lib.rs

index fbfe442d8f6f7a6cde922554191a7a0fda26f4ee..5d7400ab9ae8ac4f0d4af0ac52f42e0c0d195766 100644 (file)
@@ -192,8 +192,9 @@ struct Libdir<'a> {
         impl<'a> Step<'a> for Libdir<'a> {
             type Output = PathBuf;
             fn run(self, builder: &Builder) -> PathBuf {
         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() {
                 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")
                 };
                 } else {
                     PathBuf::from("lib")
                 };
index 3e9c02863e76a678090dc02f48146a6a1296dcc2..e4cfe884295626540cdd5b855a9fb1c8742e3505 100644 (file)
@@ -753,40 +753,63 @@ fn run(self, builder: &Builder) {
     }
 }
 
     }
 }
 
+#[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()));
 // 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");
-
-    while let Some(p) = stack.pop() {
-        if p.is_dir() {
-            stack.extend(t!(p.read_dir()).map(|p| t!(p).path()));
-            continue
-        }
+impl<'a> Step<'a> for Docs<'a> {
+    type Output = ();
+    const DEFAULT: bool = true;
+    const ONLY_HOSTS: bool = true;
 
 
-        if p.extension().and_then(|s| s.to_str()) != Some("md") {
-            continue;
-        }
+    fn should_run(_builder: &Builder, path: &Path) -> bool {
+        path.ends_with("src/doc")
+    }
 
 
-        // 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;
-        }
+    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");
 
 
-        markdown_test(build, compiler, &p);
+        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);
+        }
     }
 }
 
     }
 }
 
index a2f779514a9975bdf0551277e995d0cfab06e7ea..c419f8bb7211b9823140beeed8543cd6779635ad 100644 (file)
@@ -553,29 +553,76 @@ fn run(self, builder: &Builder) {
 //      .dep(move |s| tool_rust_installer(build, s))
 //      .run(move |s| dist::std(build, &s.compiler(), s.target));
 
 //      .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);
-
-    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);
-
-    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));
+#[derive(Serialize)]
+pub struct Std<'a> {
+    pub compiler: Compiler<'a>,
+    pub target: &'a str,
+}
+
+impl<'a> Step<'a> for Std<'a> {
+    type Output = ();
+    const DEFAULT: bool = true;
+    const ONLY_BUILD_TARGETS: bool = true;
+
+    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
 }
 
 /// The path to the complete rustc-src tarball
index d4ef6613a2a5e4667ee8376ea77702cf8ad9853e..d7f1570ba80a0933994def5b594ef870a511a1cd 100644 (file)
 //! also check out the `src/bootstrap/README.md` file for more information.
 
 #![deny(warnings)]
 //! also check out the `src/bootstrap/README.md` file for more information.
 
 #![deny(warnings)]
+#![allow(stable_features)]
 #![feature(associated_consts)]
 #![feature(core_intrinsics)]
 
 #![feature(associated_consts)]
 #![feature(core_intrinsics)]
 
@@ -441,19 +442,6 @@ fn incremental_dir(&self, compiler: Compiler) -> PathBuf {
         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
     /// stage when running with a particular host compiler.
     ///
     /// Returns the root directory for all output generated in a particular
     /// stage when running with a particular host compiler.
     ///