Skip to content

Commit

Permalink
fix: allow copy_to_directory to have an empty srcs list (#871)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmagolan authored Jun 21, 2024
1 parent 3330c38 commit 18ae5a8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
3 changes: 0 additions & 3 deletions lib/private/copy_to_directory.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,6 @@ def copy_to_directory_bin_action(
})
file_inputs.append(f.file)

if not file_inputs:
fail("No files to copy")

config = {
"allow_overwrites": allow_overwrites,
"dst": dst.path,
Expand Down
19 changes: 19 additions & 0 deletions lib/tests/copy_to_directory/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -449,3 +449,22 @@ diff_test(
file1 = "case_21",
file2 = ":expected_21",
)

# Case 22: empty sources creates an empty directory output
copy_to_directory(
name = "case_22",
srcs = [],
)

copy_to_directory(
name = "expected_22",
srcs = ["dir_expected_22"],
exclude_srcs_patterns = ["**/filter_me_out"],
)

diff_test(
name = "case_22_test",
file1 = "case_22",
file2 = ":expected_22",
tags = ["local"], # seems that the Bazel sandbox has trouble with empty directories
)
Empty file.

0 comments on commit 18ae5a8

Please sign in to comment.