Skip to content

Commit 53254a8

Browse files
committed
Add enable-missing-tools option
1 parent 7d52cbc commit 53254a8

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

src/bootstrap/config.rs

+2
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ pub struct Config {
134134
pub test_miri: bool,
135135
pub save_toolstates: Option<PathBuf>,
136136
pub print_step_timings: bool,
137+
pub missing_tools: bool,
137138

138139
// Fallback musl-root for all targets
139140
pub musl_root: Option<PathBuf>,
@@ -375,6 +376,7 @@ impl Config {
375376
config.rust_codegen_backends = vec![INTERNER.intern_str("llvm")];
376377
config.rust_codegen_backends_dir = "codegen-backends".to_owned();
377378
config.deny_warnings = true;
379+
config.missing_tools = false;
378380

379381
// set by bootstrap.py
380382
config.build = INTERNER.intern_str(&env::var("BUILD").expect("'BUILD' to be set"));

src/bootstrap/configure.py

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def v(*args):
6969
o("emscripten", None, "compile the emscripten backend as well as LLVM")
7070
o("full-tools", None, "enable all tools")
7171
o("lldb", "rust.lldb", "build lldb")
72+
o("enable-missing-tools", "build.missing-tools", "allow failures when building tools")
7273

7374
# Optimization and debugging options. These may be overridden by the release
7475
# channel, etc.

src/bootstrap/dist.rs

+13-5
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ fn rust_installer(builder: &Builder) -> Command {
6767
builder.tool_cmd(Tool::RustInstaller)
6868
}
6969

70+
fn missing_tool(tool_name: &str, skip: bool) {
71+
if skip {
72+
println!("Unable to build {}, skipping dist", tool_name)
73+
} else {
74+
panic!("Unable to build {}", tool_name)
75+
}
76+
}
77+
7078
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
7179
pub struct Docs {
7280
pub stage: u32,
@@ -1166,7 +1174,7 @@ impl Step for Rls {
11661174
let rls = builder.ensure(tool::Rls {
11671175
compiler: builder.compiler(stage, builder.config.build),
11681176
target, extra_features: Vec::new()
1169-
}).or_else(|| { println!("Unable to build RLS, skipping dist"); None })?;
1177+
}).or_else(|| { missing_tool("RLS", builder.build.config.missing_tools); None })?;
11701178

11711179
builder.install(&rls, &image.join("bin"), 0o755);
11721180
let doc = image.join("share/doc/rls");
@@ -1245,11 +1253,11 @@ impl Step for Clippy {
12451253
let clippy = builder.ensure(tool::Clippy {
12461254
compiler: builder.compiler(stage, builder.config.build),
12471255
target, extra_features: Vec::new()
1248-
}).or_else(|| { println!("Unable to build clippy, skipping dist"); None })?;
1256+
}).or_else(|| { missing_tool("clippy", builder.build.config.missing_tools); None })?;
12491257
let cargoclippy = builder.ensure(tool::CargoClippy {
12501258
compiler: builder.compiler(stage, builder.config.build),
12511259
target, extra_features: Vec::new()
1252-
}).or_else(|| { println!("Unable to build cargo clippy, skipping dist"); None })?;
1260+
}).or_else(|| { missing_tool("cargo clippy", builder.build.config.missing_tools); None })?;
12531261

12541262
builder.install(&clippy, &image.join("bin"), 0o755);
12551263
builder.install(&cargoclippy, &image.join("bin"), 0o755);
@@ -1324,11 +1332,11 @@ impl Step for Rustfmt {
13241332
let rustfmt = builder.ensure(tool::Rustfmt {
13251333
compiler: builder.compiler(stage, builder.config.build),
13261334
target, extra_features: Vec::new()
1327-
}).or_else(|| { println!("Unable to build Rustfmt, skipping dist"); None })?;
1335+
}).or_else(|| { missing_tool("Rustfmt", builder.build.config.missing_tools); None })?;
13281336
let cargofmt = builder.ensure(tool::Cargofmt {
13291337
compiler: builder.compiler(stage, builder.config.build),
13301338
target, extra_features: Vec::new()
1331-
}).or_else(|| { println!("Unable to build Cargofmt, skipping dist"); None })?;
1339+
}).or_else(|| { missing_tool("Cargofmt", builder.build.config.missing_tools); None })?;
13321340

13331341
builder.install(&rustfmt, &image.join("bin"), 0o755);
13341342
builder.install(&cargofmt, &image.join("bin"), 0o755);

src/ci/run.sh

+4
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ else
7676
fi
7777
fi
7878

79+
if [ "$RUST_RELEASE_CHANNEL" = "nightly" ] or [ "$DIST_REQUIRE_ALL_TOOLS" = "" ]; then
80+
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-missing-tools"
81+
fi
82+
7983
# We've had problems in the past of shell scripts leaking fds into the sccache
8084
# server (#48192) which causes Cargo to erroneously think that a build script
8185
# hasn't finished yet. Try to solve that problem by starting a very long-lived

0 commit comments

Comments
 (0)