Skip to content

Commit

Permalink
feat: add include_srcs_packages and exclude_srcs_packages and improve…
Browse files Browse the repository at this point in the history
… implementation and documentation of other filters and transformations (#203)
  • Loading branch information
gregmagolan authored Jul 29, 2022
1 parent 8391262 commit 71910e9
Show file tree
Hide file tree
Showing 41 changed files with 375 additions and 133 deletions.
27 changes: 16 additions & 11 deletions docs/copy_to_directory.md

Large diffs are not rendered by default.

379 changes: 258 additions & 121 deletions lib/private/copy_to_directory.bzl

Large diffs are not rendered by default.

64 changes: 63 additions & 1 deletion lib/tests/copy_to_directory/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ load("//lib:directory_path.bzl", "make_directory_paths")
"expected_9",
"expected_10",
"expected_13_14",
"expected_15",
"expected_16",
"expected_17",
"expected_18",
]
]

Expand All @@ -46,7 +50,7 @@ case_srcs = [
copy_to_directory(
name = "case_1",
srcs = case_srcs,
include_external_repositories = ["external_test_repo"],
include_external_repositories = ["externa?_*_rep*"],
)

diff_test(
Expand Down Expand Up @@ -338,3 +342,61 @@ diff_test(
file1 = "case_14",
file2 = ":expected_13_14",
)

# Case 15: include_srcs_packages
copy_to_directory(
name = "case_15",
srcs = case_srcs,
include_external_repositories = ["externa?_*_rep*"],
include_srcs_packages = [package_name()],
)

diff_test(
name = "case_15_test",
file1 = "case_15",
file2 = ":expected_15",
)

# Case 16: include_srcs_packages multiple with root package
copy_to_directory(
name = "case_16",
srcs = case_srcs,
include_external_repositories = ["externa?_*_rep*"],
include_srcs_packages = [
package_name(),
"",
],
)

diff_test(
name = "case_16_test",
file1 = "case_16",
file2 = ":expected_16",
)

# Case 17: exclude_srcs_packages
copy_to_directory(
name = "case_17",
srcs = case_srcs,
exclude_srcs_packages = [package_name()],
)

diff_test(
name = "case_17_test",
file1 = "case_17",
file2 = ":expected_17",
)

# Case 18: exclude_srcs_packages to exclude all subpackages
copy_to_directory(
name = "case_18",
srcs = case_srcs,
exclude_srcs_packages = ["{}/**".format(package_name())],
include_external_repositories = ["e?ter*_test_repo"],
)

diff_test(
name = "case_18_test",
file1 = "case_18",
file2 = ":expected_18",
)
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_15/a/a
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_15/a/a2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_15/b/b
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_15/b/b2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_15/c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_15/d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_15/e/e1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_15/e/e2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_16/a/a
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_16/a/a2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_16/b/b
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_16/b/b2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_16/c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_16/d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_16/e/e1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_16/e/e2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_16/test_a/test_a
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_16/test_a/test_a2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_16/test_b/test_b
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_16/test_b/test_b2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_16/test_c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_16/test_d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_17/f/f2/f1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_17/f/f2/f2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_18/a/a
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_18/a/a2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_18/b/b
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_18/b/b2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_18/c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_18/d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_18/e/e1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_18/e/e2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_18/test_a/test_a
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_18/test_a/test_a2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_18/test_b/test_b
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_18/test_b/test_b2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_18/test_c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory/dir_expected_18/test_d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobar

0 comments on commit 71910e9

Please sign in to comment.