Skip to main content

AnalysisResult

The result of running an analysis in bxl.

AnalysisResult.as_dependency

def AnalysisResult.as_dependency(
) -> dependency

Converts the analysis result into a dependency. Currently, you can only get a dependency without any transitions. This means that you cannot create an exec dep or toolchain from an analysis result.

We may support other dependency transition types in the future.

This is useful for passing in the results of ctx.analysis() into anon targets.

Sample usage:

def _impl_dependency(ctx):
node = ctx.configured_targets("root//bin:the_binary")
dependency = ctx.analysis(node).as_dependency()

AnalysisResult.providers

def AnalysisResult.providers()

Access the providers of the rule. Returns a provider_collection the same as accessing providers of dependencies within a rule implementation.

Sample usage:

def _impl_providers(ctx):
node = ctx.configured_targets("root//bin:the_binary")
providers = ctx.analysis(node).providers()
ctx.output.print(providers[FooInfo])
providers = ctx.analysis("//:bin").providers()
ctx.output.print(providers[FooInfo])