2
0
Fork 0
mirror of https://github.com/bazelbuild/bazel-skylib synced 2024-11-27 05:43:25 +00:00
bazel-skylib/docs/bzl_library.md
Alexandre Rostovtsev 99ffbbf8a4
Prepare release 1.6.0 (#496)
And take the opportunity to reformat docs using a more modern Stardoc release
2024-04-24 17:40:06 -04:00

2.4 KiB
Executable file

Skylib module containing a library rule for aggregating rules files.

bzl_library

bzl_library(name, deps, srcs)

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",
    ],
)

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
deps List of other bzl_library or filegroup targets that are required by the Starlark files listed in srcs. List of labels optional []
srcs List of .bzl and .scl files that are processed to create this target. List of labels optional []

StarlarkLibraryInfo

StarlarkLibraryInfo(srcs, transitive_srcs)

Information on contained Starlark rules.

FIELDS

Name Description
srcs Top level rules files.
transitive_srcs Transitive closure of rules files required for interpretation of the srcs