Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.aspect.build/llms.txt

Use this file to discover all available pages before exploring further.

Documentation for @bazel_lib@v3.2.0 View source
Rule and corresponding provider that joins a label pointing to a TreeArtifact with a path nested within that directory

Rule: directory_path

Provide DirectoryPathInfo to reference some path within a directory. Otherwise there is no way to give a Bazel label for it.

Attributes

name
name
required
A unique name for this target.
directory
label
required
a TreeArtifact (ctx.actions.declare_directory)
path
string
required
path relative to the directory

Function: make_directory_path

Helper function to generate a directory_path target and return its label.

Parameters

name
name
required
unique name for the generated directory_path target
directory
name
required
directory attribute passed to generated directory_path target
path
name
required
path attribute passed to generated directory_path target
kwargs
string_list
parameters to pass to generated output_files target
Returns: The label name

Function: make_directory_paths

Helper function to convert a dict of directory to path mappings to directory_path targets and labels. For example,
make_directory_paths("my_name", {
    "//directory/artifact:target_1": "file/path",
    "//directory/artifact:target_2": ["file/path1", "file/path2"],
})
generates the targets,
directory_path(
    name = "my_name_0",
    directory = "//directory/artifact:target_1",
    path = "file/path"
)

directory_path(
    name = "my_name_1",
    directory = "//directory/artifact:target_2",
    path = "file/path1"
)

directory_path(
    name = "my_name_2",
    directory = "//directory/artifact:target_2",
    path = "file/path2"
)
and the list of targets is returned,
[
    "my_name_0",
    "my_name_1",
    "my_name_2",
]

Parameters

name
name
required
The target name to use for the generated targets & labels.The names are generated as zero-indexed name + "_" + i
dict
name
required
The dictionary of directory keys to path or path list values.
kwargs
string_list
additional parameters to pass to each generated target
Returns: The label of the generated directory_path targets named name + "_" + i

Provider: DirectoryPathInfo

Joins a label pointing to a TreeArtifact with a path nested within that directory.

Fields

directory
a TreeArtifact (ctx.actions.declare_directory)
path
path relative to the directory