pub trait Step:
'static
+ Clone
+ Debug
+ PartialEq
+ Eq
+ Hash {
type Output: Clone;
const DEFAULT: bool = false;
const ONLY_HOSTS: bool = false;
// Required methods
fn run(self, builder: &Builder<'_>) -> Self::Output;
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_>;
// Provided method
fn make_run(_run: RunConfig<'_>) { ... }
}
Provided Associated Constants§
sourceconst DEFAULT: bool = false
const DEFAULT: bool = false
Whether this step is run by default as part of its respective phase, as defined by the describe
macro in Builder::get_step_descriptions
.
Note: Even if set to true
, it can still be overridden with ShouldRun::default_condition
by Step::should_run
.
sourceconst ONLY_HOSTS: bool = false
const ONLY_HOSTS: bool = false
If true, then this rule should be skipped if –target was specified, but –host was not
Required Associated Types§
Required Methods§
sourcefn run(self, builder: &Builder<'_>) -> Self::Output
fn run(self, builder: &Builder<'_>) -> Self::Output
Primary function to implement Step
logic.
This function can be triggered in two ways:
1. Directly from Builder::execute_cli
.
2. Indirectly by being called from other Step
s using Builder::ensure
.
When called with Builder::execute_cli
(as done by Build::build
), this function executed twice:
- First in “dry-run” mode to validate certain things (like cyclic Step invocations,
directory creation, etc) super quickly.
- Then it’s called again to run the actual, very expensive process.
When triggered indirectly from other Step
s, it may still run twice (as dry-run and real mode)
depending on the Step::run
implementation of the caller.
sourcefn should_run(run: ShouldRun<'_>) -> ShouldRun<'_>
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_>
Determines if this Step
should be run when given specific paths (e.g., x build $path
).
Provided Methods§
sourcefn make_run(_run: RunConfig<'_>)
fn make_run(_run: RunConfig<'_>)
Called directly by the bootstrap Step
handler when not triggered indirectly by other Step
s using Builder::ensure
.
For example, ./x.py test bootstrap
runs this for test::Bootstrap
. Similarly, ./x.py test
runs it for every step
that is listed by the describe
macro in Builder::get_step_descriptions
.