Step in bootstrap::core::builder - Rust (original) (raw)
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 methods
fn make_run(_run: RunConfig<'_>) { ... }
fn metadata(&self) -> Option<StepMetadata> { ... }
}
If true, then this rule should be skipped if –target was specified, but –host was not
Result type of Step::run
.
Primary function to implement Step
logic.
This function can be triggered in two ways:
- Directly from Builder::execute_cli.
- Indirectly by being called from other
Step
s using Builder::ensure.
When called with Builder::execute_cli (as done by Build::build
), this function is 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.
Determines if this Step
should be run when given specific paths (e.g., x build $path
).
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.
Returns metadata of the step, for tests
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.