Skip to main content

ensured_artifact_group type

An artifact group that will be materialized to buck-out at the end of the bxl invocation. These artifacts can be printed to bxl's results. Doing so will print the path of each artifact in the group rather than the standard representation.

Ensured artifact groups are serializable and hashable.

ensured_artifact_group.abs_path

def ensured_artifact_group.abs_path()

Converts each artifact in this artifact group to be printed by its absolute path. Note that this will only print out the absolute path via ctx.output.print(). Starlark's print() will print out the display info for an ensured artifact group.

Sample usage:

def _impl_abs_path(ctx):
# some target with RunInfo outputs
result = ctx.analysis("root//bin/kind:target_with_outputs")
ensured = ctx.output.ensure_multiple(result.providers()[RunInfo]) # currently defaults to creating an EnsuredArtifactGroup with a relative path

ensured_with_abs_path = ensured.abs_path() # create a new EnsuredArtifactGroup with absolute path to reuse
print(ensured_with_abs_path) # should return something like <ensured group ... >
ctx.output.print(ensured_with_abs_path) # should return the absolute path of the artifact

ensured_artifact_group.rel_path

def ensured_artifact_group.rel_path()

Converts each artifact in this artifact group to be printed by its path relative to the project root. Note that this will only print out the relative path via ctx.output.print(). Starlark's print() will print out the display info for an ensured artifact group.

Sample usage:

def _impl_rel_path(ctx):
# some target with RunInfo outputs
result = ctx.analysis("root//bin/kind:target_with_outputs")
ensured = ctx.output.ensure_multiple(result.providers()[RunInfo]) # currently defaults to creating an EnsuredArtifactGroup with a relative path

ensured_with_rel_path = ensured.rel_path() # create a new EnsuredArtifact with relative path to reuse
print(ensured_with_rel_path) # should return something like <ensured group ... >
ctx.output.print(ensured_with_rel_path) # should return the relative path of the artifact