@@ -72,36 +72,40 @@ impl<'a> Deref for Builder<'a> {
7272}
7373
7474pub 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`.
7776 type Output : Clone ;
7877
79- /// 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`.
78+ /// Whether this step is run by default as part of its respective phase, as defined by the `describe`
79+ /// macro in [`Builder::get_step_descriptions`].
80+ ///
81+ /// Note: Even if set to `true`, it can still be overridden with [`ShouldRun::default_condition`]
82+ /// by `Step::should_run`.
8183 const DEFAULT : bool = false ;
8284
8385 /// If true, then this rule should be skipped if --target was specified, but --host was not
8486 const ONLY_HOSTS : bool = false ;
8587
86- /// Primary function to execute this rule. Can call `builder.ensure()`
87- /// with other steps to run those.
88+ /// Primary function to implement `Step` logic.
89+ ///
90+ /// This function can be triggered in two ways:
91+ /// 1. Directly from [`Builder::execute_cli`].
92+ /// 2. Indirectly by being called from other `Step`s using [`Builder::ensure`].
8893 ///
89- /// This gets called twice during a normal `./x.py` execution: first
90- /// with `dry_run() == true`, and then for real.
94+ /// When called with [`Builder::execute_cli`] (as done by `Build::build`), this function executed twice:
95+ /// - First in "dry-run" mode to validate certain things (like cyclic Step invocations,
96+ /// directory creation, etc) super quickly.
97+ /// - Then it's called again to run the actual, very expensive process.
98+ ///
99+ /// When triggered indirectly from other `Step`s, it may still run twice (as dry-run and real mode)
100+ /// depending on the `Step::run` implementation of the caller.
91101 fn run ( self , builder : & Builder < ' _ > ) -> Self :: Output ;
92102
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.
103+ /// Determines if this `Step` should be run when given specific paths (e.g., `x build $path`).
97104 fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > ;
98105
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 for every step
108+ /// that is listed by the `describe` macro in [`Builder::get_step_descriptions`].
105109 fn make_run ( _run : RunConfig < ' _ > ) {
106110 // It is reasonable to not have an implementation of make_run for rules
107111 // who do not want to get called from the root context. This means that
0 commit comments