1*bcb5dc79SHONG Yifan<!-- Generated with Stardoc: http://skydoc.bazel.build --> 2*bcb5dc79SHONG Yifan 3*bcb5dc79SHONG YifanSkylib module containing a library rule for aggregating rules files. 4*bcb5dc79SHONG Yifan 5*bcb5dc79SHONG Yifan<a id="bzl_library"></a> 6*bcb5dc79SHONG Yifan 7*bcb5dc79SHONG Yifan## bzl_library 8*bcb5dc79SHONG Yifan 9*bcb5dc79SHONG Yifan<pre> 10*bcb5dc79SHONG Yifanbzl_library(<a href="#bzl_library-name">name</a>, <a href="#bzl_library-deps">deps</a>, <a href="#bzl_library-srcs">srcs</a>) 11*bcb5dc79SHONG Yifan</pre> 12*bcb5dc79SHONG Yifan 13*bcb5dc79SHONG YifanCreates a logical collection of Starlark .bzl and .scl files. 14*bcb5dc79SHONG Yifan 15*bcb5dc79SHONG YifanExample: 16*bcb5dc79SHONG Yifan Suppose your project has the following structure: 17*bcb5dc79SHONG Yifan 18*bcb5dc79SHONG Yifan ``` 19*bcb5dc79SHONG Yifan [workspace]/ 20*bcb5dc79SHONG Yifan WORKSPACE 21*bcb5dc79SHONG Yifan BUILD 22*bcb5dc79SHONG Yifan checkstyle/ 23*bcb5dc79SHONG Yifan BUILD 24*bcb5dc79SHONG Yifan checkstyle.bzl 25*bcb5dc79SHONG Yifan lua/ 26*bcb5dc79SHONG Yifan BUILD 27*bcb5dc79SHONG Yifan lua.bzl 28*bcb5dc79SHONG Yifan luarocks.bzl 29*bcb5dc79SHONG Yifan ``` 30*bcb5dc79SHONG Yifan 31*bcb5dc79SHONG Yifan In this case, you can have `bzl_library` targets in `checkstyle/BUILD` and 32*bcb5dc79SHONG Yifan `lua/BUILD`: 33*bcb5dc79SHONG Yifan 34*bcb5dc79SHONG Yifan `checkstyle/BUILD`: 35*bcb5dc79SHONG Yifan 36*bcb5dc79SHONG Yifan ```python 37*bcb5dc79SHONG Yifan load("@bazel_skylib//:bzl_library.bzl", "bzl_library") 38*bcb5dc79SHONG Yifan 39*bcb5dc79SHONG Yifan bzl_library( 40*bcb5dc79SHONG Yifan name = "checkstyle-rules", 41*bcb5dc79SHONG Yifan srcs = ["checkstyle.bzl"], 42*bcb5dc79SHONG Yifan ) 43*bcb5dc79SHONG Yifan ``` 44*bcb5dc79SHONG Yifan 45*bcb5dc79SHONG Yifan `lua/BUILD`: 46*bcb5dc79SHONG Yifan 47*bcb5dc79SHONG Yifan ```python 48*bcb5dc79SHONG Yifan load("@bazel_skylib//:bzl_library.bzl", "bzl_library") 49*bcb5dc79SHONG Yifan 50*bcb5dc79SHONG Yifan bzl_library( 51*bcb5dc79SHONG Yifan name = "lua-rules", 52*bcb5dc79SHONG Yifan srcs = [ 53*bcb5dc79SHONG Yifan "lua.bzl", 54*bcb5dc79SHONG Yifan "luarocks.bzl", 55*bcb5dc79SHONG Yifan ], 56*bcb5dc79SHONG Yifan ) 57*bcb5dc79SHONG Yifan ``` 58*bcb5dc79SHONG Yifan 59*bcb5dc79SHONG Yifan**ATTRIBUTES** 60*bcb5dc79SHONG Yifan 61*bcb5dc79SHONG Yifan 62*bcb5dc79SHONG Yifan| Name | Description | Type | Mandatory | Default | 63*bcb5dc79SHONG Yifan| :------------- | :------------- | :------------- | :------------- | :------------- | 64*bcb5dc79SHONG Yifan| <a id="bzl_library-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | | 65*bcb5dc79SHONG Yifan| <a id="bzl_library-deps"></a>deps | List of other `bzl_library` or `filegroup` targets that are required by the Starlark files listed in `srcs`. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` | 66*bcb5dc79SHONG Yifan| <a id="bzl_library-srcs"></a>srcs | List of `.bzl` and `.scl` files that are processed to create this target. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` | 67*bcb5dc79SHONG Yifan 68*bcb5dc79SHONG Yifan 69*bcb5dc79SHONG Yifan<a id="StarlarkLibraryInfo"></a> 70*bcb5dc79SHONG Yifan 71*bcb5dc79SHONG Yifan## StarlarkLibraryInfo 72*bcb5dc79SHONG Yifan 73*bcb5dc79SHONG Yifan<pre> 74*bcb5dc79SHONG YifanStarlarkLibraryInfo(<a href="#StarlarkLibraryInfo-srcs">srcs</a>, <a href="#StarlarkLibraryInfo-transitive_srcs">transitive_srcs</a>) 75*bcb5dc79SHONG Yifan</pre> 76*bcb5dc79SHONG Yifan 77*bcb5dc79SHONG YifanInformation on contained Starlark rules. 78*bcb5dc79SHONG Yifan 79*bcb5dc79SHONG Yifan**FIELDS** 80*bcb5dc79SHONG Yifan 81*bcb5dc79SHONG Yifan 82*bcb5dc79SHONG Yifan| Name | Description | 83*bcb5dc79SHONG Yifan| :------------- | :------------- | 84*bcb5dc79SHONG Yifan| <a id="StarlarkLibraryInfo-srcs"></a>srcs | Top level rules files. | 85*bcb5dc79SHONG Yifan| <a id="StarlarkLibraryInfo-transitive_srcs"></a>transitive_srcs | Transitive closure of rules files required for interpretation of the srcs | 86*bcb5dc79SHONG Yifan 87*bcb5dc79SHONG Yifan 88