Lazy
bxl.Lazy can be resolved to the actual result. The computation only happens when called .resolve()
or .catch().resolve()
.
Lazy.catch
def Lazy.catch() -> bxl.Lazy
Make Lazy
can be resolved later by catching the error.
Example:
def _impl(ctx):
target = ctx.configured_targets("cell//path/to:target")
analysis_result = ctx.lazy.analysis(target).catch().resolve()
Lazy.resolve
def Lazy.resolve()
Resolve the operation to the final result. When called via .catch().resolve()
, the error will be catched and returned as a bxl.Result
. Otherwise, it will return the raw type without catching the error.
Example:
def _impl(ctx):
target = ctx.configured_targets("cell//path/to:target")
analysis_result = ctx.lazy.analysis(target).resolve()