Skip to content

Commit 38510fe

Browse files
Require should_run to be implemented.
1 parent 336722f commit 38510fe

File tree

6 files changed

+64
-2
lines changed

6 files changed

+64
-2
lines changed

src/bootstrap/builder.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash {
7070
/// will execute. However, it does not get called in a "default" context
7171
/// when we are not passed any paths; in that case, make_run is called
7272
/// directly.
73-
fn should_run(_builder: &Builder, _path: &Path) -> bool { false }
73+
fn should_run(builder: &Builder, path: &Path) -> bool;
7474

7575
/// Build up a "root" rule, either as a default rule or from a path passed
7676
/// to us.
@@ -83,7 +83,13 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash {
8383
_path: Option<&Path>,
8484
_host: Interned<String>,
8585
_target: Interned<String>,
86-
) { unimplemented!() }
86+
) {
87+
// It is reasonable to not have an implementation of make_run for rules
88+
// who do not want to get called from the root context. This means that
89+
// they are likely dependencies (e.g., sysroot creation) or similar, and
90+
// as such calling them from ./x.py isn't logical.
91+
unimplemented!()
92+
}
8793
}
8894

8995
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
@@ -188,6 +194,11 @@ impl<'a> Builder<'a> {
188194
}
189195
impl Step for Libdir {
190196
type Output = Interned<PathBuf>;
197+
198+
fn should_run(_builder: &Builder, _path: &Path) -> bool {
199+
false
200+
}
201+
191202
fn run(self, builder: &Builder) -> Interned<PathBuf> {
192203
let compiler = self.compiler;
193204
let lib = if compiler.stage >= 2 && builder.build.config.libdir_relative.is_some() {

src/bootstrap/check.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,6 +1308,10 @@ pub struct RemoteCopyLibs {
13081308
impl Step for RemoteCopyLibs {
13091309
type Output = ();
13101310

1311+
fn should_run(_builder: &Builder, _path: &Path) -> bool {
1312+
false
1313+
}
1314+
13111315
fn run(self, builder: &Builder) {
13121316
let build = builder.build;
13131317
let compiler = self.compiler;
@@ -1359,6 +1363,10 @@ pub struct Distcheck;
13591363
impl Step for Distcheck {
13601364
type Output = ();
13611365

1366+
fn should_run(_builder: &Builder, path: &Path) -> bool {
1367+
path.ends_with("distcheck")
1368+
}
1369+
13621370
/// Run "distcheck", a 'make check' from a tarball
13631371
fn run(self, builder: &Builder) {
13641372
let build = builder.build;

src/bootstrap/compile.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ struct StdLink {
276276
impl Step for StdLink {
277277
type Output = ();
278278

279+
fn should_run(_builder: &Builder, _path: &Path) -> bool {
280+
false
281+
}
282+
279283
/// Link all libstd rlibs/dylibs into the sysroot location.
280284
///
281285
/// Links those artifacts generated by `compiler` to a the `stage` compiler's
@@ -503,6 +507,10 @@ pub struct TestLink {
503507
impl Step for TestLink {
504508
type Output = ();
505509

510+
fn should_run(_builder: &Builder, _path: &Path) -> bool {
511+
false
512+
}
513+
506514
/// Same as `std_link`, only for libtest
507515
fn run(self, builder: &Builder) {
508516
let build = builder.build;
@@ -691,6 +699,10 @@ struct RustcLink {
691699
impl Step for RustcLink {
692700
type Output = ();
693701

702+
fn should_run(_builder: &Builder, _path: &Path) -> bool {
703+
false
704+
}
705+
694706
/// Same as `std_link`, only for librustc
695707
fn run(self, builder: &Builder) {
696708
let build = builder.build;
@@ -743,6 +755,10 @@ pub struct Sysroot {
743755
impl Step for Sysroot {
744756
type Output = Interned<PathBuf>;
745757

758+
fn should_run(_builder: &Builder, _path: &Path) -> bool {
759+
false
760+
}
761+
746762
/// Returns the sysroot for the `compiler` specified that *this build system
747763
/// generates*.
748764
///
@@ -789,6 +805,10 @@ pub struct Assemble {
789805
impl Step for Assemble {
790806
type Output = Compiler;
791807

808+
fn should_run(_builder: &Builder, path: &Path) -> bool {
809+
path.ends_with("src/rustc")
810+
}
811+
792812
/// Prepare a new compiler from the artifacts in `stage`
793813
///
794814
/// This will assemble a compiler in `build/$host/stage$stage`. The compiler

src/bootstrap/doc.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ pub struct Rustbook {
107107
impl Step for Rustbook {
108108
type Output = ();
109109

110+
// rustbook is never directly called, and only serves as a shim for the nomicon and the
111+
// reference.
112+
fn should_run(_builder: &Builder, _path: &Path) -> bool {
113+
false
114+
}
115+
110116
/// Invoke `rustbook` for `target` for the doc book `name`.
111117
///
112118
/// This will not actually generate any documentation if the documentation has
@@ -182,6 +188,11 @@ pub struct RustbookSrc {
182188
impl Step for RustbookSrc {
183189
type Output = ();
184190

191+
fn should_run(_builder: &Builder, _path: &Path) -> bool {
192+
// RustbookSrc is also never run directly, only as a helper to other rules
193+
false
194+
}
195+
185196
/// Invoke `rustbook` for `target` for the doc book `name` from the `src` path.
186197
///
187198
/// This will not actually generate any documentation if the documentation has

src/bootstrap/native.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ impl Step for Llvm {
5555
type Output = ();
5656
const ONLY_HOSTS: bool = true;
5757

58+
fn should_run(_builder: &Builder, path: &Path) -> bool {
59+
path.ends_with("src/llvm")
60+
}
61+
5862
/// Compile LLVM for `target`.
5963
fn run(self, builder: &Builder) {
6064
let build = builder.build;

src/bootstrap/tool.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ pub struct CleanTools {
5555
impl Step for CleanTools {
5656
type Output = ();
5757

58+
fn should_run(_builder: &Builder, _path: &Path) -> bool {
59+
false
60+
}
61+
5862
/// Build a tool in `src/tools`
5963
///
6064
/// This will build the specified tool with the specified `host` compiler in
@@ -89,6 +93,10 @@ pub struct ToolBuild {
8993
impl Step for ToolBuild {
9094
type Output = PathBuf;
9195

96+
fn should_run(_builder: &Builder, _path: &Path) -> bool {
97+
false
98+
}
99+
92100
/// Build a tool in `src/tools`
93101
///
94102
/// This will build the specified tool with the specified `host` compiler in

0 commit comments

Comments
 (0)