about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorMateusz Mikuła <matti@marinelayer.io>2019-08-06 14:55:57 +0200
committerMateusz Mikuła <mati865@gmail.com>2019-08-09 10:32:34 +0200
commitc7e16c5f47ac86877ab6c52db61709349e4cf276 (patch)
treed53dacf567b536a14d641ee6ca7c4efe719b5f72 /src/bootstrap
parentd8f8be4636f6f49d28f548e0b8730f8e916b070d (diff)
downloadrust-c7e16c5f47ac86877ab6c52db61709349e4cf276.tar.gz
rust-c7e16c5f47ac86877ab6c52db61709349e4cf276.zip
Check links on all platforms when running locally
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/tool.rs26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index 15a329a5b91..df7eb7c455d 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -9,7 +9,7 @@ use build_helper::t;
 use crate::Mode;
 use crate::Compiler;
 use crate::builder::{Step, RunConfig, ShouldRun, Builder};
-use crate::util::{exe, add_lib_path};
+use crate::util::{exe, add_lib_path, CiEnv};
 use crate::compile;
 use crate::channel::GitInfo;
 use crate::channel;
@@ -279,11 +279,26 @@ pub fn prepare_tool_cargo(
     cargo
 }
 
+fn rustbook_features() -> Vec<String> {
+    let mut features = Vec::new();
+
+    // Due to CI budged and risk of spurious failures we want to limit jobs running this check.
+    // At same time local builds should run it regardless of the platform.
+    // `CiEnv::None` means it's local build and `CHECK_LINKS` is defined in x86_64-gnu-tools to
+    // explicitly enable it on single job
+    if CiEnv::current() == CiEnv::None || env::var("CHECK_LINKS").is_ok() {
+        features.push("linkcheck".to_string());
+    }
+
+    features
+}
+
 macro_rules! bootstrap_tool {
     ($(
         $name:ident, $path:expr, $tool_name:expr
         $(,llvm_tools = $llvm:expr)*
         $(,is_external_tool = $external:expr)*
+        $(,features = $features:expr)*
         ;
     )+) => {
         #[derive(Copy, PartialEq, Eq, Clone)]
@@ -350,7 +365,12 @@ macro_rules! bootstrap_tool {
                     } else {
                         SourceType::InTree
                     },
-                    extra_features: Vec::new(),
+                    extra_features: {
+                        // FIXME(#60643): avoid this lint by using `_`
+                        let mut _tmp = Vec::new();
+                        $(_tmp.extend($features);)*
+                        _tmp
+                    },
                 }).expect("expected to build -- essential tool")
             }
         }
@@ -359,7 +379,7 @@ macro_rules! bootstrap_tool {
 }
 
 bootstrap_tool!(
-    Rustbook, "src/tools/rustbook", "rustbook";
+    Rustbook, "src/tools/rustbook", "rustbook", features = rustbook_features();
     UnstableBookGen, "src/tools/unstable-book-gen", "unstable-book-gen";
     Tidy, "src/tools/tidy", "tidy";
     Linkchecker, "src/tools/linkchecker", "linkchecker";