about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2018-11-23 14:09:08 -0500
committerGitHub <noreply@github.com>2018-11-23 14:09:08 -0500
commitebb1a48b415c1b586bb652d58f3d2078d87f44dd (patch)
treef7338faaa66791a15338a938f6a2bf94107de0d1 /src/bootstrap
parent033cbfec4d3bb23948a99379f8d63b7cfe5eed45 (diff)
parent821bad3a5b13862e9fbfae35b446ab91a976a75e (diff)
downloadrust-ebb1a48b415c1b586bb652d58f3d2078d87f44dd.tar.gz
rust-ebb1a48b415c1b586bb652d58f3d2078d87f44dd.zip
Merge branch 'master' into frewsxcv-dyn
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/bootstrap.py2
-rw-r--r--src/bootstrap/dist.rs6
-rw-r--r--src/bootstrap/doc.rs26
-rw-r--r--src/bootstrap/test.rs1
-rw-r--r--src/bootstrap/tool.rs30
5 files changed, 47 insertions, 18 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index cd48e6aa4c4..d143dffb24b 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -801,7 +801,7 @@ def bootstrap(help_triggered):
                 registry = 'https://example.com'
 
                 [source.vendored-sources]
-                directory = '{}/src/vendor'
+                directory = '{}/vendor'
             """.format(build.rust_root))
     else:
         if os.path.exists('.cargo'):
diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs
index 0aab64465fd..cd8d5642b25 100644
--- a/src/bootstrap/dist.rs
+++ b/src/bootstrap/dist.rs
@@ -851,7 +851,7 @@ impl Step for Src {
         t!(fs::create_dir_all(&dst_src));
 
         let src_files = [
-            "src/Cargo.lock",
+            "Cargo.lock",
         ];
         // This is the reduced set of paths which will become the rust-src component
         // (essentially libstd and all of its path dependencies)
@@ -949,6 +949,8 @@ impl Step for PlainSourceTarball {
             "configure",
             "x.py",
             "config.toml.example",
+            "Cargo.toml",
+            "Cargo.lock",
         ];
         let src_dirs = [
             "src",
@@ -992,7 +994,7 @@ impl Step for PlainSourceTarball {
             // Vendor all Cargo dependencies
             let mut cmd = Command::new(&builder.initial_cargo);
             cmd.arg("vendor")
-               .current_dir(&plain_dst_src.join("src"));
+               .current_dir(&plain_dst_src);
             builder.run(&mut cmd);
         }
 
diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs
index 7623ca1e27e..f9b19ffb10d 100644
--- a/src/bootstrap/doc.rs
+++ b/src/bootstrap/doc.rs
@@ -260,22 +260,31 @@ impl Step for TheBook {
         let compiler = self.compiler;
         let target = self.target;
         let name = self.name;
-        // build book first edition
+
+        // build book
         builder.ensure(Rustbook {
             target,
-            name: INTERNER.intern_string(format!("{}/first-edition", name)),
+            name: INTERNER.intern_string(name.to_string()),
         });
 
-        // build book second edition
+        // building older edition redirects
+
+        let source_name = format!("{}/first-edition", name);
         builder.ensure(Rustbook {
             target,
-            name: INTERNER.intern_string(format!("{}/second-edition", name)),
+            name: INTERNER.intern_string(source_name),
         });
 
-        // build book 2018 edition
+        let source_name = format!("{}/second-edition", name);
         builder.ensure(Rustbook {
             target,
-            name: INTERNER.intern_string(format!("{}/2018-edition", name)),
+            name: INTERNER.intern_string(source_name),
+        });
+
+        let source_name = format!("{}/2018-edition", name);
+        builder.ensure(Rustbook {
+            target,
+            name: INTERNER.intern_string(source_name),
         });
 
         // build the version info page and CSS
@@ -284,11 +293,6 @@ impl Step for TheBook {
             target,
         });
 
-        // build the index page
-        let index = format!("{}/index.md", name);
-        builder.info(&format!("Documenting book index ({})", target));
-        invoke_rustdoc(builder, compiler, target, &index);
-
         // build the redirect pages
         builder.info(&format!("Documenting book redirect pages ({})", target));
         for file in t!(fs::read_dir(builder.src.join("src/doc/book/redirects"))) {
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index e55773011df..c50e6a27033 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -1934,6 +1934,7 @@ impl Step for Distcheck {
                 .arg("generate-lockfile")
                 .arg("--manifest-path")
                 .arg(&toml)
+                .env("__CARGO_TEST_ROOT", &dir)
                 .current_dir(&dir),
         );
     }
diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index 978e3602e7d..4acc739db57 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -22,6 +22,7 @@ use util::{exe, add_lib_path};
 use compile;
 use native;
 use channel::GitInfo;
+use channel;
 use cache::Interned;
 use toolstate::ToolState;
 
@@ -240,6 +241,7 @@ pub fn prepare_tool_cargo(
 
     cargo.env("CFG_RELEASE_CHANNEL", &builder.config.channel);
     cargo.env("CFG_VERSION", builder.rust_version());
+    cargo.env("CFG_RELEASE_NUM", channel::CFG_RELEASE_NUM);
 
     let info = GitInfo::new(&builder.config, &dir);
     if let Some(sha) = info.sha() {
@@ -258,8 +260,13 @@ pub fn prepare_tool_cargo(
 }
 
 macro_rules! tool {
-    ($($name:ident, $path:expr, $tool_name:expr, $mode:expr
-        $(,llvm_tools = $llvm:expr)* $(,is_external_tool = $external:expr)*;)+) => {
+    ($(
+        $name:ident, $path:expr, $tool_name:expr, $mode:expr
+        $(,llvm_tools = $llvm:expr)*
+        $(,is_external_tool = $external:expr)*
+        $(,cargo_test_root = $cargo_test_root:expr)*
+        ;
+    )+) => {
         #[derive(Copy, PartialEq, Eq, Clone)]
         pub enum Tool {
             $(
@@ -281,6 +288,15 @@ macro_rules! tool {
                     $(Tool::$name => false $(|| $llvm)*,)+
                 }
             }
+
+            /// Whether this tool requires may run Cargo for test crates,
+            /// which currently needs setting the environment variable
+            /// `__CARGO_TEST_ROOT` to separate it from the workspace.
+            pub fn needs_cargo_test_root(&self) -> bool {
+                match self {
+                    $(Tool::$name => false $(|| $cargo_test_root)*,)+
+                }
+            }
         }
 
         impl<'a> Builder<'a> {
@@ -356,8 +372,9 @@ tool!(
     UnstableBookGen, "src/tools/unstable-book-gen", "unstable-book-gen", Mode::ToolBootstrap;
     Tidy, "src/tools/tidy", "tidy", Mode::ToolBootstrap;
     Linkchecker, "src/tools/linkchecker", "linkchecker", Mode::ToolBootstrap;
-    CargoTest, "src/tools/cargotest", "cargotest", Mode::ToolBootstrap;
-    Compiletest, "src/tools/compiletest", "compiletest", Mode::ToolBootstrap, llvm_tools = true;
+    CargoTest, "src/tools/cargotest", "cargotest", Mode::ToolBootstrap, cargo_test_root = true;
+    Compiletest, "src/tools/compiletest", "compiletest", Mode::ToolBootstrap,
+        llvm_tools = true, cargo_test_root = true;
     BuildManifest, "src/tools/build-manifest", "build-manifest", Mode::ToolBootstrap;
     RemoteTestClient, "src/tools/remote-test-client", "remote-test-client", Mode::ToolBootstrap;
     RustInstaller, "src/tools/rust-installer", "fabricate", Mode::ToolBootstrap,
@@ -676,6 +693,11 @@ impl<'a> Builder<'a> {
             }
         }
 
+        // Set `__CARGO_TEST_ROOT` to the build directory if needed.
+        if tool.needs_cargo_test_root() {
+            cmd.env("__CARGO_TEST_ROOT", &self.config.out);
+        }
+
         add_lib_path(lib_paths, cmd);
     }