bazel-skylib/docs/directory_glob_doc.md

1.9 KiB
Executable File

Rules to filter files from a directory.

directory_glob

directory_glob(name, srcs, data, allow_empty, directory, exclude)

globs files from a directory by relative path.

Usage:

directory_glob(
    name = "foo",
    directory = ":directory",
    srcs = ["foo/bar"],
    data = ["foo/**"],
    exclude = ["foo/**/*.h"]
)

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
srcs A list of globs to files within the directory to put in the files.

For example, srcs = ["foo/**"] would collect the file at <directory>/foo into the files.
List of strings optional []
data A list of globs to files within the directory to put in the runfiles.

For example, data = ["foo/**"] would collect all files contained within <directory>/foo into the runfiles.
List of strings optional []
allow_empty If true, allows globs to not match anything. Boolean optional False
directory - Label required
exclude A list of globs to files within the directory to exclude from the files and runfiles. List of strings optional []