1
Fork 0

Remove ONLY_BUILD.

All uses are replaced with not accessing run.target/run.host, and
instead directly using run.builder.build.build.
This commit is contained in:
Mark Simulacrum 2018-02-11 15:41:06 -07:00
parent 1191510881
commit 1c8f3b011c
3 changed files with 34 additions and 28 deletions

View file

@ -60,9 +60,6 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash {
/// Run this rule for all hosts without cross compiling.
const ONLY_HOSTS: bool = false;
/// Only run this step with the build triple as host and target.
const ONLY_BUILD: bool = false;
/// Primary function to execute this rule. Can call `builder.ensure(...)`
/// with other steps to run those.
fn run(self, builder: &Builder) -> Self::Output;
@ -98,7 +95,6 @@ pub struct RunConfig<'a> {
struct StepDescription {
default: bool,
only_hosts: bool,
only_build: bool,
should_run: fn(ShouldRun) -> ShouldRun,
make_run: fn(RunConfig),
name: &'static str,
@ -134,7 +130,6 @@ impl StepDescription {
StepDescription {
default: S::DEFAULT,
only_hosts: S::ONLY_HOSTS,
only_build: S::ONLY_BUILD,
should_run: S::should_run,
make_run: S::make_run,
name: unsafe { ::std::intrinsics::type_name::<S>() },
@ -150,18 +145,12 @@ impl StepDescription {
self.name, builder.config.exclude);
}
let build = builder.build;
let hosts = if self.only_build {
build.build_triple()
} else {
&build.hosts
};
let hosts = &build.hosts;
// Determine the targets participating in this rule.
let targets = if self.only_hosts {
if build.config.run_host_only {
&[]
} else if self.only_build {
build.build_triple()
} else {
&build.hosts
}

View file

@ -225,10 +225,6 @@ install!((self, builder, _config),
});
install_analysis(builder, self.stage, self.target);
};
Src, "src", Self::should_build(_config) , only_hosts: true, {
builder.ensure(dist::Src);
install_src(builder, self.stage);
}, ONLY_BUILD;
Rustc, "src/librustc", true, only_hosts: true, {
builder.ensure(dist::Rustc {
compiler: builder.compiler(self.stage, self.target),
@ -236,3 +232,32 @@ install!((self, builder, _config),
install_rustc(builder, self.stage, self.target);
};
);
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Src {
pub stage: u32,
}
impl Step for Src {
type Output = ();
const DEFAULT: bool = true;
const ONLY_HOSTS: bool = true;
fn should_run(run: ShouldRun) -> ShouldRun {
let config = &run.builder.config;
let cond = config.extended &&
config.tools.as_ref().map_or(true, |t| t.contains("src"));
run.path("src").default_condition(cond)
}
fn make_run(run: RunConfig) {
run.builder.ensure(Src {
stage: run.builder.top_stage,
});
}
fn run(self, builder: &Builder) {
builder.ensure(dist::Src);
install_src(builder, self.stage);
}
}

View file

@ -505,27 +505,23 @@ impl Step for RustdocJS {
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct Tidy {
host: Interned<String>,
}
pub struct Tidy;
impl Step for Tidy {
type Output = ();
const DEFAULT: bool = true;
const ONLY_HOSTS: bool = true;
const ONLY_BUILD: bool = true;
/// Runs the `tidy` tool as compiled in `stage` by the `host` compiler.
/// Runs the `tidy` tool.
///
/// This tool in `src/tools` checks up on various bits and pieces of style and
/// otherwise just implements a few lint-like checks that are specific to the
/// compiler itself.
fn run(self, builder: &Builder) {
let build = builder.build;
let host = self.host;
let _folder = build.fold_output(|| "tidy");
println!("tidy check ({})", host);
println!("tidy check");
let mut cmd = builder.tool_cmd(Tool::Tidy);
cmd.arg(build.src.join("src"));
cmd.arg(&build.initial_cargo);
@ -543,9 +539,7 @@ impl Step for Tidy {
}
fn make_run(run: RunConfig) {
run.builder.ensure(Tidy {
host: run.builder.build.build,
});
run.builder.ensure(Tidy);
}
}
@ -1607,7 +1601,6 @@ pub struct Distcheck;
impl Step for Distcheck {
type Output = ();
const ONLY_BUILD: bool = true;
fn should_run(run: ShouldRun) -> ShouldRun {
run.path("distcheck")
@ -1673,7 +1666,6 @@ impl Step for Bootstrap {
type Output = ();
const DEFAULT: bool = true;
const ONLY_HOSTS: bool = true;
const ONLY_BUILD: bool = true;
/// Test the build system itself
fn run(self, builder: &Builder) {