Skip to main content
Version: 1.5.x

docs/docs/bzl_library-docgen

Skylib module containing a library rule for aggregating rules files.

Rules

bzl_library

Creates a logical collection of Starlark .bzl and .scl files.

Example: Suppose your project has the following structure:

[workspace]/
WORKSPACE
BUILD
checkstyle/
BUILD
checkstyle.bzl
lua/
BUILD
lua.bzl
luarocks.bzl

In this case, you can have bzl_library targets in checkstyle/BUILD and lua/BUILD:

checkstyle/BUILD:

load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

bzl_library(
name = "checkstyle-rules",
srcs = ["checkstyle.bzl"],
)

lua/BUILD:

load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

bzl_library(
name = "lua-rules",
srcs = [
"lua.bzl",
"luarocks.bzl",
],
)

name

Required name.

A unique name for this target.

deps

Optional list of labels. Default: []

[Must provide StarlarkLibraryInfo]

List of other bzl_library targets that are required by the Starlark files listed in srcs.

srcs

Optional list of labels. Default: []

List of .bzl and .scl files that are processed to create this target.

Providers

StarlarkLibraryInfo

Information on contained Starlark rules.