Change make_run signature to taking a RunConfig struct for refactorability.

This commit is contained in:
Mark Simulacrum
2017-07-20 17:51:07 -06:00
parent b05af49086
commit 6a67a050c6
9 changed files with 203 additions and 353 deletions

View File

@@ -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 /// 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 /// 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`. /// called if it is in the correct list below with a path of `None`.
fn make_run( fn make_run(_run: RunConfig) {
_builder: &Builder,
_path: Option<&Path>,
_host: Interned<String>,
_target: Interned<String>,
) {
// It is reasonable to not have an implementation of make_run for rules // 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 // 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 // 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 { struct StepDescription {
default: bool, default: bool,
only_hosts: bool, only_hosts: bool,
only_build_targets: bool, only_build_targets: bool,
only_build: bool, only_build: bool,
should_run: fn(ShouldRun) -> ShouldRun, should_run: fn(ShouldRun) -> ShouldRun,
make_run: fn(&Builder, Option<&Path>, Interned<String>, Interned<String>), make_run: fn(RunConfig),
} }
impl StepDescription { impl StepDescription {
@@ -146,7 +148,13 @@ impl StepDescription {
for host in hosts { for host in hosts {
for target in targets { for target in targets {
(self.make_run)(builder, path, *host, *target); let run = RunConfig {
builder,
path,
host: *host,
target: *target,
};
(self.make_run)(run);
} }
} }
} }

View File

@@ -31,7 +31,7 @@ use util::{self, dylib_path, dylib_path_var};
use compile; use compile;
use native; use native;
use builder::{Kind, ShouldRun, Builder, Compiler, Step}; use builder::{Kind, RunConfig, ShouldRun, Builder, Compiler, Step};
use tool::{self, Tool}; use tool::{self, Tool};
use cache::{INTERNER, Interned}; use cache::{INTERNER, Interned};
@@ -119,13 +119,8 @@ impl Step for Linkcheck {
run.path("src/tools/linkchecker").default_condition(builder.build.config.docs) run.path("src/tools/linkchecker").default_condition(builder.build.config.docs)
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, run.builder.ensure(Linkcheck { host: run.host });
path: Option<&Path>,
host: Interned<String>,
_target: Interned<String>,
) {
builder.ensure(Linkcheck { host });
} }
} }
@@ -143,15 +138,10 @@ impl Step for Cargotest {
run.path("src/tools/cargotest") run.path("src/tools/cargotest")
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, run.builder.ensure(Cargotest {
_path: Option<&Path>, stage: run.builder.top_stage,
host: Interned<String>, host: run.host,
_target: Interned<String>,
) {
builder.ensure(Cargotest {
stage: builder.top_stage,
host: host,
}); });
} }
@@ -193,15 +183,10 @@ impl Step for Cargo {
run.path("src/tools/cargo") run.path("src/tools/cargo")
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, run.builder.ensure(Cargo {
_path: Option<&Path>, stage: run.builder.top_stage,
_host: Interned<String>, host: run.target,
target: Interned<String>,
) {
builder.ensure(Cargo {
stage: builder.top_stage,
host: target,
}); });
} }
@@ -242,15 +227,10 @@ impl Step for Rls {
run.path("src/tools/rls") run.path("src/tools/rls")
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, run.builder.ensure(Rls {
_path: Option<&Path>, stage: run.builder.top_stage,
_host: Interned<String>, host: run.target,
target: Interned<String>,
) {
builder.ensure(Rls {
stage: builder.top_stage,
host: target,
}); });
} }
@@ -320,14 +300,9 @@ impl Step for Tidy {
run.path("src/tools/tidy") run.path("src/tools/tidy")
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, run.builder.ensure(Tidy {
_path: Option<&Path>, host: run.builder.build.build,
_host: Interned<String>,
_target: Interned<String>,
) {
builder.ensure(Tidy {
host: builder.build.build,
}); });
} }
} }
@@ -382,15 +357,10 @@ impl Step for DefaultCompiletest {
run run
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, let compiler = run.builder.compiler(run.builder.top_stage, run.host);
path: Option<&Path>,
host: Interned<String>,
target: Interned<String>,
) {
let compiler = builder.compiler(builder.top_stage, host);
let test = path.map(|path| { let test = run.path.map(|path| {
DEFAULT_COMPILETESTS.iter().find(|&&test| { DEFAULT_COMPILETESTS.iter().find(|&&test| {
path.ends_with(test.path) path.ends_with(test.path)
}).unwrap_or_else(|| { }).unwrap_or_else(|| {
@@ -399,17 +369,17 @@ impl Step for DefaultCompiletest {
}); });
if let Some(test) = test { if let Some(test) = test {
builder.ensure(DefaultCompiletest { run.builder.ensure(DefaultCompiletest {
compiler, compiler,
target, target: run.target,
mode: test.mode, mode: test.mode,
suite: test.suite, suite: test.suite,
}); });
} else { } else {
for test in DEFAULT_COMPILETESTS { for test in DEFAULT_COMPILETESTS {
builder.ensure(DefaultCompiletest { run.builder.ensure(DefaultCompiletest {
compiler, compiler,
target, target: run.target,
mode: test.mode, mode: test.mode,
suite: test.suite suite: test.suite
}); });
@@ -468,15 +438,10 @@ impl Step for HostCompiletest {
run run
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, let compiler = run.builder.compiler(run.builder.top_stage, run.host);
path: Option<&Path>,
host: Interned<String>,
target: Interned<String>,
) {
let compiler = builder.compiler(builder.top_stage, host);
let test = path.map(|path| { let test = run.path.map(|path| {
HOST_COMPILETESTS.iter().find(|&&test| { HOST_COMPILETESTS.iter().find(|&&test| {
path.ends_with(test.path) path.ends_with(test.path)
}).unwrap_or_else(|| { }).unwrap_or_else(|| {
@@ -485,17 +450,17 @@ impl Step for HostCompiletest {
}); });
if let Some(test) = test { if let Some(test) = test {
builder.ensure(HostCompiletest { run.builder.ensure(HostCompiletest {
compiler, compiler,
target, target: run.target,
mode: test.mode, mode: test.mode,
suite: test.suite, suite: test.suite,
}); });
} else { } else {
for test in HOST_COMPILETESTS { for test in HOST_COMPILETESTS {
builder.ensure(HostCompiletest { run.builder.ensure(HostCompiletest {
compiler, compiler,
target, target: run.target,
mode: test.mode, mode: test.mode,
suite: test.suite suite: test.suite
}); });
@@ -739,14 +704,9 @@ impl Step for Docs {
run.path("src/doc") run.path("src/doc")
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, run.builder.ensure(Docs {
_path: Option<&Path>, compiler: run.builder.compiler(run.builder.top_stage, run.host),
host: Interned<String>,
_target: Interned<String>,
) {
builder.ensure(Docs {
compiler: builder.compiler(builder.top_stage, host),
}); });
} }
@@ -802,14 +762,9 @@ impl Step for ErrorIndex {
run.path("src/tools/error_index_generator") run.path("src/tools/error_index_generator")
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, run.builder.ensure(ErrorIndex {
_path: Option<&Path>, compiler: run.builder.compiler(run.builder.top_stage, run.host),
host: Interned<String>,
_target: Interned<String>,
) {
builder.ensure(ErrorIndex {
compiler: builder.compiler(builder.top_stage, host),
}); });
} }
@@ -886,15 +841,11 @@ impl Step for CrateLibrustc {
run.krate("rustc-main") run.krate("rustc-main")
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, let builder = run.builder;
path: Option<&Path>, let compiler = builder.compiler(builder.top_stage, run.host);
host: Interned<String>,
target: Interned<String>,
) {
let compiler = builder.compiler(builder.top_stage, host);
let run = |name: Option<Interned<String>>| { let make = |name: Option<Interned<String>>| {
let test_kind = if builder.kind == Kind::Test { let test_kind = if builder.kind == Kind::Test {
TestKind::Test TestKind::Test
} else if builder.kind == Kind::Bench { } else if builder.kind == Kind::Bench {
@@ -905,20 +856,20 @@ impl Step for CrateLibrustc {
builder.ensure(CrateLibrustc { builder.ensure(CrateLibrustc {
compiler, compiler,
target, target: run.target,
test_kind: test_kind, test_kind: test_kind,
krate: name, krate: name,
}); });
}; };
if let Some(path) = path { if let Some(path) = run.path {
for (name, krate_path) in builder.crates("rustc-main") { for (name, krate_path) in builder.crates("rustc-main") {
if path.ends_with(krate_path) { if path.ends_with(krate_path) {
run(Some(name)); make(Some(name));
} }
} }
} else { } else {
run(None); make(None);
} }
} }
@@ -952,15 +903,11 @@ impl Step for Crate {
run.krate("std").krate("test") run.krate("std").krate("test")
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, let builder = run.builder;
path: Option<&Path>, let compiler = builder.compiler(builder.top_stage, run.host);
host: Interned<String>,
target: Interned<String>,
) {
let compiler = builder.compiler(builder.top_stage, 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 { let test_kind = if builder.kind == Kind::Test {
TestKind::Test TestKind::Test
} else if builder.kind == Kind::Bench { } else if builder.kind == Kind::Bench {
@@ -970,27 +917,28 @@ impl Step for Crate {
}; };
builder.ensure(Crate { builder.ensure(Crate {
compiler, target, compiler,
target: run.target,
mode: mode, mode: mode,
test_kind: test_kind, test_kind: test_kind,
krate: name, krate: name,
}); });
}; };
if let Some(path) = path { if let Some(path) = run.path {
for (name, krate_path) in builder.crates("std") { for (name, krate_path) in builder.crates("std") {
if path.ends_with(krate_path) { if path.ends_with(krate_path) {
run(Mode::Libstd, Some(name)); make(Mode::Libstd, Some(name));
} }
} }
for (name, krate_path) in builder.crates("test") { for (name, krate_path) in builder.crates("test") {
if path.ends_with(krate_path) { if path.ends_with(krate_path) {
run(Mode::Libtest, Some(name)); make(Mode::Libtest, Some(name));
} }
} }
} else { } else {
run(Mode::Libstd, None); make(Mode::Libstd, None);
run(Mode::Libtest, None); make(Mode::Libtest, None);
} }
} }
@@ -1333,12 +1281,7 @@ impl Step for Bootstrap {
run.path("src/bootstrap") run.path("src/bootstrap")
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, run.builder.ensure(Bootstrap);
_path: Option<&Path>,
_host: Interned<String>,
_target: Interned<String>,
) {
builder.ensure(Bootstrap);
} }
} }

View File

@@ -34,7 +34,7 @@ use {Build, Compiler, Mode};
use native; use native;
use cache::{INTERNER, Interned}; use cache::{INTERNER, Interned};
use builder::{Step, ShouldRun, Builder}; use builder::{Step, RunConfig, ShouldRun, Builder};
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct Std { pub struct Std {
@@ -50,15 +50,10 @@ impl Step for Std {
run.path("src/libstd").krate("std") run.path("src/libstd").krate("std")
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, run.builder.ensure(Std {
_path: Option<&Path>, compiler: run.builder.compiler(run.builder.top_stage, run.host),
host: Interned<String>, target: run.target,
target: Interned<String>,
) {
builder.ensure(Std {
compiler: builder.compiler(builder.top_stage, host),
target,
}); });
} }
@@ -233,15 +228,10 @@ impl Step for StartupObjects {
run.path("src/rtstartup") run.path("src/rtstartup")
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, run.builder.ensure(StartupObjects {
_path: Option<&Path>, compiler: run.builder.compiler(run.builder.top_stage, run.host),
host: Interned<String>, target: run.target,
target: Interned<String>,
) {
builder.ensure(StartupObjects {
compiler: builder.compiler(builder.top_stage, host),
target,
}); });
} }
@@ -300,15 +290,10 @@ impl Step for Test {
run.path("src/libtest").krate("test") run.path("src/libtest").krate("test")
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, run.builder.ensure(Test {
_path: Option<&Path>, compiler: run.builder.compiler(run.builder.top_stage, run.host),
host: Interned<String>, target: run.target,
target: Interned<String>,
) {
builder.ensure(Test {
compiler: builder.compiler(builder.top_stage, host),
target,
}); });
} }
@@ -407,15 +392,10 @@ impl Step for Rustc {
run.path("src/librustc").krate("rustc-main") run.path("src/librustc").krate("rustc-main")
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, run.builder.ensure(Rustc {
_path: Option<&Path>, compiler: run.builder.compiler(run.builder.top_stage, run.host),
host: Interned<String>, target: run.target,
target: Interned<String>,
) {
builder.ensure(Rustc {
compiler: builder.compiler(builder.top_stage, host),
target,
}); });
} }

View File

@@ -29,7 +29,7 @@ use build_helper::output;
use {Build, Compiler, Mode}; use {Build, Compiler, Mode};
use channel; use channel;
use util::{cp_r, libdir, is_dylib, cp_filtered, copy, exe}; 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 compile;
use tool::{self, Tool}; use tool::{self, Tool};
use cache::{INTERNER, Interned}; use cache::{INTERNER, Interned};
@@ -72,12 +72,10 @@ impl Step for Docs {
run.path("src/doc") run.path("src/doc")
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, _path: Option<&Path>, _host: Interned<String>, target: Interned<String>, run.builder.ensure(Docs {
) { stage: run.builder.top_stage,
builder.ensure(Docs { target: run.target,
stage: builder.top_stage,
target: target,
}); });
} }
@@ -275,10 +273,8 @@ impl Step for Mingw {
run.never() run.never()
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, _path: Option<&Path>, _host: Interned<String>, target: Interned<String> run.builder.ensure(Mingw { target: run.target });
) {
builder.ensure(Mingw { target });
} }
/// Build the `rust-mingw` installer component. /// Build the `rust-mingw` installer component.
@@ -338,12 +334,10 @@ impl Step for Rustc {
run.path("src/librustc") run.path("src/librustc")
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, _path: Option<&Path>, _host: Interned<String>, target: Interned<String> run.builder.ensure(Rustc {
) { stage: run.builder.top_stage,
builder.ensure(Rustc { target: run.target,
stage: builder.top_stage,
target: target,
}); });
} }
@@ -475,12 +469,10 @@ impl Step for DebuggerScripts {
run.path("src/lldb_batchmode.py") run.path("src/lldb_batchmode.py")
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, _path: Option<&Path>, host: Interned<String>, target: Interned<String> run.builder.ensure(DebuggerScripts {
) { sysroot: run.builder.sysroot(run.builder.compiler(run.builder.top_stage, run.host)),
builder.ensure(DebuggerScripts { target: run.target,
sysroot: builder.sysroot(builder.compiler(builder.top_stage, host)),
target: target,
}); });
} }
@@ -535,12 +527,10 @@ impl Step for Std {
run.path("src/libstd") run.path("src/libstd")
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, _path: Option<&Path>, host: Interned<String>, target: Interned<String> run.builder.ensure(Std {
) { compiler: run.builder.compiler(run.builder.top_stage, run.host),
builder.ensure(Std { target: run.target,
compiler: builder.compiler(builder.top_stage, host),
target: target,
}); });
} }
@@ -611,15 +601,10 @@ impl Step for Analysis {
run.path("analysis").default_condition(builder.build.config.extended) run.path("analysis").default_condition(builder.build.config.extended)
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, run.builder.ensure(Analysis {
path: Option<&Path>, compiler: run.builder.compiler(run.builder.top_stage, run.host),
host: Interned<String>, target: run.target,
target: Interned<String>
) {
builder.ensure(Analysis {
compiler: builder.compiler(builder.top_stage, host),
target: target,
}); });
} }
@@ -728,10 +713,8 @@ impl Step for Src {
run.path("src") run.path("src")
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, _path: Option<&Path>, _host: Interned<String>, _target: Interned<String> run.builder.ensure(Src);
) {
builder.ensure(Src);
} }
/// Creates the `rust-src` installer component /// Creates the `rust-src` installer component
@@ -820,10 +803,8 @@ impl Step for PlainSourceTarball {
run.path("src").default_condition(builder.config.rust_dist_src) run.path("src").default_condition(builder.config.rust_dist_src)
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, path: Option<&Path>, _host: Interned<String>, _target: Interned<String> run.builder.ensure(PlainSourceTarball);
) {
builder.ensure(PlainSourceTarball);
} }
/// Creates the plain source tarball /// Creates the plain source tarball
@@ -962,12 +943,10 @@ impl Step for Cargo {
run.path("cargo") run.path("cargo")
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, _path: Option<&Path>, _host: Interned<String>, target: Interned<String> run.builder.ensure(Cargo {
) { stage: run.builder.top_stage,
builder.ensure(Cargo { target: run.target,
stage: builder.top_stage,
target: target,
}); });
} }
@@ -1054,12 +1033,10 @@ impl Step for Rls {
run.path("rls") run.path("rls")
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, _path: Option<&Path>, _host: Interned<String>, target: Interned<String> run.builder.ensure(Rls {
) { stage: run.builder.top_stage,
builder.ensure(Rls { target: run.target,
stage: builder.top_stage,
target: target,
}); });
} }
@@ -1137,12 +1114,10 @@ impl Step for Extended {
run.path("cargo").default_condition(builder.config.extended) run.path("cargo").default_condition(builder.config.extended)
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, path: Option<&Path>, _host: Interned<String>, target: Interned<String> run.builder.ensure(Extended {
) { stage: run.builder.top_stage,
builder.ensure(Extended { target: run.target,
stage: builder.top_stage,
target: target,
}); });
} }
@@ -1535,10 +1510,8 @@ impl Step for HashSign {
run.path("hash-and-sign") run.path("hash-and-sign")
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, _path: Option<&Path>, _host: Interned<String>, _target: Interned<String> run.builder.ensure(HashSign);
) {
builder.ensure(HashSign);
} }
fn run(self, builder: &Builder) { fn run(self, builder: &Builder) {

View File

@@ -27,7 +27,7 @@ use Mode;
use build_helper::up_to_date; use build_helper::up_to_date;
use util::{cp_r, symlink_dir}; use util::{cp_r, symlink_dir};
use builder::{Builder, ShouldRun, Step}; use builder::{Builder, RunConfig, ShouldRun, Step};
use tool::Tool; use tool::Tool;
use compile; use compile;
use cache::{INTERNER, Interned}; use cache::{INTERNER, Interned};
@@ -49,19 +49,9 @@ macro_rules! book {
run.path($path).default_condition(builder.build.config.docs) run.path($path).default_condition(builder.build.config.docs)
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, run.builder.ensure($name {
path: Option<&Path>, target: run.target,
_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,
}); });
} }
@@ -124,11 +114,9 @@ impl Step for UnstableBook {
run.path("src/doc/unstable-book").default_condition(builder.build.config.docs) run.path("src/doc/unstable-book").default_condition(builder.build.config.docs)
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, path: Option<&Path>, _host: Interned<String>, target: Interned<String> run.builder.ensure(UnstableBook {
) { target: run.target,
builder.ensure(UnstableBook {
target,
}); });
} }
@@ -202,11 +190,9 @@ impl Step for TheBook {
run.path("src/doc/book").default_condition(builder.build.config.docs) run.path("src/doc/book").default_condition(builder.build.config.docs)
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, path: Option<&Path>, _host: Interned<String>, target: Interned<String> run.builder.ensure(TheBook {
) { target: run.target,
builder.ensure(TheBook {
target,
name: "book", name: "book",
}); });
} }
@@ -308,19 +294,13 @@ impl Step for Standalone {
const DEFAULT: bool = true; const DEFAULT: bool = true;
fn should_run(run: ShouldRun) -> ShouldRun { 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( fn make_run(run: RunConfig) {
builder: &Builder, path: Option<&Path>, _host: Interned<String>, target: Interned<String> run.builder.ensure(Standalone {
) { target: run.target,
if path.is_none() && !builder.build.config.docs {
// Not a default rule if docs are disabled.
return;
}
builder.ensure(Standalone {
target,
}); });
} }
@@ -414,12 +394,10 @@ impl Step for Std {
run.krate("std").default_condition(builder.build.config.docs) run.krate("std").default_condition(builder.build.config.docs)
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, path: Option<&Path>, _host: Interned<String>, target: Interned<String> run.builder.ensure(Std {
) { stage: run.builder.top_stage,
builder.ensure(Std { target: run.target
stage: builder.top_stage,
target
}); });
} }
@@ -503,12 +481,10 @@ impl Step for Test {
run.krate("test").default_condition(builder.config.compiler_docs) run.krate("test").default_condition(builder.config.compiler_docs)
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, path: Option<&Path>, _host: Interned<String>, target: Interned<String> run.builder.ensure(Test {
) { stage: run.builder.top_stage,
builder.ensure(Test { target: run.target,
stage: builder.top_stage,
target
}); });
} }
@@ -567,12 +543,10 @@ impl Step for Rustc {
run.krate("rustc-main").default_condition(builder.build.config.docs) run.krate("rustc-main").default_condition(builder.build.config.docs)
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, path: Option<&Path>, _host: Interned<String>, target: Interned<String> run.builder.ensure(Rustc {
) { stage: run.builder.top_stage,
builder.ensure(Rustc { target: run.target,
stage: builder.top_stage,
target
}); });
} }
@@ -647,11 +621,9 @@ impl Step for ErrorIndex {
run.path("src/tools/error_index_generator").default_condition(builder.build.config.docs) run.path("src/tools/error_index_generator").default_condition(builder.build.config.docs)
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, path: Option<&Path>, _host: Interned<String>, target: Interned<String> run.builder.ensure(ErrorIndex {
) { target: run.target,
builder.ensure(ErrorIndex {
target,
}); });
} }
@@ -695,11 +667,9 @@ impl Step for UnstableBookGen {
run.path("src/tools/unstable-book-gen").default_condition(builder.build.config.docs) run.path("src/tools/unstable-book-gen").default_condition(builder.build.config.docs)
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, path: Option<&Path>, _host: Interned<String>, target: Interned<String>, run.builder.ensure(UnstableBookGen {
) { target: run.target,
builder.ensure(UnstableBookGen {
target,
}); });
} }

View File

@@ -20,7 +20,7 @@ use std::process::Command;
use dist::{self, pkgname, sanitize_sh, tmpdir}; use dist::{self, pkgname, sanitize_sh, tmpdir};
use builder::{Builder, ShouldRun, Step}; use builder::{Builder, RunConfig, ShouldRun, Step};
use cache::Interned; use cache::Interned;
pub fn install_docs(builder: &Builder, stage: u32, host: Interned<String>) { 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 { macro_rules! install {
(($sel:ident, $builder:ident), (($sel:ident, $builder:ident, $_config:ident),
$($name:ident, $($name:ident,
$path:expr, $path:expr,
$default_cond:expr, $default_cond:expr,
@@ -150,20 +150,15 @@ macro_rules! install {
$(const $c: bool = true;)* $(const $c: bool = true;)*
fn should_run(run: ShouldRun) -> ShouldRun { fn should_run(run: ShouldRun) -> ShouldRun {
let $builder = run.builder; let $_config = &run.builder.config;
run.path($path).default_condition($default_cond) run.path($path).default_condition($default_cond)
} }
fn make_run( fn make_run(run: RunConfig) {
$builder: &Builder, run.builder.ensure($name {
path: Option<&Path>, stage: run.builder.top_stage,
host: Interned<String>, target: run.target,
target: Interned<String>, host: run.host,
) {
$builder.ensure($name {
stage: $builder.top_stage,
target,
host,
}); });
} }
@@ -174,8 +169,8 @@ macro_rules! install {
} }
} }
install!((self, builder), install!((self, builder, _config),
Docs, "src/doc", builder.build.config.docs, only_hosts: false, { Docs, "src/doc", _config.docs, only_hosts: false, {
builder.ensure(dist::Docs { stage: self.stage, target: self.target }); builder.ensure(dist::Docs { stage: self.stage, target: self.target });
install_docs(builder, self.stage, self.target); install_docs(builder, self.stage, self.target);
}; };
@@ -186,26 +181,26 @@ install!((self, builder),
}); });
install_std(builder, self.stage); 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 }); builder.ensure(dist::Cargo { stage: self.stage, target: self.target });
install_cargo(builder, self.stage, 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 }); builder.ensure(dist::Rls { stage: self.stage, target: self.target });
install_rls(builder, self.stage, 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 { builder.ensure(dist::Analysis {
compiler: builder.compiler(self.stage, self.host), compiler: builder.compiler(self.stage, self.host),
target: self.target target: self.target
}); });
install_analysis(builder, self.stage, 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); builder.ensure(dist::Src);
install_src(builder, self.stage); install_src(builder, self.stage);
}, ONLY_BUILD; }, 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 }); builder.ensure(dist::Rustc { stage: self.stage, target: self.target });
install_rustc(builder, self.stage, self.target); install_rustc(builder, self.stage, self.target);
}; };

