aboutsummaryrefslogtreecommitdiff
path: root/bzl_library.bzl
diff options
context:
space:
mode:
authorJoe Fradley <joefradley@google.com>2023-11-21 11:49:00 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-11-21 11:49:00 +0000
commitaa7d9df987e251a7c5cdce9fee9aeeb2eb2af388 (patch)
treeff4f2948d51ace255426885412990bc9489474cb /bzl_library.bzl
parentf8aadd2ad5a51ac3187333bf589a754c5347d447 (diff)
parenta7ef9ffeafcdd200a4e72377be5450f74aea1523 (diff)
downloadbazel-skylib-aa7d9df987e251a7c5cdce9fee9aeeb2eb2af388.tar.gz
Upgrade bazel-skylib to 1.5.0 am: a7ef9ffeaf
Original change: https://android-review.googlesource.com/c/platform/external/bazel-skylib/+/2839138 Change-Id: I0e01f2d66bcb072cb2e2a80e42666f9bd223ef86 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'bzl_library.bzl')
-rw-r--r--bzl_library.bzl11
1 files changed, 7 insertions, 4 deletions
diff --git a/bzl_library.bzl b/bzl_library.bzl
index 1b59440..9091894 100644
--- a/bzl_library.bzl
+++ b/bzl_library.bzl
@@ -26,6 +26,9 @@ StarlarkLibraryInfo = provider(
def _bzl_library_impl(ctx):
deps_files = [x.files for x in ctx.attr.deps]
all_files = depset(ctx.files.srcs, order = "postorder", transitive = deps_files)
+ if not ctx.files.srcs and not deps_files:
+ fail("bzl_library rule '%s' has no srcs or deps" % ctx.label)
+
return [
# All dependent files should be listed in both `files` and in `runfiles`;
# this ensures that a `bzl_library` can be referenced as `data` from
@@ -46,11 +49,11 @@ bzl_library = rule(
implementation = _bzl_library_impl,
attrs = {
"srcs": attr.label_list(
- allow_files = [".bzl"],
- doc = "List of `.bzl` files that are processed to create this target.",
+ allow_files = [".bzl", ".scl"],
+ doc = "List of `.bzl` and `.scl` files that are processed to create this target.",
),
"deps": attr.label_list(
- allow_files = [".bzl"],
+ allow_files = [".bzl", ".scl"],
providers = [
[StarlarkLibraryInfo],
],
@@ -58,7 +61,7 @@ bzl_library = rule(
Starlark files listed in `srcs`.""",
),
},
- doc = """Creates a logical collection of Starlark .bzl files.
+ doc = """Creates a logical collection of Starlark .bzl and .scl files.
Example:
Suppose your project has the following structure: