| """Turn a label_list of mixed sources and bzl_library's into a bzl_library. |
| The sources can be anything. Only the ones that end in ".bzl" will be added. |
| load("@bazel_skylib//:bzl_library.bzl", "StarlarkLibraryInfo") |
| def _make_starlark_library(ctx): |
| for src in ctx.attr.srcs: |
| if StarlarkLibraryInfo in src: |
| transitive.append(src[StarlarkLibraryInfo]) |
| for file in src[DefaultInfo].files.to_list(): |
| if file.path.endswith(".bzl"): |
| all_files = depset(direct, transitive = transitive) |
| DefaultInfo(files = all_files, runfiles = ctx.runfiles(transitive_files = all_files)), |
| StarlarkLibraryInfo(srcs = direct, transitive_srcs = all_files), |
| implementation = _make_starlark_library, |
| doc = "Any mix of source files. Only .bzl files will be used.", |