View File

@@ -96,7 +96,7 @@
//! provide those libraries for it; they are mostly equivalent to constructing //! provide those libraries for it; they are mostly equivalent to constructing
//! the stage1/bin compiler so we don't go through them individually. //! 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 //! This step copies the libraries from the stage1 compiler sysroot into the
//! stage2 compiler. This is done to avoid rebuilding the compiler; libraries //! stage2 compiler. This is done to avoid rebuilding the compiler; libraries

View File

@@ -32,7 +32,7 @@ use gcc;
use Build; use Build;
use util; use util;
use build_helper::up_to_date; use build_helper::up_to_date;
use builder::{Builder, ShouldRun, Step}; use builder::{Builder, RunConfig, ShouldRun, Step};
use cache::Interned; use cache::Interned;
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
@@ -247,13 +247,8 @@ impl Step for TestHelpers {
run.path("src/rt/rust_test_helpers.c") run.path("src/rt/rust_test_helpers.c")
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, run.builder.ensure(TestHelpers { target: run.target })
_path: Option<&Path>,
_host: Interned<String>,
target: Interned<String>,
) {
builder.ensure(TestHelpers { target })
} }
/// Compiles the `rust_test_helpers.c` library which we used in various /// Compiles the `rust_test_helpers.c` library which we used in various

