Skip to content

Commit a29dd93

Browse files
authored
fix: srcs is not mandatory (#786)
1 parent d93c87f commit a29dd93

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

docs/tar.md

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/private/tar.bzl

+1-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ _tar_attrs = {
5050
5151
If any of the srcs are binaries with runfiles, those are copied into the resulting tar as well.
5252
""",
53-
mandatory = True,
5453
allow_files = True,
5554
),
5655
"mode": attr.string(
@@ -88,7 +87,7 @@ _tar_attrs = {
8887
}
8988

9089
_mtree_attrs = {
91-
"srcs": attr.label_list(doc = "Files that are placed into the tar", mandatory = True, allow_files = True),
90+
"srcs": attr.label_list(doc = "Files that are placed into the tar", allow_files = True),
9291
"out": attr.output(doc = "Resulting specification file to write"),
9392
}
9493

lib/tests/tar/BUILD.bazel

+14
Original file line numberDiff line numberDiff line change
@@ -328,3 +328,17 @@ assert_tar_listing(
328328
"-rwxr-xr-x 0 0 0 11358 Jan 1 2023 a",
329329
],
330330
)
331+
332+
# Case 11: Can create tar without srcs
333+
tar(
334+
name = "create_tmp",
335+
mtree = ["./tmp time=1501783453.0 mode=1777 gid=0 uid=0 type=dir"],
336+
)
337+
338+
assert_tar_listing(
339+
name = "test_create_create_tmp",
340+
actual = "create_tmp",
341+
expected = [
342+
"drwxrwxrwt 0 0 0 0 Aug 3 2017 ./tmp/",
343+
],
344+
)

0 commit comments

Comments
 (0)