x.py: do not build Miri by default

This commit is contained in:
Ralf Jung 2020-06-11 09:25:06 +02:00
parent e93cb961ba
commit 416b010f40
2 changed files with 20 additions and 12 deletions

View File

@ -52,6 +52,8 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash {
/// it's been assembled. /// it's been assembled.
type Output: Clone; type Output: Clone;
/// Whether this step is run by default as part of its respective phase.
/// `true` here can still be overwritten by `should_run` calling `default_condition`.
const DEFAULT: bool = false; const DEFAULT: bool = false;
/// If true, then this rule should be skipped if --target was specified, but --host was not /// If true, then this rule should be skipped if --target was specified, but --host was not

View File

@ -595,6 +595,7 @@ macro_rules! tool_extended {
$toolstate:ident, $toolstate:ident,
$path:expr, $path:expr,
$tool_name:expr, $tool_name:expr,
stable = $stable:expr,
$extra_deps:block;)+) => { $extra_deps:block;)+) => {
$( $(
#[derive(Debug, Clone, Hash, PartialEq, Eq)] #[derive(Debug, Clone, Hash, PartialEq, Eq)]
@ -606,17 +607,22 @@ macro_rules! tool_extended {
impl Step for $name { impl Step for $name {
type Output = Option<PathBuf>; type Output = Option<PathBuf>;
const DEFAULT: bool = true; const DEFAULT: bool = true; // Overwritten below
const ONLY_HOSTS: bool = true; const ONLY_HOSTS: bool = true;
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let builder = run.builder; let builder = run.builder;
run.path($path).default_condition( run.path($path).default_condition(
builder.config.extended builder.config.extended
&& builder.config.tools.as_ref().map_or(true, |tools| { && builder.config.tools.as_ref().map_or(
tools.iter().any(|tool| match tool.as_ref() { // By default, on nightly/dev enable all tools, else only
"clippy" => $tool_name == "clippy-driver", // build stable tools.
x => $tool_name == x, $stable || builder.build.unstable_features(),
// If `tools` is set, search list for this tool.
|tools| {
tools.iter().any(|tool| match tool.as_ref() {
"clippy" => $tool_name == "clippy-driver",
x => $tool_name == x,
}) })
}), }),
) )
@ -652,12 +658,12 @@ macro_rules! tool_extended {
// Note: tools need to be also added to `Builder::get_step_descriptions` in `build.rs` // Note: tools need to be also added to `Builder::get_step_descriptions` in `build.rs`
// to make `./x.py build <tool>` work. // to make `./x.py build <tool>` work.
tool_extended!((self, builder), tool_extended!((self, builder),
Cargofmt, rustfmt, "src/tools/rustfmt", "cargo-fmt", {}; Cargofmt, rustfmt, "src/tools/rustfmt", "cargo-fmt", stable=true, {};
CargoClippy, clippy, "src/tools/clippy", "cargo-clippy", {}; CargoClippy, clippy, "src/tools/clippy", "cargo-clippy", stable=true, {};
Clippy, clippy, "src/tools/clippy", "clippy-driver", {}; Clippy, clippy, "src/tools/clippy", "clippy-driver", stable=true, {};
Miri, miri, "src/tools/miri", "miri", {}; Miri, miri, "src/tools/miri", "miri", stable=false, {};
CargoMiri, miri, "src/tools/miri/cargo-miri", "cargo-miri", {}; CargoMiri, miri, "src/tools/miri/cargo-miri", "cargo-miri", stable=false, {};
Rls, rls, "src/tools/rls", "rls", { Rls, rls, "src/tools/rls", "rls", stable=true, {
builder.ensure(Clippy { builder.ensure(Clippy {
compiler: self.compiler, compiler: self.compiler,
target: self.target, target: self.target,
@ -665,7 +671,7 @@ tool_extended!((self, builder),
}); });
self.extra_features.push("clippy".to_owned()); self.extra_features.push("clippy".to_owned());
}; };
Rustfmt, rustfmt, "src/tools/rustfmt", "rustfmt", {}; Rustfmt, rustfmt, "src/tools/rustfmt", "rustfmt", stable=true, {};
); );
impl<'a> Builder<'a> { impl<'a> Builder<'a> {