View File

@@ -9,12 +9,12 @@
// except according to those terms. // except according to those terms.
use std::env; use std::env;
use std::path::{Path, PathBuf}; use std::path::PathBuf;
use std::process::Command; use std::process::Command;
use Mode; use Mode;
use Compiler; use Compiler;
use builder::{Step, ShouldRun, Builder}; use builder::{Step, RunConfig, ShouldRun, Builder};
use util::{exe, add_lib_path}; use util::{exe, add_lib_path};
use compile::{self, libtest_stamp, libstd_stamp, librustc_stamp}; use compile::{self, libtest_stamp, libstd_stamp, librustc_stamp};
use native; use native;
@@ -163,15 +163,10 @@ macro_rules! tool {
run.path($path) run.path($path)
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, run.builder.ensure($name {
_path: Option<&Path>, stage: run.builder.top_stage,
_host: Interned<String>, target: run.target,
target: Interned<String>
) {
builder.ensure($name {
stage: builder.top_stage,
target,
}); });
} }
@@ -214,15 +209,10 @@ impl Step for RemoteTestServer {
run.path("src/tools/remote-test-server") run.path("src/tools/remote-test-server")
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, run.builder.ensure(RemoteTestServer {
_path: Option<&Path>, stage: run.builder.top_stage,
_host: Interned<String>, target: run.target,
target: Interned<String>
) {
builder.ensure(RemoteTestServer {
stage: builder.top_stage,
target,
}); });
} }
@@ -252,12 +242,10 @@ impl Step for Cargo {
run.path("src/tools/cargo").default_condition(builder.build.config.extended) run.path("src/tools/cargo").default_condition(builder.build.config.extended)
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, path: Option<&Path>, _host: Interned<String>, target: Interned<String> run.builder.ensure(Cargo {
) { stage: run.builder.top_stage,
builder.ensure(Cargo { target: run.target,
stage: builder.top_stage,
target,
}); });
} }
@@ -296,12 +284,10 @@ impl Step for Rls {
run.path("src/tools/rls").default_condition(builder.build.config.extended) run.path("src/tools/rls").default_condition(builder.build.config.extended)
} }
fn make_run( fn make_run(run: RunConfig) {
builder: &Builder, path: Option<&Path>, _host: Interned<String>, target: Interned<String> run.builder.ensure(Rls {
) { stage: run.builder.top_stage,
builder.ensure(Rls { target: run.target,
stage: builder.top_stage,
target,
}); });
} }