@@ -72,36 +72,40 @@ impl<'a> Deref for Builder<'a> {
72
72
}
73
73
74
74
pub trait Step : ' static + Clone + Debug + PartialEq + Eq + Hash {
75
- /// `PathBuf` when directories are created or to return a `Compiler` once
76
- /// it's been assembled.
75
+ /// Result type of `Step::run`.
77
76
type Output : Clone ;
78
77
79
78
/// Whether this step is run by default as part of its respective phase.
80
- /// `true` here can still be overwritten by `should_run` calling `default_condition`.
79
+ ///
80
+ /// Note: Even if set to `true`, it can still be overridden (with `default_condition`) by `should_run`.
81
81
const DEFAULT : bool = false ;
82
82
83
83
/// If true, then this rule should be skipped if --target was specified, but --host was not
84
84
const ONLY_HOSTS : bool = false ;
85
85
86
- /// Primary function to execute this rule. Can call `builder.ensure()`
87
- /// with other steps to run those.
86
+ /// Primary function to implement `Step` logic.
87
+ ///
88
+ /// This function can be triggered in two ways:
89
+ /// 1. Directly from bootstrap `Step` handler.
90
+ /// 2. Indirectly by being called from other `Step`s using `builder.ensure()`.
88
91
///
89
- /// This gets called twice during a normal `./x.py` execution: first
90
- /// with `dry_run() == true`, and then for real.
92
+ /// When called directly from bootstrap, this function is called twice:
93
+ /// - First in "dry-run" mode to validate certain things (like cyclic Step invocations,
94
+ /// directory creation, etc) super quickly.
95
+ /// - Then it's called again to run the actual, very expensive process.
96
+ ///
97
+ /// When triggered indirectly from other `Step`s, it may still run twice (as dry-run and real mode)
98
+ /// depending on the `Step::run` implementation of the caller.
91
99
fn run ( self , builder : & Builder < ' _ > ) -> Self :: Output ;
92
100
93
- /// When bootstrap is passed a set of paths, this controls whether this rule
94
- /// will execute. However, it does not get called in a "default" context
95
- /// when we are not passed any paths; in that case, `make_run` is called
96
- /// directly.
101
+ /// Determines if this `Step` should be run when given specific paths (e.g., `x build $path`).
102
+ /// This is only checked when a path is passed (e.g., `x.py build $path`) and is not run
103
+ /// by default without any paths (e.g., `./x.py build`).
97
104
fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > ;
98
105
99
- /// Builds up a "root" rule, either as a default rule or from a path passed
100
- /// to us.
101
- ///
102
- /// When path is `None`, we are executing in a context where no paths were
103
- /// passed. When `./x.py build` is run, for example, this rule could get
104
- /// called if it is in the correct list below with a path of `None`.
106
+ /// Called directly by the bootstrap `Step` handler when not triggered indirectly by other `Step`s using `builder.ensure()`.
107
+ /// For example, `./x.py test bootstrap` runs this for `test::Bootstrap`. Similarly, `./x.py test` runs it
108
+ /// for every step that is listed by the `describe` macro in `Builder::get_step_descriptions`.
105
109
fn make_run ( _run : RunConfig < ' _ > ) {
106
110
// It is reasonable to not have an implementation of make_run for rules
107
111
// who do not want to get called from the root context. This means that
0 commit comments