Change make_run signature to taking a RunConfig struct for refactorability.
This commit is contained in:
parent
b05af49086
commit
6a67a050c6
|
@ -79,12 +79,7 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash {
|
|||
/// When path is `None`, we are executing in a context where no paths were
|
||||
/// passed. When `./x.py build` is run, for example, this rule could get
|
||||
/// called if it is in the correct list below with a path of `None`.
|
||||
fn make_run(
|
||||
_builder: &Builder,
|
||||
_path: Option<&Path>,
|
||||
_host: Interned<String>,
|
||||
_target: Interned<String>,
|
||||
) {
|
||||
fn make_run(_run: RunConfig) {
|
||||
// It is reasonable to not have an implementation of make_run for rules
|
||||
// who do not want to get called from the root context. This means that
|
||||
// they are likely dependencies (e.g., sysroot creation) or similar, and
|
||||
|
@ -93,13 +88,20 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct RunConfig<'a> {
|
||||
pub builder: &'a Builder<'a>,
|
||||
pub host: Interned<String>,
|
||||
pub target: Interned<String>,
|
||||
pub path: Option<&'a Path>,
|
||||
}
|
||||
|
||||
struct StepDescription {
|
||||
default: bool,
|
||||
only_hosts: bool,
|
||||
only_build_targets: bool,
|
||||
only_build: bool,
|
||||
should_run: fn(ShouldRun) -> ShouldRun,
|
||||
make_run: fn(&Builder, Option<&Path>, Interned<String>, Interned<String>),
|
||||
make_run: fn(RunConfig),
|
||||
}
|
||||
|
||||
impl StepDescription {
|
||||
|
@ -146,7 +148,13 @@ impl StepDescription {
|
|||
|
||||
for host in hosts {
|
||||
for target in targets {
|
||||
(self.make_run)(builder, path, *host, *target);
|
||||
let run = RunConfig {
|
||||
builder,
|
||||
path,
|
||||
host: *host,
|
||||
target: *target,
|
||||
};
|
||||
(self.make_run)(run);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ use util::{self, dylib_path, dylib_path_var};
|
|||
|
||||
use compile;
|
||||
use native;
|
||||
use builder::{Kind, ShouldRun, Builder, Compiler, Step};
|
||||
use builder::{Kind, RunConfig, ShouldRun, Builder, Compiler, Step};
|
||||
use tool::{self, Tool};
|
||||
use cache::{INTERNER, Interned};
|
||||
|
||||
|
@ -119,13 +119,8 @@ impl Step for Linkcheck {
|
|||
run.path("src/tools/linkchecker").default_condition(builder.build.config.docs)
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder,
|
||||
path: Option<&Path>,
|
||||
host: Interned<String>,
|
||||
_target: Interned<String>,
|
||||
) {
|
||||
builder.ensure(Linkcheck { host });
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Linkcheck { host: run.host });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,15 +138,10 @@ impl Step for Cargotest {
|
|||
run.path("src/tools/cargotest")
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder,
|
||||
_path: Option<&Path>,
|
||||
host: Interned<String>,
|
||||
_target: Interned<String>,
|
||||
) {
|
||||
builder.ensure(Cargotest {
|
||||
stage: builder.top_stage,
|
||||
host: host,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Cargotest {
|
||||
stage: run.builder.top_stage,
|
||||
host: run.host,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -193,15 +183,10 @@ impl Step for Cargo {
|
|||
run.path("src/tools/cargo")
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder,
|
||||
_path: Option<&Path>,
|
||||
_host: Interned<String>,
|
||||
target: Interned<String>,
|
||||
) {
|
||||
builder.ensure(Cargo {
|
||||
stage: builder.top_stage,
|
||||
host: target,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Cargo {
|
||||
stage: run.builder.top_stage,
|
||||
host: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -242,15 +227,10 @@ impl Step for Rls {
|
|||
run.path("src/tools/rls")
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder,
|
||||
_path: Option<&Path>,
|
||||
_host: Interned<String>,
|
||||
target: Interned<String>,
|
||||
) {
|
||||
builder.ensure(Rls {
|
||||
stage: builder.top_stage,
|
||||
host: target,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Rls {
|
||||
stage: run.builder.top_stage,
|
||||
host: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -320,14 +300,9 @@ impl Step for Tidy {
|
|||
run.path("src/tools/tidy")
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder,
|
||||
_path: Option<&Path>,
|
||||
_host: Interned<String>,
|
||||
_target: Interned<String>,
|
||||
) {
|
||||
builder.ensure(Tidy {
|
||||
host: builder.build.build,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Tidy {
|
||||
host: run.builder.build.build,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -382,15 +357,10 @@ impl Step for DefaultCompiletest {
|
|||
run
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder,
|
||||
path: Option<&Path>,
|
||||
host: Interned<String>,
|
||||
target: Interned<String>,
|
||||
) {
|
||||
let compiler = builder.compiler(builder.top_stage, host);
|
||||
fn make_run(run: RunConfig) {
|
||||
let compiler = run.builder.compiler(run.builder.top_stage, run.host);
|
||||
|
||||
let test = path.map(|path| {
|
||||
let test = run.path.map(|path| {
|
||||
DEFAULT_COMPILETESTS.iter().find(|&&test| {
|
||||
path.ends_with(test.path)
|
||||
}).unwrap_or_else(|| {
|
||||
|
@ -399,17 +369,17 @@ impl Step for DefaultCompiletest {
|
|||
});
|
||||
|
||||
if let Some(test) = test {
|
||||
builder.ensure(DefaultCompiletest {
|
||||
run.builder.ensure(DefaultCompiletest {
|
||||
compiler,
|
||||
target,
|
||||
target: run.target,
|
||||
mode: test.mode,
|
||||
suite: test.suite,
|
||||
});
|
||||
} else {
|
||||
for test in DEFAULT_COMPILETESTS {
|
||||
builder.ensure(DefaultCompiletest {
|
||||
run.builder.ensure(DefaultCompiletest {
|
||||
compiler,
|
||||
target,
|
||||
target: run.target,
|
||||
mode: test.mode,
|
||||
suite: test.suite
|
||||
});
|
||||
|
@ -468,15 +438,10 @@ impl Step for HostCompiletest {
|
|||
run
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder,
|
||||
path: Option<&Path>,
|
||||
host: Interned<String>,
|
||||
target: Interned<String>,
|
||||
) {
|
||||
let compiler = builder.compiler(builder.top_stage, host);
|
||||
fn make_run(run: RunConfig) {
|
||||
let compiler = run.builder.compiler(run.builder.top_stage, run.host);
|
||||
|
||||
let test = path.map(|path| {
|
||||
let test = run.path.map(|path| {
|
||||
HOST_COMPILETESTS.iter().find(|&&test| {
|
||||
path.ends_with(test.path)
|
||||
}).unwrap_or_else(|| {
|
||||
|
@ -485,17 +450,17 @@ impl Step for HostCompiletest {
|
|||
});
|
||||
|
||||
if let Some(test) = test {
|
||||
builder.ensure(HostCompiletest {
|
||||
run.builder.ensure(HostCompiletest {
|
||||
compiler,
|
||||
target,
|
||||
target: run.target,
|
||||
mode: test.mode,
|
||||
suite: test.suite,
|
||||
});
|
||||
} else {
|
||||
for test in HOST_COMPILETESTS {
|
||||
builder.ensure(HostCompiletest {
|
||||
run.builder.ensure(HostCompiletest {
|
||||
compiler,
|
||||
target,
|
||||
target: run.target,
|
||||
mode: test.mode,
|
||||
suite: test.suite
|
||||
});
|
||||
|
@ -739,14 +704,9 @@ impl Step for Docs {
|
|||
run.path("src/doc")
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder,
|
||||
_path: Option<&Path>,
|
||||
host: Interned<String>,
|
||||
_target: Interned<String>,
|
||||
) {
|
||||
builder.ensure(Docs {
|
||||
compiler: builder.compiler(builder.top_stage, host),
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Docs {
|
||||
compiler: run.builder.compiler(run.builder.top_stage, run.host),
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -802,14 +762,9 @@ impl Step for ErrorIndex {
|
|||
run.path("src/tools/error_index_generator")
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder,
|
||||
_path: Option<&Path>,
|
||||
host: Interned<String>,
|
||||
_target: Interned<String>,
|
||||
) {
|
||||
builder.ensure(ErrorIndex {
|
||||
compiler: builder.compiler(builder.top_stage, host),
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(ErrorIndex {
|
||||
compiler: run.builder.compiler(run.builder.top_stage, run.host),
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -886,15 +841,11 @@ impl Step for CrateLibrustc {
|
|||
run.krate("rustc-main")
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder,
|
||||
path: Option<&Path>,
|
||||
host: Interned<String>,
|
||||
target: Interned<String>,
|
||||
) {
|
||||
let compiler = builder.compiler(builder.top_stage, host);
|
||||
fn make_run(run: RunConfig) {
|
||||
let builder = run.builder;
|
||||
let compiler = builder.compiler(builder.top_stage, run.host);
|
||||
|
||||
let run = |name: Option<Interned<String>>| {
|
||||
let make = |name: Option<Interned<String>>| {
|
||||
let test_kind = if builder.kind == Kind::Test {
|
||||
TestKind::Test
|
||||
} else if builder.kind == Kind::Bench {
|
||||
|
@ -905,20 +856,20 @@ impl Step for CrateLibrustc {
|
|||
|
||||
builder.ensure(CrateLibrustc {
|
||||
compiler,
|
||||
target,
|
||||
target: run.target,
|
||||
test_kind: test_kind,
|
||||
krate: name,
|
||||
});
|
||||
};
|
||||
|
||||
if let Some(path) = path {
|
||||
if let Some(path) = run.path {
|
||||
for (name, krate_path) in builder.crates("rustc-main") {
|
||||
if path.ends_with(krate_path) {
|
||||
run(Some(name));
|
||||
make(Some(name));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
run(None);
|
||||
make(None);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -952,15 +903,11 @@ impl Step for Crate {
|
|||
run.krate("std").krate("test")
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder,
|
||||
path: Option<&Path>,
|
||||
host: Interned<String>,
|
||||
target: Interned<String>,
|
||||
) {
|
||||
let compiler = builder.compiler(builder.top_stage, host);
|
||||
fn make_run(run: RunConfig) {
|
||||
let builder = run.builder;
|
||||
let compiler = builder.compiler(builder.top_stage, run.host);
|
||||
|
||||
let run = |mode: Mode, name: Option<Interned<String>>| {
|
||||
let make = |mode: Mode, name: Option<Interned<String>>| {
|
||||
let test_kind = if builder.kind == Kind::Test {
|
||||
TestKind::Test
|
||||
} else if builder.kind == Kind::Bench {
|
||||
|
@ -970,27 +917,28 @@ impl Step for Crate {
|
|||
};
|
||||
|
||||
builder.ensure(Crate {
|
||||
compiler, target,
|
||||
compiler,
|
||||
target: run.target,
|
||||
mode: mode,
|
||||
test_kind: test_kind,
|
||||
krate: name,
|
||||
});
|
||||
};
|
||||
|
||||
if let Some(path) = path {
|
||||
if let Some(path) = run.path {
|
||||
for (name, krate_path) in builder.crates("std") {
|
||||
if path.ends_with(krate_path) {
|
||||
run(Mode::Libstd, Some(name));
|
||||
make(Mode::Libstd, Some(name));
|
||||
}
|
||||
}
|
||||
for (name, krate_path) in builder.crates("test") {
|
||||
if path.ends_with(krate_path) {
|
||||
run(Mode::Libtest, Some(name));
|
||||
make(Mode::Libtest, Some(name));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
run(Mode::Libstd, None);
|
||||
run(Mode::Libtest, None);
|
||||
make(Mode::Libstd, None);
|
||||
make(Mode::Libtest, None);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1333,12 +1281,7 @@ impl Step for Bootstrap {
|
|||
run.path("src/bootstrap")
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder,
|
||||
_path: Option<&Path>,
|
||||
_host: Interned<String>,
|
||||
_target: Interned<String>,
|
||||
) {
|
||||
builder.ensure(Bootstrap);
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Bootstrap);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ use {Build, Compiler, Mode};
|
|||
use native;
|
||||
|
||||
use cache::{INTERNER, Interned};
|
||||
use builder::{Step, ShouldRun, Builder};
|
||||
use builder::{Step, RunConfig, ShouldRun, Builder};
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct Std {
|
||||
|
@ -50,15 +50,10 @@ impl Step for Std {
|
|||
run.path("src/libstd").krate("std")
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder,
|
||||
_path: Option<&Path>,
|
||||
host: Interned<String>,
|
||||
target: Interned<String>,
|
||||
) {
|
||||
builder.ensure(Std {
|
||||
compiler: builder.compiler(builder.top_stage, host),
|
||||
target,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Std {
|
||||
compiler: run.builder.compiler(run.builder.top_stage, run.host),
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -233,15 +228,10 @@ impl Step for StartupObjects {
|
|||
run.path("src/rtstartup")
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder,
|
||||
_path: Option<&Path>,
|
||||
host: Interned<String>,
|
||||
target: Interned<String>,
|
||||
) {
|
||||
builder.ensure(StartupObjects {
|
||||
compiler: builder.compiler(builder.top_stage, host),
|
||||
target,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(StartupObjects {
|
||||
compiler: run.builder.compiler(run.builder.top_stage, run.host),
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -300,15 +290,10 @@ impl Step for Test {
|
|||
run.path("src/libtest").krate("test")
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder,
|
||||
_path: Option<&Path>,
|
||||
host: Interned<String>,
|
||||
target: Interned<String>,
|
||||
) {
|
||||
builder.ensure(Test {
|
||||
compiler: builder.compiler(builder.top_stage, host),
|
||||
target,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Test {
|
||||
compiler: run.builder.compiler(run.builder.top_stage, run.host),
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -407,15 +392,10 @@ impl Step for Rustc {
|
|||
run.path("src/librustc").krate("rustc-main")
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder,
|
||||
_path: Option<&Path>,
|
||||
host: Interned<String>,
|
||||
target: Interned<String>,
|
||||
) {
|
||||
builder.ensure(Rustc {
|
||||
compiler: builder.compiler(builder.top_stage, host),
|
||||
target,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Rustc {
|
||||
compiler: run.builder.compiler(run.builder.top_stage, run.host),
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ use build_helper::output;
|
|||
use {Build, Compiler, Mode};
|
||||
use channel;
|
||||
use util::{cp_r, libdir, is_dylib, cp_filtered, copy, exe};
|
||||
use builder::{Builder, ShouldRun, Step};
|
||||
use builder::{Builder, RunConfig, ShouldRun, Step};
|
||||
use compile;
|
||||
use tool::{self, Tool};
|
||||
use cache::{INTERNER, Interned};
|
||||
|
@ -72,12 +72,10 @@ impl Step for Docs {
|
|||
run.path("src/doc")
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder, _path: Option<&Path>, _host: Interned<String>, target: Interned<String>,
|
||||
) {
|
||||
builder.ensure(Docs {
|
||||
stage: builder.top_stage,
|
||||
target: target,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Docs {
|
||||
stage: run.builder.top_stage,
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -275,10 +273,8 @@ impl Step for Mingw {
|
|||
run.never()
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder, _path: Option<&Path>, _host: Interned<String>, target: Interned<String>
|
||||
) {
|
||||
builder.ensure(Mingw { target });
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Mingw { target: run.target });
|
||||
}
|
||||
|
||||
/// Build the `rust-mingw` installer component.
|
||||
|
@ -338,12 +334,10 @@ impl Step for Rustc {
|
|||
run.path("src/librustc")
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder, _path: Option<&Path>, _host: Interned<String>, target: Interned<String>
|
||||
) {
|
||||
builder.ensure(Rustc {
|
||||
stage: builder.top_stage,
|
||||
target: target,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Rustc {
|
||||
stage: run.builder.top_stage,
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -475,12 +469,10 @@ impl Step for DebuggerScripts {
|
|||
run.path("src/lldb_batchmode.py")
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder, _path: Option<&Path>, host: Interned<String>, target: Interned<String>
|
||||
) {
|
||||
builder.ensure(DebuggerScripts {
|
||||
sysroot: builder.sysroot(builder.compiler(builder.top_stage, host)),
|
||||
target: target,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(DebuggerScripts {
|
||||
sysroot: run.builder.sysroot(run.builder.compiler(run.builder.top_stage, run.host)),
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -535,12 +527,10 @@ impl Step for Std {
|
|||
run.path("src/libstd")
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder, _path: Option<&Path>, host: Interned<String>, target: Interned<String>
|
||||
) {
|
||||
builder.ensure(Std {
|
||||
compiler: builder.compiler(builder.top_stage, host),
|
||||
target: target,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Std {
|
||||
compiler: run.builder.compiler(run.builder.top_stage, run.host),
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -611,15 +601,10 @@ impl Step for Analysis {
|
|||
run.path("analysis").default_condition(builder.build.config.extended)
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder,
|
||||
path: Option<&Path>,
|
||||
host: Interned<String>,
|
||||
target: Interned<String>
|
||||
) {
|
||||
builder.ensure(Analysis {
|
||||
compiler: builder.compiler(builder.top_stage, host),
|
||||
target: target,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Analysis {
|
||||
compiler: run.builder.compiler(run.builder.top_stage, run.host),
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -728,10 +713,8 @@ impl Step for Src {
|
|||
run.path("src")
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder, _path: Option<&Path>, _host: Interned<String>, _target: Interned<String>
|
||||
) {
|
||||
builder.ensure(Src);
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Src);
|
||||
}
|
||||
|
||||
/// Creates the `rust-src` installer component
|
||||
|
@ -820,10 +803,8 @@ impl Step for PlainSourceTarball {
|
|||
run.path("src").default_condition(builder.config.rust_dist_src)
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder, path: Option<&Path>, _host: Interned<String>, _target: Interned<String>
|
||||
) {
|
||||
builder.ensure(PlainSourceTarball);
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(PlainSourceTarball);
|
||||
}
|
||||
|
||||
/// Creates the plain source tarball
|
||||
|
@ -962,12 +943,10 @@ impl Step for Cargo {
|
|||
run.path("cargo")
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder, _path: Option<&Path>, _host: Interned<String>, target: Interned<String>
|
||||
) {
|
||||
builder.ensure(Cargo {
|
||||
stage: builder.top_stage,
|
||||
target: target,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Cargo {
|
||||
stage: run.builder.top_stage,
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1054,12 +1033,10 @@ impl Step for Rls {
|
|||
run.path("rls")
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder, _path: Option<&Path>, _host: Interned<String>, target: Interned<String>
|
||||
) {
|
||||
builder.ensure(Rls {
|
||||
stage: builder.top_stage,
|
||||
target: target,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Rls {
|
||||
stage: run.builder.top_stage,
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1137,12 +1114,10 @@ impl Step for Extended {
|
|||
run.path("cargo").default_condition(builder.config.extended)
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder, path: Option<&Path>, _host: Interned<String>, target: Interned<String>
|
||||
) {
|
||||
builder.ensure(Extended {
|
||||
stage: builder.top_stage,
|
||||
target: target,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Extended {
|
||||
stage: run.builder.top_stage,
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1535,10 +1510,8 @@ impl Step for HashSign {
|
|||
run.path("hash-and-sign")
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder, _path: Option<&Path>, _host: Interned<String>, _target: Interned<String>
|
||||
) {
|
||||
builder.ensure(HashSign);
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(HashSign);
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder) {
|
||||
|
|
|
@ -27,7 +27,7 @@ use Mode;
|
|||
use build_helper::up_to_date;
|
||||
|
||||
use util::{cp_r, symlink_dir};
|
||||
use builder::{Builder, ShouldRun, Step};
|
||||
use builder::{Builder, RunConfig, ShouldRun, Step};
|
||||
use tool::Tool;
|
||||
use compile;
|
||||
use cache::{INTERNER, Interned};
|
||||
|
@ -49,19 +49,9 @@ macro_rules! book {
|
|||
run.path($path).default_condition(builder.build.config.docs)
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder,
|
||||
path: Option<&Path>,
|
||||
_host: Interned<String>,
|
||||
target: Interned<String>
|
||||
) {
|
||||
if path.is_none() && !builder.build.config.docs {
|
||||
// Not a default rule if docs are disabled.
|
||||
return;
|
||||
}
|
||||
|
||||
builder.ensure($name {
|
||||
target,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure($name {
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -124,11 +114,9 @@ impl Step for UnstableBook {
|
|||
run.path("src/doc/unstable-book").default_condition(builder.build.config.docs)
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder, path: Option<&Path>, _host: Interned<String>, target: Interned<String>
|
||||
) {
|
||||
builder.ensure(UnstableBook {
|
||||
target,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(UnstableBook {
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -202,11 +190,9 @@ impl Step for TheBook {
|
|||
run.path("src/doc/book").default_condition(builder.build.config.docs)
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder, path: Option<&Path>, _host: Interned<String>, target: Interned<String>
|
||||
) {
|
||||
builder.ensure(TheBook {
|
||||
target,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(TheBook {
|
||||
target: run.target,
|
||||
name: "book",
|
||||
});
|
||||
}
|
||||
|
@ -308,19 +294,13 @@ impl Step for Standalone {
|
|||
const DEFAULT: bool = true;
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
run.path("src/doc")
|
||||
let builder = run.builder;
|
||||
run.path("src/doc").default_condition(builder.build.config.docs)
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder, path: Option<&Path>, _host: Interned<String>, target: Interned<String>
|
||||
) {
|
||||
if path.is_none() && !builder.build.config.docs {
|
||||
// Not a default rule if docs are disabled.
|
||||
return;
|
||||
}
|
||||
|
||||
builder.ensure(Standalone {
|
||||
target,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Standalone {
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -414,12 +394,10 @@ impl Step for Std {
|
|||
run.krate("std").default_condition(builder.build.config.docs)
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder, path: Option<&Path>, _host: Interned<String>, target: Interned<String>
|
||||
) {
|
||||
builder.ensure(Std {
|
||||
stage: builder.top_stage,
|
||||
target
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Std {
|
||||
stage: run.builder.top_stage,
|
||||
target: run.target
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -503,12 +481,10 @@ impl Step for Test {
|
|||
run.krate("test").default_condition(builder.config.compiler_docs)
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder, path: Option<&Path>, _host: Interned<String>, target: Interned<String>
|
||||
) {
|
||||
builder.ensure(Test {
|
||||
stage: builder.top_stage,
|
||||
target
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Test {
|
||||
stage: run.builder.top_stage,
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -567,12 +543,10 @@ impl Step for Rustc {
|
|||
run.krate("rustc-main").default_condition(builder.build.config.docs)
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder, path: Option<&Path>, _host: Interned<String>, target: Interned<String>
|
||||
) {
|
||||
builder.ensure(Rustc {
|
||||
stage: builder.top_stage,
|
||||
target
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Rustc {
|
||||
stage: run.builder.top_stage,
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -647,11 +621,9 @@ impl Step for ErrorIndex {
|
|||
run.path("src/tools/error_index_generator").default_condition(builder.build.config.docs)
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder, path: Option<&Path>, _host: Interned<String>, target: Interned<String>
|
||||
) {
|
||||
builder.ensure(ErrorIndex {
|
||||
target,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(ErrorIndex {
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -695,11 +667,9 @@ impl Step for UnstableBookGen {
|
|||
run.path("src/tools/unstable-book-gen").default_condition(builder.build.config.docs)
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder, path: Option<&Path>, _host: Interned<String>, target: Interned<String>,
|
||||
) {
|
||||
builder.ensure(UnstableBookGen {
|
||||
target,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(UnstableBookGen {
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ use std::process::Command;
|
|||
|
||||
use dist::{self, pkgname, sanitize_sh, tmpdir};
|
||||
|
||||
use builder::{Builder, ShouldRun, Step};
|
||||
use builder::{Builder, RunConfig, ShouldRun, Step};
|
||||
use cache::Interned;
|
||||
|
||||
pub fn install_docs(builder: &Builder, stage: u32, host: Interned<String>) {
|
||||
|
@ -128,7 +128,7 @@ fn add_destdir(path: &Path, destdir: &Option<PathBuf>) -> PathBuf {
|
|||
}
|
||||
|
||||
macro_rules! install {
|
||||
(($sel:ident, $builder:ident),
|
||||
(($sel:ident, $builder:ident, $_config:ident),
|
||||
$($name:ident,
|
||||
$path:expr,
|
||||
$default_cond:expr,
|
||||
|
@ -150,20 +150,15 @@ macro_rules! install {
|
|||
$(const $c: bool = true;)*
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
let $builder = run.builder;
|
||||
let $_config = &run.builder.config;
|
||||
run.path($path).default_condition($default_cond)
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
$builder: &Builder,
|
||||
path: Option<&Path>,
|
||||
host: Interned<String>,
|
||||
target: Interned<String>,
|
||||
) {
|
||||
$builder.ensure($name {
|
||||
stage: $builder.top_stage,
|
||||
target,
|
||||
host,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure($name {
|
||||
stage: run.builder.top_stage,
|
||||
target: run.target,
|
||||
host: run.host,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -174,8 +169,8 @@ macro_rules! install {
|
|||
}
|
||||
}
|
||||
|
||||
install!((self, builder),
|
||||
Docs, "src/doc", builder.build.config.docs, only_hosts: false, {
|
||||
install!((self, builder, _config),
|
||||
Docs, "src/doc", _config.docs, only_hosts: false, {
|
||||
builder.ensure(dist::Docs { stage: self.stage, target: self.target });
|
||||
install_docs(builder, self.stage, self.target);
|
||||
};
|
||||
|
@ -186,26 +181,26 @@ install!((self, builder),
|
|||
});
|
||||
install_std(builder, self.stage);
|
||||
};
|
||||
Cargo, "cargo", builder.build.config.extended, only_hosts: true, {
|
||||
Cargo, "cargo", _config.extended, only_hosts: true, {
|
||||
builder.ensure(dist::Cargo { stage: self.stage, target: self.target });
|
||||
install_cargo(builder, self.stage, self.target);
|
||||
};
|
||||
Rls, "rls", builder.build.config.extended, only_hosts: true, {
|
||||
Rls, "rls", _config.extended, only_hosts: true, {
|
||||
builder.ensure(dist::Rls { stage: self.stage, target: self.target });
|
||||
install_rls(builder, self.stage, self.target);
|
||||
};
|
||||
Analysis, "analysis", builder.build.config.extended, only_hosts: false, {
|
||||
Analysis, "analysis", _config.extended, only_hosts: false, {
|
||||
builder.ensure(dist::Analysis {
|
||||
compiler: builder.compiler(self.stage, self.host),
|
||||
target: self.target
|
||||
});
|
||||
install_analysis(builder, self.stage, self.target);
|
||||
};
|
||||
Src, "src", builder.build.config.extended, only_hosts: true, {
|
||||
Src, "src", _config.extended, only_hosts: true, {
|
||||
builder.ensure(dist::Src);
|
||||
install_src(builder, self.stage);
|
||||
}, ONLY_BUILD;
|
||||
Rustc, "src/librustc", builder.build.config.extended, only_hosts: true, {
|
||||
Rustc, "src/librustc", _config.extended, only_hosts: true, {
|
||||
builder.ensure(dist::Rustc { stage: self.stage, target: self.target });
|
||||
install_rustc(builder, self.stage, self.target);
|
||||
};
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
//! provide those libraries for it; they are mostly equivalent to constructing
|
||||
//! the stage1/bin compiler so we don't go through them individually.
|
||||
//!
|
||||
//! ## Uplifiting stage1 {std,test,rustc}
|
||||
//! ## Uplifting stage1 {std,test,rustc}
|
||||
//!
|
||||
//! This step copies the libraries from the stage1 compiler sysroot into the
|
||||
//! stage2 compiler. This is done to avoid rebuilding the compiler; libraries
|
||||
|
|
|
@ -32,7 +32,7 @@ use gcc;
|
|||
use Build;
|
||||
use util;
|
||||
use build_helper::up_to_date;
|
||||
use builder::{Builder, ShouldRun, Step};
|
||||
use builder::{Builder, RunConfig, ShouldRun, Step};
|
||||
use cache::Interned;
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||
|
@ -247,13 +247,8 @@ impl Step for TestHelpers {
|
|||
run.path("src/rt/rust_test_helpers.c")
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder,
|
||||
_path: Option<&Path>,
|
||||
_host: Interned<String>,
|
||||
target: Interned<String>,
|
||||
) {
|
||||
builder.ensure(TestHelpers { target })
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(TestHelpers { target: run.target })
|
||||
}
|
||||
|
||||
/// Compiles the `rust_test_helpers.c` library which we used in various
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
// except according to those terms.
|
||||
|
||||
use std::env;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
|
||||
use Mode;
|
||||
use Compiler;
|
||||
use builder::{Step, ShouldRun, Builder};
|
||||
use builder::{Step, RunConfig, ShouldRun, Builder};
|
||||
use util::{exe, add_lib_path};
|
||||
use compile::{self, libtest_stamp, libstd_stamp, librustc_stamp};
|
||||
use native;
|
||||
|
@ -163,15 +163,10 @@ macro_rules! tool {
|
|||
run.path($path)
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder,
|
||||
_path: Option<&Path>,
|
||||
_host: Interned<String>,
|
||||
target: Interned<String>
|
||||
) {
|
||||
builder.ensure($name {
|
||||
stage: builder.top_stage,
|
||||
target,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure($name {
|
||||
stage: run.builder.top_stage,
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -214,15 +209,10 @@ impl Step for RemoteTestServer {
|
|||
run.path("src/tools/remote-test-server")
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder,
|
||||
_path: Option<&Path>,
|
||||
_host: Interned<String>,
|
||||
target: Interned<String>
|
||||
) {
|
||||
builder.ensure(RemoteTestServer {
|
||||
stage: builder.top_stage,
|
||||
target,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(RemoteTestServer {
|
||||
stage: run.builder.top_stage,
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -252,12 +242,10 @@ impl Step for Cargo {
|
|||
run.path("src/tools/cargo").default_condition(builder.build.config.extended)
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder, path: Option<&Path>, _host: Interned<String>, target: Interned<String>
|
||||
) {
|
||||
builder.ensure(Cargo {
|
||||
stage: builder.top_stage,
|
||||
target,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Cargo {
|
||||
stage: run.builder.top_stage,
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -296,12 +284,10 @@ impl Step for Rls {
|
|||
run.path("src/tools/rls").default_condition(builder.build.config.extended)
|
||||
}
|
||||
|
||||
fn make_run(
|
||||
builder: &Builder, path: Option<&Path>, _host: Interned<String>, target: Interned<String>
|
||||
) {
|
||||
builder.ensure(Rls {
|
||||
stage: builder.top_stage,
|
||||
target,
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Rls {
|
||||
stage: run.builder.top_stage,
|
||||
target: run.target,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue