summaryrefslogtreecommitdiff
path: root/tests/zip/BUILD
diff options
context:
space:
mode:
authorDavid L. Jones <david.l.jones@gmail.com>2022-05-04 07:20:16 -0700
committerGitHub <noreply@github.com>2022-05-04 10:20:16 -0400
commit00c8f6f541de308710fed893a774e98454811a81 (patch)
treec7d5a8ff884d5a20568bce0ab2cd0e2debbbca4d /tests/zip/BUILD
parent4f8f6ed027c07b92e4ee5a8b4b51d8673fcc60ee (diff)
downloadbazelbuild-rules_pkg-00c8f6f541de308710fed893a774e98454811a81.tar.gz
Substitute package variables in `pkg_zip#package_dir`. (#577)
This change adds logic and tests for substituting values from `pkg_zip#package_variables` into `pkg_zip#package_dir`. This behavior largely matches `pkg_tar` (`pkg_zip` does not have an equivalent to `pkg_tar#package_dir_file`, but they are otherwise the same).
Diffstat (limited to 'tests/zip/BUILD')
-rw-r--r--tests/zip/BUILD17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/zip/BUILD b/tests/zip/BUILD
index fc689f5..b1bc85c 100644
--- a/tests/zip/BUILD
+++ b/tests/zip/BUILD
@@ -15,6 +15,7 @@
load("//pkg:mappings.bzl", "pkg_attributes", "pkg_mkdirs", "pkg_mklink")
load("//pkg:zip.bzl", "pkg_zip")
+load("//tests:my_package_name.bzl", "my_package_naming")
load("//tests/util:defs.bzl", "directory", "fake_artifact")
load("@rules_python//python:defs.bzl", "py_library", "py_test")
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
@@ -209,6 +210,21 @@ filegroup(
"/abc/def/",
])]
+my_package_naming(
+ name = "my_package_variables",
+ label = "some_value",
+)
+
+pkg_zip(
+ name = "test_zip_package_dir_substitution",
+ srcs = [
+ "//tests:testdata/hello.txt",
+ "//tests:testdata/loremipsum.txt",
+ ],
+ package_dir = "/level1/{label}/level3",
+ package_variables = ":my_package_variables",
+)
+
py_test(
name = "zip_test",
srcs = [
@@ -222,6 +238,7 @@ py_test(
":test_zip_basic.zip",
":test_zip_empty.zip",
":test_zip_package_dir0.zip",
+ ":test_zip_package_dir_substitution.zip",
":test_zip_permissions.zip",
":test_zip_timestamp.zip",
":test_zip_tree.zip",