Example file tree
BUILD
docs/BUILD
docs/index.md
docs/reference/index.md
docs/BUILD
filegroup(name = "docs", srcs = glob(["**/*"]))
BUILD
pkg_files(
name = "share_doc",
srcs = [
"//docs",
],
strip_prefix = strip_prefix.from_pkg(),
prefix = "usr/share/doc/foo",
)
This gives the output I expect - that the directory tree is preserved.
usr/share/doc/foo/index.md
usr/share/doc/foo/reference/
usr/share/doc/foo/reference/index.md
But.... if I do not have strip_prefix, pkg_files flattens the tree and I get the error. Error in fail: After renames, multiple sources (at least docs/index.md, docs/reference/index.md) map to the same destination. Consider adjusting strip_prefix and/or renames
This might be a carry over from legacy behavior, but it is strange and confusing.
Proposal
pkg_files adds an attribute squash_tree bool, default=False which controls squashing the tree.
- strip prefix and any name filtering are applied first, then the results are squashed if squash_tree=False.
Example file tree
docs/BUILD
filegroup(name = "docs", srcs = glob(["**/*"]))BUILD
This gives the output I expect - that the directory tree is preserved.
But.... if I do not have
strip_prefix,pkg_filesflattens the tree and I get the error.Error in fail: After renames, multiple sources (at least docs/index.md, docs/reference/index.md) map to the same destination. Consider adjusting strip_prefix and/or renamesThis might be a carry over from legacy behavior, but it is strange and confusing.
Proposal
pkg_filesadds an attributesquash_treebool, default=False which controls squashing the tree.