Skip to content

Commit

Permalink
fix: srcs is not mandatory (#786)
Browse files Browse the repository at this point in the history
  • Loading branch information
thesayyn authored Mar 8, 2024
1 parent d93c87f commit a29dd93
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/tar.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions lib/private/tar.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ _tar_attrs = {
If any of the srcs are binaries with runfiles, those are copied into the resulting tar as well.
""",
mandatory = True,
allow_files = True,
),
"mode": attr.string(
Expand Down Expand Up @@ -88,7 +87,7 @@ _tar_attrs = {
}

_mtree_attrs = {
"srcs": attr.label_list(doc = "Files that are placed into the tar", mandatory = True, allow_files = True),
"srcs": attr.label_list(doc = "Files that are placed into the tar", allow_files = True),
"out": attr.output(doc = "Resulting specification file to write"),
}

Expand Down
14 changes: 14 additions & 0 deletions lib/tests/tar/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -328,3 +328,17 @@ assert_tar_listing(
"-rwxr-xr-x 0 0 0 11358 Jan 1 2023 a",
],
)

# Case 11: Can create tar without srcs
tar(
name = "create_tmp",
mtree = ["./tmp time=1501783453.0 mode=1777 gid=0 uid=0 type=dir"],
)

assert_tar_listing(
name = "test_create_create_tmp",
actual = "create_tmp",
expected = [
"drwxrwxrwt 0 0 0 0 Aug 3 2017 ./tmp/",
],
)

0 comments on commit a29dd93

Please sign in to comment.