aboutsummaryrefslogtreecommitdiff
path: root/bzl_library.bzl
diff options
context:
space:
mode:
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: